• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
fir

game pause - ho should be done?

24 posts in this topic

im asking here about desktop apps like windows games..(both fullscreen and windowed)

 

would like to do some solid good game pause

 

1) how it should behave for the player ? should game be paused automatic on alt+tab or maybe even on mouse going out of window and automaticaly restarted again on second alt_tab ? or are there some reasons to leave it unpaused in

such cases?

 

It seem to me that it better pause/restart this heavily though im not quite sure

 

2) how to implement that? the story is that i can just not call the game loop

when in pause state, then last frame would be lasting in the window, but

anyway i need to generate some contents view on OnPaint request that would

be sent anyway - to do so I think i would need to separate functions calculating game frame - one is like CalcFrame() and the second more like CalcFrameButNoAdvance(), first for normal game frame and the second only to refresh the wiew but with no advance movement in the game...

 

do people really do this? this two versions of CalcFrame? or they use some differrent approach to game pausing than this "freeze frame" im talking about?

 

3) can i do yet something to improve game pausing? i dont know maybe to help

system swapping unused ram to disk or the opposite do not allow him to do that thus preventing slowdowns, or what?

 

 

 

 

 

 

 

 

0

Share this post


Link to post
Share on other sites

 

And in regards to #3, no.  Pausing is not the place to do that.

When the window is minimized or not the active window, sleep for 16 milliseconds between frames to reduce CPU load.  That is all.

 

 

why you asking why im asking? As always im asking to get some opinions and clarify the view.. 

Do you mean that when game is in 1) background 2) minimalized it should nt be paused? Im not sure but it seem to me that most games not pause there..

0

Share this post


Link to post
Share on other sites

 


do people really do this? this two versions of CalcFrame? or they use some differrent approach to game pausing than this "freeze frame" im talking about?

 

Generally something like this yes. You want to have a very clear distinction between parts of your game that should still run when paused, and those that should not. You obviously don't want your game logic to update when things are paused, but you want UI/pause menu logic to be running. You probably want your full rendering path to be running (so hopefully you don't update any game logic in there).

 

I got it mixed, didnt expected that i could neet to run "draw path  " without "advance path" - not hard to change though it need a bit of caution to trace both modes in both loops and events, i dislike game states :c

0

Share this post


Link to post
Share on other sites
My remarks:
- I would focus on having good and clear game states, like for example the menu state (where gameplay is paused). When you have this in place you can take any event to set this state, for example when alt+tabbinb, pressing escape, minimizing
- if all your game logics, movements etc. is based on time delta, you can easily pause everything by setting delta to zero in the case/ state you want to pause
0

Share this post


Link to post
Share on other sites


why you asking why im asking?

 

I'm guessing that Spiro's asking because your question seriously lacks context.  You haven't provided any details on what you're working on, the problem(s) you encountered, and what languages/frameworks/engines you're working with.  So when you ask something like:

 


2) how to implement that?

 

People aren't really going to be able to help you.  I would suggest reading http://www.sloperama.com/advice/entry65.htm

 

After that, post some details on what I mentioned above and I'm sure people would be glad to help you.

0

Share this post


Link to post
Share on other sites
I got it mixed, didnt expected that i could neet to run "draw path  " without "advance path"

A game loop should ever be separated into at least the sections (in order)

    1.) input processing,

    2.) world state update,

    3.) rendering.

 

In such a loop input processing provides abstracted desires the player has with respect to game world changes (e.g. the player's avatar should jump), that then together with the simulation time elapsed since the last pass is used to drive the world state update (the time delta actually drives AI, animation, physics). This gives a new snapshot of the world, and rendering then generates all still necessary resources and projects them onto the screen.

 

From this you can see that pausing a game need to influence (a) input processing because you don't want to string all input happening during pausing for the sake of avatar control, and (b) world state update. Rendering is a reflection of the current world state, and if it is run more often than once per world state update then it will show the same snapshot again. 

 

As was already mentioned above, stopping the world state update can be done by enforcing 0 as time delta. If wanted, toying with things like avatars breathing also / although during game pausing is possible due to the the 2nd timer mentioned by LS. However, input processing need to be handled explicitly. This is because further input need not be suppressed but routed to other handlers. Here explicit game state switching may come to rescue. 

 

Notice that the way how input is pre-processed is important. Input should be gathered, filtered, and all relevant input should be written in a unified manner into a queue from which the game loop's input handlers will read. The unified input should be tagged with a timestamp coming from the 1st timer, even if this may give you input "in the future" from the game loop's point of view. If the game gets paused and re-started, then a "discontinuity" will be introduced in the sequence of timestamps in the queue. This discontinuity helps in suppressing false detection of combos started before the pause and continued after the pause.

Edited by haegarr
1

Share this post


Link to post
Share on other sites

well, sometimes i would like to debate things not just got first answer ' - like there in those drawlina arg name topic - some people seem do not understand this. as to this topic in general i can do this pause by exposing this RunFrameButtNotAdvance  and partialy switching off the input - switching this 'input path' presents to me a bit obscure (as i was used to mix draw advance and input quite together) but it was worth mentioning

 

pausing is interesting as it is quite separate whole game state not just 1 line of code

0

Share this post


Link to post
Share on other sites

Answering is free.. I do not force anyone to answer - this is big forum and if even 20 people would not want to answer some other my find to talk..

So feel free to not answer, if you dont like my questions or statements (or mistypes, im doin to much of it but i had some problem with that even in my native language and here in english it is 3 times worse)  feel free to ignore me at all than i can talk with some rest who not shares this view

 

ps. dont exaggerate the value of some answers, im not a 100% newbie, im about moderately experienced, (about 6 hard years of hard c coding in my back) and sometimes i find a situation when some forum user gives me an answers worse than my knowledge - when im searching for some more advanced talk (then im a bit bored or angry - but what should i do in such case? answer that ;\

Edited by fir
0

Share this post


Link to post
Share on other sites
 

 

Reasons to leave it run in the background? Everything multiplayer-related comes to mind, from MMORPG to RTS.

 

 

i rarely see the pause maybe this is becouse im playing heavy

games and when I alt + tam them i dont even se what this games 

do - are they pausing or not? can i assume they pausing? ;/ this alt_tabbing is always some probloem  usually it works ok - but not so rare cases it crashes the game (even if this is AAA title) and if not crashes it can take a bit slow

 

what is the reason of this? windows swpaping mechanizm (this is probably activated on alt_tab?

Edited by fir
0

Share this post


Link to post
Share on other sites

The reason is when you alt-tab, you lose exclusive access to the graphics hardware and the device needs to be reset before you can get it back. So all dynamic resources have to be released, the device reset, and the resources re-acquired.

 

This is not an issue when your game is running in Windowed mode as it didn't have exclusive access in the first place.

Edited by Aardvajk
2

Share this post


Link to post
Share on other sites

The reason is when you alt-tab, you lose exclusive access to the graphics hardware and the device needs to be reset before you can get it back. So all dynamic resources have to be released, the device reset, and the resources re-acquired.

 

This is not an issue when your game is running in Windowed mode as it didn't have exclusive access in the first place.

 

both opengl and dx are doing it weak such way?

 

must the gpu ram all be freed and reloaded or something like that?

0

Share this post


Link to post
Share on other sites

This is why I said in my first post that you maintain 2 timers.
The second one is for visual effects.

But if you pause Conker’s Bad Fur Day yes you see some nice visuals.
That is basically a state on top of the gameplay state (if you implement states as a stack).
You have many options in regards to what you display during pausing, states or no states, but the mechanic for pausing along with a rendering timer are unchanged.


L. Spiro

 

I've never verbalized it this way, or even visualized it as such.  This is actually somewhat amusing, as a "stack of states" is pretty much a push-down automata, and this is literally the only use for it I've ever found other than as a visual representation of context-free grammars.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0