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.

Comments

Popular posts from this blog

Empyrion Vrs Space Engineers: A Different Kind Of Space Race

In my quest for more compelling virtual worlds, I have been watching Empyrion: Galactic Survival a lot this bizarro weekend, mostly via the Angry Joe Show twitch stream.  What I have concluded from my observations is Empyrion is following in Space Engineers' shadow, but it is nevertheless threatening the elder game due to a greater feature set (the modding scene notwithstanding).

Empyrion is made in Unity, whereas Space Engineers is built on a custom engine.  While this does put Empyrion at a disadvantage when it comes to conceptual flexibility, its developers nevertheless have a substantial advantage when it comes to adding features due to a savings of time spent that would have gone into developing their own engine.  Examples include:
Planets.  Empyrion already has planets and space to explore between them, whereas in Space Engineers planets are in the works but still awhile away (so you just have asteroid fields to scavenge).Enemies.  Space Engineers' survival mode boasts onl…

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…

Sometimes, The Cat Skins You

The formula for cat girls is simple enough: young girls are cute, cats are cute, so young girls who are also cats are cute times two, right?  ... Cat Planet Cuties (a.k.a Asobi ni Iku yo) does not stop there, it includes girls with guns, nudifying weaponry, and even failed romantic comedy that shows lots of skin.  Cat's out of the bag: Cat Planet Cuties is basically straight up wish fulfillment.

The overall plot is pretty simple.  The Catians are a race so advanced that they have not changed in over 70,000 years.  They discover Earth, a planet whose people have uncanny resemblances, right down to speaking the same language!  Desiring an escape from their cultural stagnation, they rename their own planet from Earth to Catia and dispatch a scout to assess the viability of first contact with this new Earth inhabited by humans.  High jinks ensue.

Other than an excuse to see some fun sci-fi devices, the plot sucks. Let me count the ways:
Kio Kakazu - The male center of our harem, a 1…