Skip to main content

Walking The Dog With The YoYo Compiler

So, I finally got a chance to play with the YoYo Compiler (YYC) now that it is officially bundled as a part of the GameMaker Studio engine.  If I understand it correctly, the primary goal of the compiler is to circumvent the need for just in time compiling by compiling things ahead of time, resulting in applications that are significantly faster because they are that much closer to running native to that platform.   However, having run some tests on my Windows 7 platform, the results are somewhat mystifying in their inconsistency.
A 16000x16000 size room of 32x32 tiles is 250,000 tiles to generate, quite the queued workload.  Yet, if you are looking to simulate
a world of significant size, this is not overly unreasonable: it is a mere 500 steps from end to end.
  • My benchmark showed no noticeable improvement whether or not I was using the compiler.  This benchmark simply generates projectiles and makes them bounce if they come in contact with the edge of the screen or each other (which increases the workload exponentially as more and more collisions need to be calculated).  Maybe the reason why the YYC did so little for this benchmark is because collision operations were already fully optimized by the running executable, and there is so little bytecode involved?
  • The YoYo RPG framework demo also showed virtually no improvement, but I suspect this is probably because the code is already so well optimized that it is sitting idle (merely animating a few things on the screen) most of the time.  That's good coding practice, whereas my benchmark deliberately stressing the engine is the opposite of what a good programmer really ought to be doing.
  • I used the "depth ordered starfield" demo that comes with GameMaker, and I could see a significant difference between using the YYC (70-71 fps) versus not (8-9 fps).  Looking at the code involved, it is merely three scripts on the create, step, and draw event of a single object.  Most of the work involves running through an array of starfield objects and updating them.  Why such a big improvement with the compiler?  Possibly because of all the variable manipulation work involved with that loop.  Maybe because so much occurs in a draw event, and the compiler puts emphasis on those?  I have no idea if that's true.
  • For my fourth data point, I used a roguelike engine I have been working on.  I modified the world generator object's code so that it builds the map bit by bit every time the step event triggers, assembling the world from a queue of building instructions.  

    Because step events run at a rate of room speed per second, if I did the same number of tile generation iterations every step it would understandably be just as fast with or without something that accelerated the code, and I was testing to see if the YYC would speed up procedural generation.   To resolve this, I based the number of tiles per steps generated fluctuate based on the current real frames per second measure of the room: the more frames available, the faster the generation. 

    The result?  There was no overall performance improvement in my map generation speed regardless of if I used the YYC, it would have half the room (125,000 tiles) generated in a little under a minute and a half.  I could make the room generate in about 30 seconds if I upped the room speed, but there was again no difference with or without the YYC.
  • I tried the "high polygon 3D demo" that comes with GameMaker and this time there was no overall performance improvement, I ended up with about 700 FPS regardless of if I was using the compiler or not.
Overall, I am underwhelmed.  I was hoping for a magical piece of software that would multiply performance of any GameMaker application, up to 100 times over, just as advertised.  It seems life has no such miracles, I managed about nine times the speed in one application, and virtually indeterminable performance gains in all the others.
Given that one of those applications did show gains, I am willing to shoulder some responsibility here.  Perhaps there is a very specific kind of operation that the YoYo compiler optimizes.  Perhaps there is a unique trick to harnessing the compiler that I do not particularly understand.  In the meanwhile, I suppose the compiler does have the advantage in that it makes it slightly harder to decompile GameMaker projects, since the bytecode is theoretically removed.

I guess if serious computational firepower is my goal, I really ought to get an engine that is capable of harnessing the power of multiple threads, something promised for the next major GameMaker platform release.  Honestly, I am a bit boggled as to why a modern personal computer such as mine is unable to bounce around more than 500-750 self-colliding projectiles (depending on how I code it) before hitting 50 FPS, I would have sworn I have seen ten-year-old bullet hell games pull that off just fine.
Post a Comment

Popular posts from this blog

Ancient Warfare - What Is It Good For?

The Ancient Warfare mod for Minecraft threw me for a loop.  I was looking for "villagers" that would perform useful tasks while simultaneously resolving the glut of food with a need to eat, thereby turning Minecraft into a bit of 4X game you can play from the inside.  Millenaire wasn't quite there, partly because recent updates to Forge had broken its compatibility with Minecraft 1.7.10, and Minecolony's development is not quite fast enough to keep up with the state of mods in general (they probably need to make a core API).
In comes Ancient Warfare, which does indeed provide workers and soldiers who need to eat, you can even order around a little army of them to defeat your enemies.  It has working waterwheels and windmills, something I thought was awesome in Resonant Induction.  It has a warehouse with a built-in sorting system, as well as courier NPCs that can move things from building to building, and crafting NPCs that can create things for you automatically - w…

Resonant Induction Really Grinds My Gears... In A Good Way

From about 2pm yesterday until 8pm today, I've been dabbling with my latest custom mod mix for Minecraft 1.6.4, which is this time very much Universal Electricity focused.
Aside from the usual GUI enhancers and Somnia, the primary contenders in this mix were:
Calclavia Core - Of course: this is the base of the Universal Electricity system.Resonant Induction - This seems to be largely focused on increasingly more advanced methods of refining ores divided across 4 ages of technological progression.  It also includes some really cool things such as assembly lines.  I'll primarily be talking about just a few blocks out of this mod today.Atomic Science - A mod dedicated to generating more of those lovely universal electricity volts via the power of splitting the atom.  Build your own nuclear reactor!  Deal with nuclear meltdowns!  You maniac!ICBM - A mod dedicated to generating more destruction using those lovely universal electricity volts (and more than a little gunpowder), it cer…

Not Getting Over It

One of the recent fads to go through YouTube recently is Getting Over It With Bennett Foddy, a game about a man sitting in a cauldron filled with his own sweat dragging himself up a mountain of societal detritus with nothing more than a huge staking hammer.
As can be expected from the creator of QWOP, the game is extremely hard to control, requiring great precision on behalf of the player's mouse skills in order to propel the man up the mountain.  It is known as a "rage game" because it is deliberately engineered to punish the player.

I think I figured out a significant chunk of the source of that rage.  Basically, by investing our time and energy into trying to figure out how to get the little man on the screen up the mountain, we come to care about it.  Even though there's nothing important waiting for us at the top of our trash mountain, even though it's a ridiculous little game about mountain climbing, we care about it because we are trying.

By wanting to win…