User:atrix256 Message: Optimization - saves about 2-3 ms when town was fully built (: [Technical info below - figured you would be interested Kent!] This is something i learned not that long about but basically there's 2 main ways you can handle state changes (ie going from living to dead for example) 1) You can have a tick function where every frame you look at the HP of something, and if it's < 0 you make it die. OR 2) You can make a function that you call whenever you do damage to it, and only have it check if the object is dead then. The first method is called POLLING and means that every frame you poll (ask) if the object should be dead. That wastes cpu because most of the time, the object isn't dead but you are asking every frame. The second method is alot more efficient because it only asks when HP changes. Anyhow, I noticed mob ticks were taking about 4ms per frame when the town was completely built, due to all the houses checking if they were dead or not. So what i did was instead of making mobs change the life property on a building model, i made them send the building model a message of "Hut_Do_Damage" with a value of 2 (how much damage it did). Then, in the mob, i made the damage and death check happen in response to the message only (not in the tick). Also, since that was the only thing the tick function was doing, i removed it from Hut1x1 and Hut2x2 so they didn't have a tick function. Then i made the game make it so if a mob doesn't have a tick function, not to even bother caling tick every frame, which further optimized the code not having to interface with lua each frame for each building. So yeah, in the end all this stuff saved about 2-3 miliseconds going on my machine from an average of 24ms when the town was fully built down to an average of 21ms when the town was fully built. On my machine that took me from 41fps avg up to 47fps. <Files Changed> U ActRaiser/ARRelease.exe U ActRaiser/Scripts/Enemies/OverWorld/Troll.lua U ActRaiser/Scripts/GameOverworld/Hut1x1.lua U ActRaiser/Scripts/GameOverworld/Hut2x2.lua U Code/ARRelease.exe U Code/AR_Mobile.cpp U Code/AR_Mobile.h ============================== Project 1 Dev mailing list to unsubscribe, please send an email request to demofox@xxxxxxxxxxx Project 1 website: http://project1.demofox.org Project 1 SVN repository: http://pyotek.com/project1