Slick Forums

Discuss the Slick 2D Library
It is currently Sun Nov 19, 2017 3:09 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Mon Apr 16, 2012 8:07 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
I wonder why we should hide this method from the dev?

Usally do record delta we need our own value and set in the update method but why do we want that if there is already a saved value in the Container?

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Mon Apr 16, 2012 8:58 am 
Vote to public it


Top
  
 
PostPosted: Mon Apr 16, 2012 2:34 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
You get this value during the call of the update function, don't you? Why expose it more then once?

Nitram

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Mon Apr 16, 2012 4:21 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
For the render method? debugging and so on :) I mean an Engine should provide some tools to profile the game or not o.o

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Mon Apr 16, 2012 4:37 pm 
Offline
Regular
User avatar

Joined: Thu May 05, 2011 8:35 pm
Posts: 231
Location: Somewhere between the bits and bytes
That method shouldn't be called more than once per frame, because delta is recalculated everytime its called.
Using this during the loop, causes stuttering because the delta value passed to update will be imprecise.

Wouldn't a better way of handling this be to add a built in recording to the gamecontainer, that records the delta as its about to be passed to update in a, say lastDelta variable with a public getter?
but is this even needed? recording it is very easy and would quickly be done so by anyone who needs it anyway.

_________________
For every new problem, a new source of solutions has come to exist.


Top
 Profile  
 
PostPosted: Mon Apr 16, 2012 5:05 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
The delta value has to be constant over one full update/render cycle to ensure that the animations are synchronized correctly when rendering. So the delta value is more or less useless for profiling.
How ever a well designed game implementation with separated update and render is able to get the delta value from the update functions parameters. There are no times in between update calls where this delta value can be assumed valid.

And in case your game really needs the value in the render loop you can easily create a variable and store the value there. But I don't think we should "promote" this by introducing the build-in possibilities to do this.

Nitram

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Mon Apr 16, 2012 5:11 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
But's that exaclty what's wrong with Slick2D it hides a lot of stuff from the dev for no good reason but "easy usage". The thing is, no one will use methods they don't fully understand.

@Magn919
I think you missunderstood. I never said I want to make update punlic, I said I want getDelta be public, and this method only returns the last recorded delta ;)

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Mon Apr 16, 2012 5:23 pm 
Offline
Regular
User avatar

Joined: Thu May 05, 2011 8:35 pm
Posts: 231
Location: Somewhere between the bits and bytes
Actually you misunderstood me... i was talking about getDelta().

This is the getDelta() method, as found in GameContainer.
Code:
   protected int getDelta() {
      long time = getTime();
      int delta = (int) (time - lastFrame);
      lastFrame = time;
      
      return delta;
   }

As you can see it updates the field lastFrame that it uses to get the actual delta when its called, thus causing the problems i was talking about before.

_________________
For every new problem, a new source of solutions has come to exist.


Top
 Profile  
 
PostPosted: Mon Apr 16, 2012 5:42 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
...teh Fuck :o

Never watched in too the method since, the doc said all... Never trust key on his methods I see :D I those getDelta calculate something...?

Anyway, then I said nothing!

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group