FITC: Quick Drop in… UPDATED
// April 20th, 2008 // Development
Just killing some time before the Adobe Keynote, thought I’d made a quick post. Not sure if any of you other guys are going to be blogging anything from the show, but I’ll try and post in some general thoughts and observations about the talks I’m attending through out the next 2-3 days.
Haven’t seen much so far, as I didn’t get here until 12:30, but caught the last half of a talk on turn-based gaming and an intro to an open source, multi-platform intermediary language called haXe. I’ll come back later this evening, after Natzke, to post my summary of the day.
Updated: Notes after the jump…
First up was Flash’s Turn at Turn-based Games. I only got to see half of it, but there were some interesting solutions to common problems in making multi-player games for the web, as well as a couple of general tips.
Some highlights…
- When generating a random number, which of your two (or more) players’ clients generates the number, and then gives it to the other? Or does the server do it? To minimize bandwidth and delay between clients, create a really large array in your flash app that contains random numbers, generated by Math.rand(). Then, one of the clients generates a random seed number, which the two clients use to look up the first random number to start using in the array. Then, every time you need a new random number, just step through the array. Each player’s client doesn’t have to wait for the server to tell it what the random number was, because the client has a copy of the set that each client has agreed to use for the whole game. (Off-loading work to the client becomes really important when thousands of people are playing your game, simultaneously)
- For a multi-player picture puzzle game, how do you minimize the data sent to save and restore a game? The game in question was a picture puzzle (fit the pieces together to make a picture), and the players could save the game and come back to it later. So on a large, 1200 x 1200 board, all the pieces’ locations needed to be saved, so they would be in the same place when the players come back. But saving a messy x-y co-ordinate like “236.34 895″ is a lot of data, and the MSN network limits package transfers to 15k. Answer is to use a character map.
- Start by rounding the number to the nearest 10. ex. 236.34 and 895 become 23 and 89 (or, 230 and 890).
- Create a large character map set, with letters and numbers and whatever else you can pull from the ANSI character map.
- Then, to save the location of a puzzle piece, map the rounded x-y co-ordinates against your character map, so “23″ becomes “w” (23rd letter of the alphabet) and “89″ is whatever the 89th character in your map is.
This can shrink your save game down considerably, and minimize the load time.
- When sending synch messages back and forth between clients, don’t send every message and action as the user does them. Wait for the user to have “finished” making their move, then send a single message with the details of that move.
One great tip I got from a programming perspective is to not fix bugs in your app as you find them. Doing that can break your flow, and you may end up wasting all day trying to track down the source of a bug. Instead, make note of the bug and keep working on the task at hand. The bug will still get fixed, but do it when you’re not in the middle of developing something else.
The second presentation was about haXe, an open source “code once, deploy everywhere” language that you can use to write code for Flash 8/9, Javascript and even server side code. It’s actually a pretty neat idea. The code looks very similar to javascript and actionscript, and the idea is that you can write your app once in the haXe language, and then compile to a swf, a source JS file, or a haXe file for Neko, which is a mod for Apache.
haXe seems promising - it’s 30x faster than PHP and the presenter demonstrated how he could write a physic engine for flash in haXe, and then deploy the *same* engine to javascript, just by replacing the Flash Drawing library that his haXe app included with a javascript library that uses the canvas HTML element. (only supported in Safari and Firefox right now.)
It’s very impressive, but I’m not sure where it will go. It has IDE plugins for Flash Developand Eclipse, but in the end it will come down to developer support, and I think Adobe own tools are just way better. Plus, I’m not sure that haXe is a good fit for the kind of work we do.
All the same, it’s a bold vision, and I’m interested to see where it goes.
Hmmm…already a long post for a blog. I want to talk about the Keynote and Erik Natzke’spresentation, but perhaps I’ll leave the details for a post-convention meeting.
A few quick things though:
- Designers: check out Kuler, an Adobe website/social network for colour scheme enthusiasts. There’s a neat AIR app they have that allows you to take colour schemes you find on Kuler and tie/import them directly into Illustrator/Phsop. No eye dropper required.
- They demo’d the next version of the Flash IDE, and there’s lots of new designer focussed features. Designers/animators will be very happy that they’ll be able to do some pretty complex animation without having to know a lot/any scripting. The bones tool is awesome.
Oh…and we’re getting designer-friendly 3D! - I need to look up more on this, but Adobe’s got a neat pixel shader technology for flash coming out, code-named Hydra. (In english, that means a lot more visual filters to play with)
And Natzke was awesome, as usual. I love going to his presentations, they’re always so inspiring. One of the most important lessons I learned about this profession and life in general was at one of his presentations a couple years ago. Basically, everybody wants to build cool stuff, but not everybody can go and study physics books like Natzke did. You can, but you may find it difficult ‘cuz physics doesn’t really interest you. But you still want to make cool stuff. The important thing is to figure out how to channel own passions and use them as motivation to make cool stuff. It’s more honest that way, ‘cuz its yours and not Natzke’s, and its way more fun, because your passionate about it.
So…what are YOU passionate about?
