Tuesday, May 26, 2015

Chaos update notes

A few weeks ago I released a new version of Chaos that had what looked to be some pretty bad bugs. In fact the bug was just that the controls were enabled when the CPU is moving or casting, but you could really mess things up by tapping the screen during their turns.

This bug came about because I'd switched over to the latest emscripten build for the Javascript version.

As you may recall, I had to make some changes to the code structure of Chaos to avoid busy-loops deep in the guts of the game. Emscripten previously required you to have just one "main loop". Since then, Emscripten has gone completely insane - in a good way. The latest emscripten releases have a way to compile C code down to an emscripten-specific byte-code, that is then run on an interpreter, which itself runs in the Javascript interpreter in the browser!

What this marvellous change means is that the one-main-loop restriction is lifted. You get better performance if you write code to use the preferred way, but the interpreter-byte-code solution lets you keep the old semantics going if you don't mind taking the performance hit. Hurray! So I reverted Chaos back to how it was in release 1.18 more or less. That means no more co-routines to get around the loop restriction, and the code is easier to read and understand.

As a side effect, I added the previously-mentioned game destroying bug by enabling controls in the "wait" code that was called everywhere. The fix was easy - just remove the control polling/updates in the wait. But it broke the game for a lot of people :( To try and prevent this from happening again, I've created a beta group on Google+ and I'll push updates here before making them live to everyone.

I currently have 1 bug on my list - fix the glitched screen that happens after you minimize the game and return to the homescreen, then go back to the game. I'm doing something wrong in the Android lifecycle and the GL screen is not reset correctly.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.