Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: performance issue - method function calls for objects  (Read 3992 times)

0 Members and 1 Guest are viewing this topic.

SoundGuy

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
performance issue - method function calls for objects
« 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:
Code: [Select]
Game.LOG("Before BaloonEnt " + Game.CurrentTime);
MyBaloonEnt.StopTalking();
Game.LOG("After MyBaloonEnt " + Game.CurrentTime);

and this is the code in MyBaloonEnt's script:
Code: [Select]
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 :(

Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: performance issue - method function calls for objects
« Reply #1 on: September 23, 2008, 05:08:49 PM »

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.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

SoundGuy

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
Re: performance issue - method function calls for objects
« Reply #2 on: September 24, 2008, 07:19:54 AM »

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 ?
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: performance issue - method function calls for objects
« Reply #3 on: September 24, 2008, 09:01:28 AM »

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...
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

SoundGuy

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
Re: performance issue - method function calls for objects
« Reply #4 on: September 24, 2008, 09:06:48 AM »

are both stencil and flat rendering hoggers ?

i get much worse performance on the stencil...
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: performance issue - method function calls for objects
« Reply #5 on: September 24, 2008, 09:10:53 AM »

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.)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

SoundGuy

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
Re: performance issue - method function calls for objects
« Reply #6 on: September 24, 2008, 09:14:42 AM »

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. :)
Logged

SoundGuy

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
Re: performance issue - method function calls for objects
« Reply #7 on: September 24, 2008, 09:15:15 AM »

oh - and any suggestions on improving perforamnce with the 2d elements ?

Logged
 

Page created in 0.038 seconds with 19 queries.