POV-Ray : Newsgroups : povray.off-topic : My toy : Re: My toy Server Time
6 Sep 2024 15:17:51 EDT (-0400)
  Re: My toy  
From: Mike Raiford
Date: 3 Mar 2009 11:33:41
Message: <49ad5be5$1@news.povray.org>
Invisible wrote:
> scott wrote:
>>> The hard part is figuring out how to draw the graphics on screen
>>
>> Choose a language / IDE / API that gives you easy access to graphics?
> 
> Does one exist?
> 

C# Maahahaahh ... hahaah.. hah.. <cough> heh.


> 
> Typically you have to register callbacks with the GUI system, and then 
> call a "main loop" function which calls your callbacks when it feels 
> like it. Which is great if you just want something to happen when the 
> user presses a button, but becomes problematic if you want things to 
> happen while the user isn't pressing anything. (E.g., if you wanted to 
> do something compute-bound, now the GUI stops responding until the 
> compute task finishes.)
> 

Huh? Do it on a background thread! For a game that has constant activity 
  (a game loop, many games, but tic-tac-toe doesn't have this 
requirement!) You'd generally have within your message loop a call to a 
function called "DoGameLogicForThisFrame" or some such. It gets a time 
delta from the last frame so you can adapt your logic to the frame work. 
You work your computations in steps, so you don't block the frame for 
too long, which usually works well for most things like character 
movement, etc. Just make sure you calculate the frame quickly so you 
don't kill frame rate. At some point you perform your message pumping if 
any messages are in that thread's message queue.

Keyboard or mouse input can still be handled by event functions, you 
just store the values somewhere convenient for the game loop to get to 
them. I managed to have the keyboard basically act as a game controller 
by handling KeyDown/KeyUp events and mapping to a list of keys.. I could 
then check that list and see if that key were down and up.

>> BTW why don't you just do a text based version?
> 
> Because that wouldn't be very exciting?
> 
> What I'd really like to have a go at is Mahjong... but that would be 
> absurdly hard.

Dude! Mahjong is easy EASY! That was one of the easiest games I ever 
worked on! The ONLY hard part is if you want to give hints or have the 


-- 
~Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.