I was thinking earlier -- given that the bone behavior is probably the most CPU intensive of any of the behaviors -- that it would be great if you could deactivate/activate the bone behavior of an object at runtime. This could help in increasing performance by allowing you to deactivate the bone behavior when the object is off-screen, thereby freeing up more CPU time for other things.
I know that most CPUs from the last 4 or so years should be able to handle quite a few of these before slowing things down noticeably, but I want my games to be playable on as many computers as possible.
Any chance we could get this?
The bone behavior doesn't do anything CPU intensive at all, as far as I know. It just does a bunch of interpolation functions which are really really cheap for a CPU to do. Have you got some framerate figures that demonstrate slowdowns are caused by the bone behavior and not by other things like effects on the sprites the bone is controlling?
As I said in another thread, the key to optimisation is to measure! What are the framerates? How much is bone slowing things down?
On my 2.8GHz Athlon 64, 20 eight-limbed figures brings the framerate down to 400 from 2200 with one. I know that's not exactly a problem by itself, but once you throw in the rest of the game code, including other CPU intensive things like AI, the framerate could eventually fall below the refresh rate.
Then you have to consider different CPUs. There are still plenty of people with 2GHz P4s, which are approximately half as powerful as what I have(I'm talking about real world performance, not clockspeed).
Maybe I'm just being paranoid about this, but I still think it could effect older computers tremendously. Besides, a deactivate feature should probably be added just for consistency with the rest of the behaviors.
File I used to test speed - .99.4
I'm not sure it's the bone behavior, because if I remove it, the framerate hardly changes
By removing the bone behavior I doubled the framerate, despite all the sprites being there, so I'm pretty sure it's the behavior.
I can't reproduce that... stays about the same as I said - anyone else got results?
Develop games in your browser. Powerful, performant & highly capable.
I tested it on my laptop which is really underpowered. 220 with bone behavior, 360 without.
1.7 GHz, integrated graphics card, 896 MB RAM
I Tried the cap file too..
With the behavior: ~770 fps
Without the behavior: ~2500 fps
Only clicked remove behavior, nothing else was changed.
Edit: This was on 0.99.4
With behavior - 600
Without behavior - 1640
With Behavior - 400
Without Behavior - 600
With behavior : 615 ~ 635
Without behavior : 2000+
Hmm... davo, I think you need to look in to what the bone movement is actually doing and why it reduces performance so much... no need to fold proteins in between slightly changing angles and positions!