Celest FunFinds.Us Blog

All about our first flash game

Archive for the ‘Flash Development’ Category

Reddit, Celest and the Downvote Conundrum

Thursday, March 27th, 2008

Celest being our first flash game and reddit being our favorite social-web2.0 style site, I thought we would submit the game and a few posts to reddit and maybe get some feedback. I was hoping to get some to get answers questions like: Is the game fun? Is it too difficult? too boring? Should I continue working on this game to make it better or will that result in a repeat of the same resounding sigh from the webs?

The first problem I had was that there a zillion sub-reddits now. In the early days of reddit these separate communities sort-of made sense, but now I can never figure out which one has the people that actually care about content like this. I posted the main game to both reddit.com and gaming.reddit.com. Both of those stories never really gained any traction. In an effort to help other flash developers I plan on writing blog posts that talk about some of the problems and their solutions that we had while creating this game. I posted the first of these articles to programming.reddit.com where it was immediately downvoted into the vast sea of near 0 point articles.

One of the problems this poses, is that a downvote gives me no ability to discern why something proved unpopular. Was it the mochiad up front? Do people hate my attempts at web design? Is the game terrible? Am I an awful writer? A couple of awesome people over in the comments section actually took the time to make a comment about it and most of the comments seemed at least a little favorable (there was no vitriol which can be a success on the internet).

When I have put in work to entertain others and this fails, it would be awesome, and certainly help me improve, if those others who deem my work insufficient would tell me why. Perhaps that is asking too much, but you don’t have to vote on everything. If you are ambivalent about it why downvote, maybe someone else actually will like it. But an ambivalent downvote means no one else will see the submission. Perhaps there is a better way to share what I am doing and get reasonable feedback about it.

The Problems with Space and Gravity

Friday, March 14th, 2008

The problem with space is that it is too damn big. Bill Bryson covers this far more eloquently than I ever could, in his book A Short History Of Nearly Everything. In it he uses the analogy of trying to draw a solar system on a piece of paper and the scaling required for correctness. It turns out trying to show the earth and the sun on the same piece of paper, to scale, is a fruitless task due to the fact that the distance between the Earth and the Sun is almost 12,000 times the diameter of the Earth. Wikipedia (please donate!) also has an interesting article on solar system models.

In our first flash game, Celest, we want to simulate orbiting in the gravity fields of various large planets including planets that are orbiting each other. To fit properly scaled planets and a ship on the same screen would require a planet larger than the viewable area and a ship smaller than a pixel. This is a problem since that would not work inside the realm of this game.

The current size scaling is not even informed by reality. A space ship with a size roughly half that of the planet but only weighing a tenth of a kilo compared to a planets 10^7 kilos is a very strange relationship for these objects to have in real life, but in Celest with only a 800×480 display it is almost necessary for the game to be playable.

Even once scaling is resolved, by tweaking the size, masses, and gravity to make Celest playable, another problem with gravity scaling arises. Planets are so massive that while they create the correct gravity at reasonable (for gameplay) ranges for our little spaceship, if the planets are allowed to orbit each other, the gravity is so great that it always results in a rapid cataclysmic collision of the planets for any reasonable distances and speeds. Because our scales are so out of proportion with reality (planets are so much vastly closer in our game than in reality) our gravity cannot be universal. To solve this, in our simulation we cheat and use a different gravity calculation for planet to planet interaction so that the planets can orbit each other at reasonable speeds and be on the same low resolution game screen. To make it easy to program we actually do not take into account the planet’s masses multiplied by a gravitational constant. Instead we simply say that planets have a universal attraction with each other regardless of masses. This allows us to ensure that the dynamics in planet-planet interaction are very predictable.

I am not entirely happy with this because it would be neat to be able to adjust the dynamic between the planets based on their masses, but this would require a significantly smaller gravitation constant than the one used to calculate ship’s gravity with the planet. Perhaps in the future all types of objects will define a separate gravitational constant for each type of object in the game. This should allow us to tweak planetary interaction with their masses, while still avoiding planetary collisions.

Flash Community Fragmentation

Wednesday, March 12th, 2008

My first impression of flash was that it was one monolithic technology that was mostly for designers, but had a programmatic interface for those sufficiently masochistic as to use it. After using it more, I decided that its programmatic interface was the good one and the IDE was for masochists. Over time I became aware of perhaps 5 distinct sub-communities inside of the Flash ecosystem. Each of these communities has its own set of tutorials and blog posts based on what community the author was apart of and writing to, and each seems to largely ignore the existence of the others.

From what I have been able to gather there are the following communities

  • Flash the Original – There seems to be a lot of legacy information about this now defunct standard available as well as a lot of backwards compatibility hacks for it in the current incarnations of the language. There is still quite a bit of information swirling in the intarwebs about this technology.
  • Flash 8 IDE – This seems to be the first of the modern, designer ready flash environments and there is still a ton of tutorials and blog posts available for this.
  • Flash 8 ActionScript 2 – The programming interface to flash 8 is Actionscript 2. This also saw the first open source flash movement to gain traction (that I am aware of) with the MTASC compiler.
  • Flash 9 / Flex Builder IDE – the most modern designer based environment.
  • Flash 9 / Flex 2 & 3 / ActionScript 3 / MXML – This seems to be the most current branch of flash programmatic development and the ideal place to begin for noobs just getting started in flash development (esp. open source development).
  • and then there is AIR

The first time I installed a flash, I installed the Flash 8 GUI/IDE, so that I could help one of our designers complete a project that was coming up on a deadline. The next time I worked on flash it was to begin development of a game (this eventually led to Celest). I installed all of the eclipse MTASC and ActionScript tools and just got to the point of being able to create a flash swf file when we quit on this again for some time. The next time we picked it up, we moved forward to Flex2, by mostly following ryepup’s tutorial for setting up a computer for flash development. We used this setup for most of the development of Celest. Finally when it was time to publish the product and I actually needed the distinction between dev and live versions of the game, I wanted the compiler to set that variable for me. This led me to upgrade to ActionScript3 / Flex 3 so that I could take advantage of the compiler “-define” switch (which allows me at compile time to set the value of a variable). Unfortunately, flex2ant does not provide the define directive, so I had to download the source, add that function call, recompile and finally tell eclipse where my new flex2ant binary was.

The long and short of the situation is that googling for info on flash development can lead to some real confusion if you are not aware of the splits in community. By starting with the most recent release (instead of upgrading three times), and by being aware of great resources (such as the language docs and the opensource flash community) you can vastly simplify your first experience writing a flash game.