• 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
Balk

[C++ DX9] Slow Down after losing window focus

3 posts in this topic

I have a DX9 application that creates two windows and renders to each of them. These windows are not full-screen mode, they are windowed mode set to the system's resolution size to emulate full-screen. Everything works fine until the user either alt-tabs or minimizes the window, which the framerate is noticeably slower when they return.

[b]-BEFORE LOSING FOCUS-[/b]
Update FPS: ~63000
Render FPS: 60 (throttled to match vSync)

[b]-AFTER LOSING FOCUS AND RETURNING-[/b]
Update FPS: ~25000
Render FPS: 30

I find it odd that the render frames are cut in half perfectly[size="4"][b]*[/b][/size], however the update frames are cut significantly as well so it's clear I'm not getting the same CPU time slice from the OS prior to losing focus. This application is running on an XP Embedded OS system that is pretty bare bones. When I test this same scenario on my dev machine, which is Windows 7 64bit, I don't have this issue.

[size="4"][b]*[/b][/size]Now that I think about it... my rendering is on the same thread as the updates are. I just skip the rendering portion if we're not in vSync. I'm starting to think now that since my updates are cut down, I'm missing every other vSync occurrence. It still doesn't explain why my updates are slow when returning focus though, if anyone has any input on that please let me know.

Thanks!
0

Share this post


Link to post
Share on other sites
CrescentFresh,


This is just a quick idea (forgive me if you already have tested this, just some input! :P), but I'd recommend checking your WM_ACTIVATEAPP in the MessageProc, ensuring nothing funky is being altered when the app is reactivated/gains focus. Specifically when you are resetting the device. I assume you are using pDevice->TestCooperativeLevel() and awaiting for a D3DERR_DEVICENOTRESET to reset the device. Ensure that you are setting the D3DPRESENT_PARAMETERS variable that are you using in the pDevice->Reset() function properly. Specifically the FullScreen_RefreshRateInHz variable.

Those are the only two options that come to mind. Good luck!
0

Share this post


Link to post
Share on other sites
That's a good idea to check WM_ACTIVATEAPP for any weird anomalies, and I am handling a lost device properly. However the device doesn't actually get lost when I minimize or alt-tab... probably because I'm in windowed mode. So it must either be something else, or something on the OS level (hope not). I'm not sure what else to check for.

[b]Within the task manager, I can right click a process and increase the priority. Can this value be set by the application itself?[/b] [b]Does anyone think this might help?[/b]

[i](As a side note, the only time I've been able to lose the device when in windowed mode is to press alt+ctrl+del.)[/i]
0

Share this post


Link to post
Share on other sites
This is odd, but it fixes the issue...

When I return from losing focus and my frame rate is dropped, If I force a lost device and reset it... it fixes the performance issue. I didn't think it was possible to be in some sort of limbo state of a lost device, but apparently something in D3D is slowing down when returning focus, and TestCooperativeLeve() was still returning successfully.
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