Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: SoundGuy on September 23, 2008, 04:06:56 PM
-
Hey
I have this perfomance issue.
I want to call a method function in an entity object several times, and i see a bad performance behaviour. I tried profiling it :
this is in the actor:
Game.LOG("Before BaloonEnt " + Game.CurrentTime);
MyBaloonEnt.StopTalking();
Game.LOG("After MyBaloonEnt " + Game.CurrentTime);
and this is the code in MyBaloonEnt's script:
method StopTalking()
{
Game.LOG("BalloonEnt StopTalking entry" + Game.CurrentTime);
this.StopTalkingReq = true;
//this.SetTalkSprite("actors\NullAct\null.sprite");
this.StopTalking();
Game.LOG("BalloonEnt StopTalking Leave" + Game.CurrentTime);
}
now this is the output:
18:04:19: Before BaloonEn8878
18:04:19: BalloonEnt StopTalking entry8878
18:04:19: BalloonEnt StopTalking Leave8878
18:04:19: After MyBaloonEnt 8935
For some reason - there's about 60ms going to waste everytime there's a transition between two scripts.
Ordinarily that wouldn't be a problem - but in my case there is because i'm doing this thing in a loop.
Why is this happening ? Any suggestions ?
I would rather keep my functions implemented there in object and not have .inc files just to have inline functions :(
-
Firstly, if you want accurate values, use Game.WindowsTime, which is immediate time, not Game.CurrentTime, which is updated once per frame.
Secondly, there is some time when the method ends, because each script is updated once per frame, so when the method "thread" ends, the remaining scripts are updated, then the game paints the frame, then the scripts are updated again, and only then the original script continues. 60ms sounds a bit too much though, that would mean the game runs at 16FPS.
-
I'll try it again with WindowsTime, but - yeah. the game does run at a low FPS. it's 20-30 and not 16, but i'm trying to figure out why too.
see my other post about polycount. It says i have 20,000 polys, and i can't figure out why.
Shouldn't WME be able to run 20,000 polys on an above average PC easily ?
-
depends on the size of polygons. 2 1/2D games are really stupid in terms of performance. Let's say you have background 1024x768 which is one polygon. If it's rgba (32bit truecolor)
with every single frame you transfer 1024x768x4 bytes = 3.14MB just for a background. You can easily guess that the throughput with every single overlay grows really fast (not mentioning inclusion of 3d toons). In full 3d game where you push all those polys, those polygons are never that large. That's why you can push so many more of them.
This is the case where size really matters. ;) With shadows - if you're not using simplified shadow model, you have to double the polygon count because for shadow, the toon is rendered again for shadow calculation. I'd suggest making the lowpoly shadow model. See documentation for further explanation...
-
are both stencil and flat rendering hoggers ?
i get much worse performance on the stencil...
-
stencil's are even more difficult (they're really performance killers unless you know how to optimize your scene - eg. simple geometry for stencils, special shadow model etc.)
-
Thanks meta !
I'll try your suggestions and stick to flat shadows.
Hope to see you soon on IRC, need to install it again on my pc that crashed, because it bothers you guys when i use my laptop and it keeps disconnecting when i go around and use cheap coffee shop wireless. :)
-
oh - and any suggestions on improving perforamnce with the 2d elements ?