Pretty amazing, and I only saw it thanks to a pingback. Now I have to get back into XNA… I miss it and I haven’t posted anything here since March. I think that’s when I started playing WoW again.
A coworker recently shared a game called Chain Reaction with me that I think would translate well into XNA. Better yet, the graphics are easy to build from scratch, which tends to be one big reason I abandon projects. I’m not even a shred of an artist or digital music producer (I can lay tracks, but they aren’t good), so there is a lack of content there that makes indie dev difficult for me. I might give this game a go and see how it turns out.
While reading all the latest WP7 buzz, I got to thinking that I am going to need some way of managing input between devices so as not to have a billion #if WINDOWS_PHONE or #if XBOX preprocessor statements all over my game logic. The solution is a pretty simple yet elegant abstracted IGameActionManager interface.
Each function corresponds to a typical game action, and the GetNewState() function gets the state for all input devices associated with the implented class itself. Knowing nothing of the implementation, other than which one you want, your game logic would look something like this:
IGameActionManager actionManager = new WindowsGameActionManager();
// somewhere in your update method:
actionManager.GetNewState();
if (actionManager.IsJumping())
{
// Do your jump logic here
}
if (actionManager.IsMovingLeft())
{
// Do your move left logic here
}
That eliminates code like:
#if !XBOX
KeyboardState keyboardState = Keyboard.GetState();
if (keyboardState.IsKeyDown(Keys.Space) && previousKeyboardState.IsKeyUp(Keys.Space))
#else
GamePadState gamePadState = GamePad.GetState();
if (gamePadState.DPad.Up == ButtonState.Pressed)
#endif
{
// Do your jump logic here
}
The result is less clutter in your game code itself, but more importantly, your code is more game related. You are now worrying about things like “Is the player trying to jump” instead of “is the player pressing the key that I designated to jump?”
I’m still working out exactly how to handle previous state code within the class, but for now you would probably have to declare a previous IGameActionManager object and get a new state at the appropriate time. The code is still cleaner than worrying about actual key presses throughout still, though.
Here is a windows implementation example for the IGameActionManager:
I purchased an HTC Ozone (upgradable to WM6.5), and a couple months later the Droid came to Verizon. Needless to say, I was upset, but there was nothing I could do about it.
That’s right… XNA and Silverlight are coming to Windows Mobile 7. Before now, I was just counting the days until my current Verizon contract was up so that I could get my hands on a Droid. That would’ve meant learning a whole new set of development tools, and possibly a new language altogether (I’m not too sure what development for the Android OS is all about). Now, though, my current .NET & XNA skills should be transferable!
A quote from the Engadget article:
…[Charlie] Kindel boldly proclaims that “If you are Silverlight or XNA developer today you’re gonna be really happy.”
I sure am.
I can’t wait to see what all the great XNA devs come up with for the gaming side of things, and it should be pretty interesting to see what type of apps are made using Silverlight. The possibilities are endless and exciting.
My only hope is that they build upon the successes of the Xbox Live Indie Games platform and allow independent game developers to distribute their games and make some cash. Every other similar phone has a market place right now, and to not include that capability would be a devastating mistake on Microsoft’s part. Without the ability to buy a phone, search for fun apps & games, buy, and play with them immediately, I don’t believe that anyone could look at all their options (e.g. iPhone and Droid) and choose a “crippled” Windows Mobile 7 phone over them. Update: http://twitter.com/wp7dev/status/10005356682there will be a marketplace. WOOT!
All in all, it’s an extremely exciting announcement, and I hope that everyone sees the potential like I do.
I leave you with a demo of the Windows Mobile 7 phone:
I was making a crontab script for a customer today when I got the inspiration to finally do what I have been wanting to do for a while. I wrote a script to write the script for me. This handy script reads in 4 parameters:
The working directory (where to cd to)
A binary file (or command to run)
A file containing the PID of the process to restart
An output file to save the script to.
This generates a script that can be run from anywhere, like the crontab which will check to make sure the process is running. It will restart the process if not by running the binary file parameter.
The generated script is based on the Unreal3.2 ircdchk script, with some slight modifications. I hope someone finds it useful… if you do, drop a comment here.
It happens to everyone in the hosting industry: hard drive failure. It happened to me on New Year’s Eve. Worst of all, I had not been watching my backups properly. We use cPanel, and its backups are amazing, but sometimes they are too amazing, because you don’t have to watch them. They are reliable in that you can just restore them and have a fully functional website back in seconds. Been there done that, and I had set cPanel to backup accounts a long time ago and just assumed they were working well. In fact, the backup drive was filling up and not all accounts on the server were being backed up properly. Needless to say, when the hard drive failed enough to cause kernel panics in FreeBSD, our only option was to reinstall on a new drive. That is when the fun started.
Once the system was reinstalled, and cPanel was installed, I had the chance to look at the backup situation. The situation was grim, and there was a lot of work to be done. Of the 70+ accounts on this server, 29 were not backed up properly via cPanel. The 40+ accounts that had cPanel backups were restored in minutes with no data loss, but the other 29 were not so lucky, and this website was one of those.
cPanel backs up roughly the following:
Home directory
public_html directory
MySQL data including databases, users, tables, and the data in the tables
Subdomains, parked domains, and addon domains (like geekpowers.com)
Email accounts
Ftp accounts
None of that was backed up in a restorable package, so the process was as follows:
Create the account manually via our billing system, which creates the cPanel account (luckily the billing system’s account had a healthy backup!).
Copy the /home directory and public_html directory from the old hard drive (luckily it was still usable)
Restore all subdomains and addon domains, pointing them to the proper directory under public_html
Add all databases by looking in /var/db/mysql for the username_ prefix (luckily cPanel prefixes databases with the username).
Copy the /oldvar/db/mysql/username_database/ contents into the matching database location in /var/db/mysql/username_database.
Search through the user files for the database name, and look at config files for the username & password to set as having access to the newly created databases.
Unfortunately, there was nothing to be done for email accounts and ftp accounts… that data was lost, and there was nothing for me to look at to refer to for restoring them.
I am simply amazed that the process above seemed to work. It felt so hopeless for a couple days, and I was really dreading the thought of telling customers that their data was just gone… customers that have been with me for almost 8 years. Thanks to a little ingenuity and a lot of luck, though, that did not have to happen, and we were able to restore all accounts.
Lesson learned: do not take backups for granted. I am already in talks with my datacenter about an external backup solution they offer which runs RAID 6. I don’t ever want to feel dread when a hardware failure occurs again. I want to be prepared to be back up in the shortest amount of time possible by keeping the most solid backups I can.
No video this time (yet), but I wanted to post to let anyone who is interested know that I have been making some slow progress with BeatPong. I just committed revision 20 which showcases a single particle system that is triggered on a beat.
The new XML beat element format is:
<Beat effect=”smoke” duration=”00:00:05.0000000″>00:00:12.8150000</Beat>
The new effect attribute specifies a name for the particle system, and the duration specifies how long the particle system will be on for. The inner text still specifies the time of the beat. This particular beat would occur at 12.815 seconds into the song, and the smoke effect would last for 5 seconds.
Right now it’s pretty basic… with every beat, if the beat has an effect attribute, a function is called to add the DateTime object which specifies when the specified particle system should stop emitting particles. The times are stored in a Dictionary<ParticleSystem, DateTime> object. The UpdateSmokeParticles() function checks the DateTime for the smoke particle system every time the update runs (60 per second by default in XNA), and if the current time is less than or equal to the end time in the dictionary, it emits a particle. Plain and simple right? I forgot that the emitter is also moved along with the ball, and the ball is made invisible, so you get the effect of smoke coming out where the ball should be.
I’m pretty excited about this, as it lays the framework for other beat triggered events, and it will be the foundation for all the particle effects that need to be beat synchronized.
I have been hard at work on BeatPong, recently adding a menu system and a score reading at the top. I took the menu system from an XNA creators club example and adapted it to BeatPong. The example can be found here:http://creators.xna.com/en-US/samples/gamestatemanagement. Obviously, if you download the code as is, you will see that the options menu is completely bogus still, so it’s definitely a work in progress.
I think the coolest thing about how this was integrated is that the menu pause works by pausing the game update method essentially and pausing the music simultaneously. It’s a pretty basic function, but one of those things that just feels great to see in your own project.
Also important to note is that the player 2 paddle (right) is controlled by AI. If the ball is above the paddle, it moves up, and if the ball is below the paddle, it moves down. The speed of the paddle is limited to the same speed as the left side’s paddle, making it possible to score.
Well the site is now official! I registered geekpowers.com today, and I’m super stoked that I was able to find what I believe to be a great domain name. The site map is registered with Google, so now I just have to crank out some useful content, and maybe it will attract some readers.
It should work fine… after all, I have geek powers.
I’ve been working on a game that, in concept, would synchronize the horizontal velocity of a pong ball to music. The ultimate goal is of course to do this in real time, but for a proof of concept I have started developing the idea with an XML file which signifies the beats of a song. Here is what I have so far:
This video shows the ball with a locked vertical velocity for the sake of the demonstration. Prior to making this video, I used the record mode that I made. The song plays in the background, and I hit the spacebar on every beat. All the beats that I laid out with this method were then stored into an xml file (format shown @ http://xml.pastebin.com/f1e5cbe33). This video shows the playback of that XML file while the song plays in the background. Every time the ball hits a paddle, the horizontal velocity is adjusted so that it will hit the other paddle at the time when the next beat occurs.
Warning: Computer Science Content!