or Connect w/Facebook

Control Me

January 18th, 2010 - filed under Input Requested, Programming, Status Updates, Tech Demos

In the good old days of Jetpack 1, things were much simpler. Input from the keyboard or joystick was translated directly into action.

It was along the lines of:

  • if(key[right arrow]) speedx += 10;
  • sprite.posx += speedx;

Sometimes I miss the old days… The new path from input to action now looks like:

  • set up key bindings from default or configuration data
  • for each human player, translate input into commands based on bindings table; “right arrow” becomes “move right”
  • send commands to each player’s controlled entity
  • each entity processes commands through its state machine(s); if we’re on the ground, “move right” becomes “run right”
  • active states run actions – in this case, the “run right” state applies horizontal force to the entity’s physical body
  • the graphical representation of the physical body is updated

The new process is certainly more powerful, but requires somewhere around 1000x more effort to write. Below lies the implementation of the above process, the control tech demo. You can use the arrows to control all the various entities, and [square backets] or the mouse to switch entities. Your entity’s active state machines are displayed in the debug line at the bottom.

One of the nice things about this newfangled control system is that it meshes very well with the AI, which only needs to supply a command list to an entity, and not worry about the implementation details. You can see this in action when you launch a guided missile – it will follow the mouse cursor using a generic AI “chase” algorithm. This release also incorporates various other enhancements, including the launcher from a previous post.

Jetpack 2 Engine Status

I meant to have this demo out a month ago, but I opened up the Pandora’s Box of AS3 code optimization and fell in. This had to be done at some point, so I’m glad its mostly out of the way. On the plus side, I found several optimizations that doubled the frame rate of the game engine – there will be a big post on this later. The engine is pretty close to basic playability now, and I’ll be releasing a special retro version of Jetpack in March.

Personal Stuff

My gallbladder surgery was successful, but I’m only feeling about 25% better. I think it was worth it, but it looks like that wasn’t the cure-all I was hoping for. Thanks to all the well-wishers!

33 Responses to “Control Me”

  1. Jojo Jojo Says:

    While some things appeared more simple in the old days, I think that especially OOP and “modern programming” (yeah, whatever that may be) introduced many more layers of abstraction, which I tend to find very good in many cases (such as keyboard handling), as it will make things a lot easier when trying to add more features a month later. Nice to see the progress BTW, I like that demo up there.

  2. Jojo Jojo Says:

    Oh, and nice to hear of course that you’re better again now! I hope that you will also find those missing 75% somewhere soon. :)

  3. Dan Dan Says:

    At first I was skeptical about recreating this game in Flash because the physics just wouldn’t be the same. But from what I’ve seen from flying the newfangled jetman around is– WOW! It’s awesome!!! I love how when you hit a corner, too, he angles a little bit and doesn’t just stay straight up. So far, I freaking love the physics in this game. One thing, though, is that just like the Jetman’s jetpack, I think the rocket’s engines should shut off when you release the key. (But I know these might just be for the controls demo and not even be a playable character). I also love how the jetman looks kind of blocky and stuff. I think that there should be different style schemes to choose from, one being retro, with all the old graphics. Overall, bravo!! Love it!

  4. Adam / Adept Software Adam Says:

    I should have mentioned this, but anything you see with JP1 graphics is just because I haven’t gotten any new art to replace the old stuff yet. Also, these physics are all subject to change – I’m not going to sacrifice gameplay for realism. Especially the spring, which doesn’t behave predictably at all.

    I just patched it because it wasn’t working in IE.

    Also please Digg this if you’re on Digg!

  5. Adam Adam Says:

    Good job man! I hope your gall bladder gets better!

  6. Tim K Tim K Says:

    I love the physics! It’s interesting controlling the enemies too… it would be pretty neat to be able to go up to an object in the finished game and be able to take control of an enemy, then crash it through a breakable wall (that you can’t break through without the enemy).

    Looking great so far! Sorry to hear you aren’t feeling 100% better though

  7. Peeja Peter Jaros Says:

    Wow! This is great! I can’t wait to see the final result. Thanks for these demos; it’s great to see the work in progress. I’m glad your surgery went well.

  8. Syniphas Syniphas Says:

    This is some awesome stuff you got here!

    By the way, you said you didn’t have any art do use instead yet, do you have anyone to make the art for it already, or maybe are you going to do it yourself?

    If you still need some graphics done, I’d love to help you with it.

  9. Adam / Adept Software Adam Says:

    I’m always looking for good art, if you have any samples online send me a link!

  10. Moebiwan Moebiwan Says:

    Lookin good, Adam! Glad to see things coming along so well.

  11. Denilson Denilson Says:

    Hey, nice work! This demos appears to work flawlessly, even on Linux it runs at more than 90 fps.

    I must tell you that I spent most of my time playing with that spring. It’s so fun! :)

    I think you should make it a playable char, or make another game where the player controls that spring!

  12. David userblank Says:

    Hi,
    The demos do not work on my computer (WinME ,256MB ram, 1GB processor, IE6), will the final product work?

  13. Adam / Adept Software Adam Says:

    Do other flash games work for you? What are you seeing?

  14. Redeemer Redeemer Says:

    This is excellent! I love the physics. The spring is a lot of fun to play with, and I love how the jetman bounces around when he hits stuff. I can see the work you’ve done on the system. It’s interesting how easy it is to handle object AI automatically or just switch things over to the player’s control.

    Keep up the good work, and I hope your gall bladder gets better some time :)

  15. David userblank Says:

    I have adobe flash player 9.0c … The latest I can get. Most flash games work.
    The screen comes up with “Click to Start”, so I click, but after it finishes loading nothing happens.

  16. Adam / Adept Software Adam Says:

    Ahh that’s the problem, its built for Flash 10. I’ll try a build for flash 9 next time and see how fast it runs.

  17. David userblank Says:

    Ok, thanks.

  18. Robert Robert Says:

    Wow, adam, this is great! I hope you feel better soon. I liked walking on the steel ball, and the spring can do some neat tricks – like actually springing things! Awesome progress; I can’t wait for the demo!

  19. Adam / Adept Software Adam Says:

    Unfortunately it seems I’m using some things that only Flash 10 supports. The downloadable version may be runnable under Win 98/Me, I can’t be certain though.

    I’ve decided to make a full game release out of the retro mode of Jetpack, to get it out on portals, etc. It should be pretty exciting, I hope to have it done within a month!

  20. Silas Silas Says:

    I enjoyed this like the full game
    really (good times)
    this spring is sensational, boy
    and here goes my tribute to jetman: a single original sprite of him
    http://www.freeimagehosting.net/uploads/0719e33672.png

  21. David userblank Says:

    I played this demo on a frenz pc, and I did the same thing Robert did, stay on top of the ball. I also liked releasing heaps of guided missiles, place the cursor in the ceter of the screen, and watch them collide and spin out of control and come to a grinding halt on the floor.
    Looks like i’ll have to buy a new comp! =D

  22. JCS JCS Says:

    I see you decide to ditch email news, can I suggest you try this website: http://twitterfeed.com/ ?, I think its whenever you update your rss feed, it can add same thing to facebook and twitter. I use twitter and it gets my attention easily (from Echofon addon).

  23. Adam / Adept Software Adam Says:

    Is anyone else seeing the background shifted up and to the left? (column of black on the right)
    I just noticed that at work, but its not happening on my home computer.

  24. Adam / Adept Software Adam Says:

    Oops I meant to disable subscriptions for non-registered people and I accidentally hosed them all. Apologies to anyone who unsubscribed, I had to resubscribe everyone.

  25. Tim Tim Says:

    Well that explains why I received an email about this post this morning ;)

    I didn’t have the background problem, but I did notice some problems using the left and right keys after changing the gravity. A and D still worked, just not left and right.

    The only other thing I noticed was that there are some minor overlapping issues when the player flys against the perspective part of a block (like the roof of the block goes over the character and obscures his head, while the rest of the body is still visible). Not a big deal though and seems like it’d be a hassle to fix

  26. David userblank Says:

    I had the background problem, of course using a friends pc.

  27. Travis Travis Says:

    Wow, the game has got ALOT faster then the old demo you released!

  28. Adam / Adept Software Adam Says:

    I just noticed the blog looked really bad in IE6, which sadly is still used by 20% of the population. If you ever find yourself in this situation, remember this bit of wisdom: 90% of IE6 readability problems can be fixed with “width:100%”

  29. Robert Robert Says:

    I noticed the same problems as Tim after I played with the gravity a little. In fact…it seems as if the left and right arrow keys are disabled as soon as you touch the gravity, even if you just click on the uh…thing, without moving it.

  30. Adam / Adept Software Adam Says:

    Yes I believe the problem is I’m not switching focus back to the game, so the arrows are staying in the UI.

  31. Adam / Adept Software Adam Says:

    I’ve just put in a fix for IE8. Please let me know if this SWF doesn’t load for you (and you’re using Flash Player 10).

  32. ventuz ventuz Says:

    I use Firefox, Flash Player 10. Arrow left / right problem is still there for me.

    *Able to move left / right / up, click gravity. Not able to move left / right with arrow, but can move up.
    *Able to hold left, moving left. Click gravity, still moving left, until release. Then can’t move when press left again (same for moving right)
    *When losing left / right control, click next then prev (or prev then next).. gain left / right control again.

    I’m curious where do you plan on releasing this game? Kongregate? =0, it has some cool developer’s API (highscore, badges, content sharing, microtransactions, etc)

  33. Theta Theta Says:

    I noticed a glitch: It’s possible to get the missile stuck, what I did was I took Jetman, had him knock the Missile on it’s right side, took the Missile, Held up and it got stuck on the right side of the screen.

Leave a Reply

You must be a member to participate. Completing this form will create your account on JetpackHQ.


  • Categories