Porting to Flash...
Rarely do I get the motivation to continue working on a speedgame after the contest is over. And so RegEx Express is a bit of an anomaly for me, in that I'm still working on it.
However, I'm not working on it in Python -- I've ported the Curses emulation library to ActionScript, and have started porting over RegEx Express into the world of browser-based games.
When working on RegEx Express, I created the UI class structure in such a way that it could apply to any game, in any language. I've been tentatively calling this structure HUGS (Han's Universal Game Structure) -- basically, I'm trying to distill my experience with speed-gaming down to a collection of "best practices" that will help solve the perennial wheel-inventing that goes on with trying to create a UI structure, managing a game clock, how do you switch screens, do cut scenes, etc etc etc. I've been planning this for a while, and the first successful use of HUGS was on RegEx Express. Afterwards, I used it on my Pyday entry (though took advantage of precious little of its capabilities), and now I've got a working HUGS implementation in Actionscript as well.
So because I made a fairly straight-shootin' port of the Curses library, and I've got a HUGS game structure in both languages, it's a fairly copy-paste-port of the game. It's honestly not much more than copying the code, changing a few constants ("self" to "this"), and syntax changes (semicolons, curly braces, etc).
I'll definitely keep y'all posted with the progress in this front -- my goal is to port the game to Flash and get it up on some online edu-tainment portals, and perhaps even get it fun-enough to go on a place like Kongregate.
Thanks for reading, and I really genuinely appreciate everyone's voting feedback. We're working hard to implement many of those changes in the new version, and I hope that many of you will be willing to test and give feedback for future Flash versions.
Cheers!
--clint
(log in to comment)
Comments
Small update: Train is animated and chugging across the bottom of the screen at about 20fps.
the perennial wheel-inventing that goes on with trying to create a UI structure, managing a game clock, how do you switch screens, do cut scenes, etc etc etc
Cocos2D was born mostly as a way to solve this very same issues. Have you looked at it? even if you don't use it, the design might be interesting for you...
Thanks for the link, dmoisset -- I looked at it a bit last night on your recommendation. It seems to be much more of a graphics engine than I'm going for (HUGS is intended to be usable whether in 2D or 3D games), but I'll certainly look more at the structure of it. Thanks!
Progress update on the Flash version, the help screen is now working, and I've implemented my own word-wrap function for the help screen (before, it was very nice to just use the Python word-wrap routines).
Update: Regex hilighting engine is now working.
There are a few things that I've run into since porting this.
- There is no way to tell when a regex is valid or not. Seriously. It's a real pain, because before I could give feedback to the user as to when their regex was mal-formed. Now I can't. This is annoying. Anyone want to find/build me a regex that will determine if a regex is valid or not? I've looked around, and haven't found anything yet, but this is something I would love to have.
- For keyboard events, keyCode is not the same as charCode. I'm used to there being a single ASCII key code returned from a keyDown event. Actually, I'm not sure what I'm used to. But regardless, I had some troubles trying to get text input from the keyCode. It would work fine for letters and numbers, but when I would try to get characters like [] or ^$, it would croak and give me some bizarre unicode character. That's because I was using String.fromCharCode(keyCode), rather than String.fromCharCode(charCode). I was seriously close to putting a hidden textbox on the screen that would accept the key events and let me extract the final text.
- Line numbers aren't on by default. For a while, it was a royal pain because Flash wasn't telling me line numbers in my stack traces. This was really frustrating, and finally found in a comment in another piece of source code that you have to turn "enable debugging" on or something if you want to see line numbers. Well I'm just using the free command-line mxmlc, I'm not using any Flash IDEs. So from this excellent page, I learned that I could use the command-line switch "-compiler.verbose-stacktraces" to do some advanced debugging stuff, and lo-and-behold, it turned on line numbers. Whoo hoo! :)
--clint
pymike on 2008/10/06 20:45:
Very cool :)