Nearly a month ago now, I blogged some sketches and ideas for a game I felt like writing. masterofwalri made a passing reference to Processing in his comment, and having heard people mention it in the past, I figured I should check it out.
I’m very, very glad I did.
It neatly deals with the issue of what I should develop for. The comments were leading me down the Java path anyway, but Processing’s two-click export to Applet and bundles for Windows, Linux and Mac OS sealed the deal. And it’s easy to program in too – it’s clear that it’s beginner-oriented, but it’s also ideal for simple games like this as it simply removes all the starting faff, like sorting out JPanel
s and TimerTask
s and all the rest. Time will tell if Processing over-simplifies things and stops me doing something I want to do, but for now it is excelling at the main task of high-level programming languages – reducing the amount of brain overhead I need to allocate in order to talk to the computer.
One lunchtime has produced 270 lines of code – which already includes the game area of the GUI, controllable player ships, and the beginnings of AI for the enemy ships.
Note: this blog post is old, and the game now has more functionality than is described here. The next blog post in the sequence is here.
Currently there’s no real gameplay – you can’t build, and ships can’t shoot or be damaged. You can move your ships (starting at the bottom of the screen) around, and the AI ship will hunt yours. Click on a ship to select it (blue circle), then click elsewhere to set its destination. Red lines, when they appear, show when ships would be shooting.
The next block of code will give the ships customised gear, health points, and the ability to attack and sink others. With that will probably come attack animations, which with my lack of skill in that department, will take a while. After that, damageable bases and win/lose conditions, then the build/research system. Finally, graphics tweaks, AI improvements and game balancing will finish it off.
More bloggery will appear once more coding occurs!
Comments
i think i broke it... after only a few clicks my boats just sit there going round in circles. after this they ignore all orders. :s
also, the CPU burn is huge... is limiting the frame rate (or separating the drawing code and game logic code into separate threads) a built in function?
thow sligth bug report my shipes seem to of go into a loop of spining round when it hit the edge of the map and the emerny ship also when i ramed it hope this helps but looking good
The going-round-in-circles bug is fixed, and will be in today's release. (Or tomorrow's if the headache wins tonight.)
Frame rate limiting is built in - today's build has it cranked down from 60 to 30. What PC/OS/browser config are you using? Usage is pretty low on my work laptop (C2D 2.8GHz, 3GB, WinXP, IE8). I've tried it on my temporary home machine while my MacBook's in for repair, (1.4GHz, 512MB, Ubuntu 9.10 LiveCD, Chrome 9) but it's hopeless on that.
Sadly separating game code and rendering doesn't actually seem possible in Processing - or at least, it's not designed to work that way. I'm sceptically putting up with it for now, but if CPU load is an issue on all platforms, I'll scrap the way it's currently working and hack some 'real' Java instead!