Programming 2D Games

The official forum for "Programming 2D Games" the book by: Charles Kelly

It is currently Sat Feb 16, 2019 10:29 am

All times are UTC

Post new topic Reply to topic  [ 11 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Thu Aug 20, 2015 4:21 am 

Joined: Sun Aug 02, 2015 2:52 pm
Posts: 15
No worries. And perhaps it would be well to point to my intro post

The posts I've written here so far have tried to expand upon ideas in the text that a "curious" programmer might think about. I've presented code to demonstrate a point that I feel the text doesn't have space to cover. My experience is that an important skill for a serious programmer to develop is that of writing small test programs that demonstrate and explore the behavior of algorithms and interfaces. Statements like,
Be sure to use PeekMessage, not GetMessage, in the message loop. ... This keeps our message loop running at maximum speed at all times, which is critical for games that have animated graphics.
might go unquestioned. To an experienced Windwos programmer it might cause some head scratching. So I write these test programs to explore the behavior even though I"ve written the Windows message loop hundreds of times. I think i understand it well but...I haven't written a game program using it. So I wonder if the claim holds up. I've seen the loop before but thought it was outdated. From the test programs, I can't detect a significant difference. And personally, I would prefer to keep the Windows UI components handy.

And the high speed timers have me worried.

The test programs use a simple animation built upon the "Hello world" test program. That program expanded the text "Hello world" that didn't actually write a string to the window. Each test answers a question that the explores the game loop: How often is the path executed? How many frames per second get dislayed? How does it affect an animated object? How about more than one object? The test use GDI becasue DirectX hasn't been introduced. You don't need to know GDI but you can see what the result is. Play with the frame rate, vary the screen hight and width and observe the behavior. You should get a feel for how the game loop behaves.

At least, that's the intent. For me, writing these test and exploring the code is what playing a game is for others. Game programming is all about doing the thngs that business programs never do. It's a different programming model and offers a rich environment for "tinkering."

- tim

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 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

Jump to:  
Powered by phpBB® Forum Software © phpBB Group