Music: Tangerine Dream - Midnight in Tula

Today(er, yesterday now that it's past 4 am - I'm a student so I can get away with strange hours) I got a lot done with the entity system and Lua bindings.

First I added some more variables and bindings to set the image and x/y coordinates. The system I've come up is like this: Each entity contains a "image" pointer, and an "imagestyle" which helps resolve the type of image being used(this could include image groups - so along with multiple colliders, one entity can be used to represent many instances!). Further, there is an "imagex" and "imagey" which can be used to direct the placement of the image, independently of the entity's colliders if necessary. With all of these features, the Lua code can control the look of an entity with great precision, without requiring Lua to pass a new set of coordinates every frame - though that's what happens in the case of most sprites. But if I need to really optimize common entities like bullets it can be done without much trouble now. I can comfortably loop 1000 entities this way.

The strangest bug I had was my last one: to draw the entity images I was calling a procedure "drawloop" in my engine. It looped over the global TFPList "allentities" and called a procedure in each one, which resolves the type of image being used and does the actual drawing. Thinking myself clever, when I wrote this function I made it an inline. For some reason(which I'm not entirely clear on), this totally bugged up the loop and made it only draw the LAST entity. To make matters worse I tested with only one entity at first, and then only later found this bug. Once I figured it out, I just moved the loop back into the main procedure since it wasn't all that big anyway.

Right before I finished this post I tried seeing the total performance with scale2x on and found it causing a display bug and a core dump on exit. Hmm.... (tries some things) works fine if I make the scale2x surface 4 times instead of 2 times the resolution. Crazy o.o time for bed.