Slick Forums

Discuss the Slick 2D Library
It is currently Fri Nov 17, 2017 7:16 pm

All times are UTC




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: [IDEA] pause states
PostPosted: Thu Jun 28, 2012 1:07 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Simply because you want to use the post and pre methods. Like davedes said. Mabye so if you pause the game only a String is drawn. This is good if you want to pause the game, and stop rendering to leave CPU/GPU alone so you can switch to other apps while the game does nothing to drain the CPU/GPU.

_________________
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  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Thu Jun 28, 2012 1:33 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Just keep the following in mind:

You don't want to force the user to keep running the update/render loop. But you want to force every user to put up with this pausing implementation in the game class, no matter if its needed or not.

Also I still don't get why its needed to stop the calls to the GameStates when the game is paused. If the GameState is aware of the paused flag you just stop the updating/rendering there. You still can use your pre*/post* functions in the StateBasedGame without any difference.

Nitram

_________________
http://illarion.org


Top
 Profile  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Thu Jun 28, 2012 3:24 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
What? I don't force anybody with the code to use it. It's just a few new methods oO Nobody must use them. That it the genrel course of a framework. We offer the user functionality.

Read the post from davedes on carefully again. Forwarding the pause to the state, will ONLY (again, ONLY) this current state. As soon as you switch states (which can be done even if the state is paused), the new current state is not paused anymore. That is a feature the user can use of course. But it should work trough the StateBasedGame. If I tell the StateBasedGame to stop calling update on the current state and so, on all current states even on switching it should do exaclty that. You can still call pause on the GameState by using getState().pause(). How is this not flexible???

It's a addional feature, those you want to use it, use it. Anybody else does not use...

_________________
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  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Thu Jun 28, 2012 4:38 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Its a additional feature that lingers around in any application using the StateBasedGame. No way to avoid the overhead created by the implementation.

Still I fail to see the difference to blocking the updates/rendering in the GameStates and not in the StateBasedGame. But maybe I just overlook something.

Nitram

_________________
http://illarion.org


Top
 Profile  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Sat Jun 30, 2012 6:56 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Okay, 2 bools... We shouldn't talk like this... If we talk about useless "additional Festures", I can name plenty I (I, ME) think are useless :) For a Game Framework Slick2D lags a lot of usefull "game" stuff if you ask me. Everytime I look at the RPG Maker I think that the developer of this engine where smart as hell.

I will just implement it, since it will ad usefull stuff for does you care about a more complex handling. btw this idea came from some students I teached Slick2D.

I really don't think people will be picking our eyes out over 2 new boolean they can use. I named a lot of uses and davedes named a lot of possible Feature you can do with this change :p

_________________
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  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Wed Jul 04, 2012 6:07 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Added this feature just now, a test is also available.

_________________
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  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Thu Jul 05, 2012 1:35 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Quote:
What? I don't force anybody with the code to use it. It's just a few new methods oO Nobody must use them.

I disagree -- adding methods to an interface like GameState places burden on the user to implement them. Standard practice tells us that we should implement all of an interface's methods, otherwise throw an unsupported operation exception. Adding duplication (GameContainer pause vs. StateBasedGame pause) leads to a more confusing and cluttered API, and increases the chances of bugs/problems later on.

Quote:
I don't force anybody with the code to use it. It's just a few new methods oO Nobody must use them. That it the genrel course of a framework. We offer the user functionality.

This is not a good way to go about software development. Slick has specific aims as a graphics library; many of us (kev included) feel that UI, tiled maps, etc. are too "game specific" and should one day be pulled out of Slick and turned into extensions. By adding more game-specific features, you are making Slick less focused and more cluttered. Just because Slick currently includes a lot of "unnecessary" stuff doesn't mean we should continue to pack it with useless/game-specific content. Slick's broad scope and "adding every feature that gets requested" attitude is one of its downfalls, and ultimately one of the reasons it fails from a design perspective. (Most importantly; I have not seen users ever request a pause feature aside from the one provided by GameContainer.)

Why is Pausable in the util package? Why do you have pauseRender and unpauseRender, as well as setRenderPaused? Why does Game and BasicGame not implement pausing, since they are supposed to be more or less equivalent to the game states API? What about handling all input listeners, rather than just the default input listeners? What about the functionality of GameContainer's pause -- why do we need to duplicate that?

And most importantly -- like I asked earlier -- what is the benefit for the user? How often do users need to pause the update loop of a particular game state, and let other game states continue updating? And how hard would it be for them to do it themselves, with an if-els statement? Something so game-specific would be better implemented by the user rather than the library -- for the same reason that Slick hasn't implemented entities, collisions, platformer physics, etc.

Not trying to discourage you from making changes to Slick... Everybody should contribute, and I'm glad you're helping! :) But sometimes contributions are more suitable in the form of a 3rd party extension, rather than modifying Slick's core classes and adding clutter/bugs/inconsistencies/etc.

Maybe a different way to go about this, if you really feel individual state and render/update pausing is necessary, is to scrap the interface idea and add setUpdating(boolean) and setRendering(boolean) to BasicGameState. The reason BasicGameState exists is to provide simplicity for the user, so if something game-specific were to go anywhere, it would be there. This naming would also remove conflict with AppGameContainer's pausing.


Top
 Profile  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Thu Jul 05, 2012 9:02 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
The main problem is, StateBasedGame is pretty much closed to the dev. update and render are both final which makes it impossible to make your own thing work with pausing (if you want it). The only thing you can do is to copy all the Code of StateBasedGame and implement your own code (assuming you don't want to change the source). Also transitions rely on StateBasedGame, so you kinda HAVE to use it if you want work with it.

Pausing in Game and BasicGame made no sense so I left it open. Pausing should be a StateBasedGame feature (I don't know hoe Pauseable slipped into the util package...)

You can revert it if you want :) I thought it would be useful and give you more control over the StateBasedGame.

_________________
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  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Mon Jul 23, 2012 5:21 am 
Offline
Game Developer
User avatar

Joined: Wed Feb 17, 2010 12:24 am
Posts: 598
In my games I just do:

Code:
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
      if (gc.isPaused()) {
         return; // or whatever, do debug here.
      }
// update stuff
}


It's quite flexible and can easily change it. Not sure how adding new methods would help...


Top
 Profile  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Mon Jul 23, 2012 8:01 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
And how do you stop a specific state with this code?

And as said, just revert it ;) I still find it very useful but I actually don't want to argue about it.

_________________
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  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Fri Jul 27, 2012 3:09 pm 
Offline

Joined: Sat Jun 23, 2012 4:14 pm
Posts: 74
Location: Germany
R.D. wrote:
And how do you stop a specific state with this code?

And as said, just revert it ;) I still find it very useful but I actually don't want to argue about it.


Although I'm currently using your pauseUpdate, I'm wondering what the uses for a pauseRender and to pause a specific state in general are? Maybie you can explain this to justify these methods.


Top
 Profile  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Fri Jul 27, 2012 4:47 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
I already tried that in my previous post, just read them :) (I personally use stop rendering or a pause option where no rendering happens so the application dos not drain the GPU/CPU)

_________________
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  
 
 Post subject: Re: [IDEA] pause states
PostPosted: Sun Jul 29, 2012 12:40 pm 
Offline

Joined: Sat Jun 23, 2012 4:14 pm
Posts: 74
Location: Germany
R.D. wrote:
I personally use stop rendering or a pause option where no rendering happens so the application dos not drain the GPU/CPU


Ah okay, then I think this is a valid reason to have this.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2

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