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

Weird DeWitter's Game Loop Problem

13 posts in this topic

So I've been searching and studying up on game loops and decided to go with deWitter's(the final version with interpolation). Yesterday I implemented the loop into a simple test game to see how it works, and it worked fine. My little circle would move across the screen very smoothly with no problems at all, so I saved everything and took a break.

Okay.. now here's the problem: I came back later to check it out again, but this time there was a slight stutter when the circle moved! I had no other winndows open, only CodeBlocks and the program, but when i first successfully tried it, I had Chrome open. so I tried it again with chrome open, and it didn't stutter! but when I try it with nothing open, there's that small stutter again. I looked at the code over and over, and it was exactly like the code from the (site), so I am positive it is not a problem with my code.

It's very confusing because it Really does work fine,the small stutter is very subtle, but it is there. I am using SFML 2, so maybe there is a problem with the clock function? What do you guys think? Is this even a programming problem or just my pc?

0

Share this post


Link to post
Share on other sites

Have you tried building your program in release mode, and executing without having other things open?

I've never used SFML, but if it doesn't work properly based on the programs you have open, then i don't see how that might be a programming issue.

0

Share this post


Link to post
Share on other sites

Yes, there is a problem with clock() and it should never be used.

 

On Windows®, always use QueryPerformanceCounter() and QueryPerformanceFrequency().  The resolution of clock() is low and its problems with games/high-performance timing can be found via Google.

 

 

This is most likely your main problem, but I have listed many other potential problems here: Fixed-Time-Step Implementation

You will want to give it the once-over and be sure you are not making some of the common mistakes people often make when first implementing fixed time-steps.

 

 

L. Spiro

0

Share this post


Link to post
Share on other sites

I know right? it should go slower with other stuff open not the other way around. I've been looking up on better time keeping methods instead of sf::clock, I avoided the QueryPerformanceCounter, since it only works on windows. but I guess cross platform isnt really necessary for me, so I'll look into it.

Edited by handoman
0

Share this post


Link to post
Share on other sites

yea! I was just looking at that. But i guess my compiler doesnt support 11 yet? hmmm...I thought it was up to date. 

Edited by handoman
0

Share this post


Link to post
Share on other sites

yea! I was just looking at that. But i guess my compiler doesnt support 11 yet? hmmm...I thought it was up to date. 

 

What compiler? GCC/MinGW supports (most of) C++11 if you pass -std=c++11 to the compiler (earlier versions use -std=c++0x).

0

Share this post


Link to post
Share on other sites

yea, I got c++11 to work. I guess code::blocks just doesnt recognize some of the classes( it doesnt highlight them or anything), but they still work

0

Share this post


Link to post
Share on other sites

cool so I got the chrono classes to work and convert my game loop to use the high resolution clock insted of sf clock, and it works but it still looks smoother while Chrome is open!! haha it seems so odd to me.

Edited by handoman
0

Share this post


Link to post
Share on other sites

I decided to created a log and output the time since each update into a file... if the game loop was working right, the time time between each frame should be the same right? well there were slightly different:(here is just some of the times)

 

 

0.0167939
0.0197271
0.0204671
0.0206342
0.0188694
0.0201671
0.0196725
0.0219421
0.0180132
0.020587
0.0197747
 
are these times close enough, or should the game loop really be calling the update equally every time??
0

Share this post


Link to post
Share on other sites

The actual time between frames?

They will generally be close as long as nothing is moving around on your screen, and as long as you are not writing times to a file every frame.

Print to the debug console—it is still laggy but less so than writing to a file.

OutputDebugString().

 

Also, waiting for v-sync can cause different delays between frames.

 

 

L. Spiro

Edited by L. Spiro
0

Share this post


Link to post
Share on other sites

ah okay, I'm not gunna bother with the code anymore, the game loop and timing are pretty precise ..gunna go try it on other computers to be sure its not just mine... or I'll just have to play with Chrome open all the time! thanks for the help guys, Ill probly be back when it doesnt work

Edited by handoman
0

Share this post


Link to post
Share on other sites
okay, I actually now concluded that its not the code...its my comp: 
 
I ran the exe(not with code::blocks) on my pc, and the situation is the same. but then I take it to my dad's laptop and it runs normal and smooth no matter what else is open! gunna start comparing all of our setting and stuff.
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