Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Misc > Re: Need sugges...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 13 Topic 958 of 1010
Post > Topic >>

Re: Need suggestions for game architecture!

by Miss Elaine Eos <Misc@[EMAIL PROTECTED] > Nov 4, 2007 at 06:38 PM

In article <Xns99DF2FBA6647Fantontxtgmailcom@[EMAIL PROTECTED]
>,
 Anton <anton.txt@[EMAIL PROTECTED]
> wrote:

> Miss Elaine Eos
> 
> > Try to eliminate polling in favor of interrupts.  If you need to
> > create an animation effect, have a timer do interrupts for that.  Do
> > not poll for user input, make the appropriate events trigger
> > interrupts.  Architect everything such that it responds appropriately
> > to the interrupts it receives.  Do what you can to eliminate all
> > variations of this loop:
> > 
> >    10  Is there anything to do?
> >    20  No?  go to 10

> Hmmm. But what's the problem with this loop? What about the following
loop:
> 
> repeat
>     	if there_is_smth_to_do then
>     	    	do it       //perform a tick of the in-game time if needed.
>     	wait_for_event   //doesn't wait if there're already events in queue
>     	handle_event(s)  //if there're any.
> until (quit)

While, technically, at a very low level, wait_for_event contains such a 
loop, it is an exception to what I said, as most modern OSs do this with 
a form of thread-blocking such that it uses minimal CPU.

Yes, your loop is fine.  wait_for_event() is a case of an interrupt, in 
what I was saying, above.

> But it seems that each of your objects draws itself directly to the
> screen... So, you don't redraw the whole screen every time?

Btw, in MVC architecture (which I think is a good foundation), you 
wouldn't have the model draw itself, that would be the job of the view.  
This allows for there to be different views of the same model, something 
about which you may not care now, but which makes for a well organized 
system, regardless.

> > As miss elaine eos pointed out, don't worry to much about optimizing
> > yet (todays computers are pretty fast) you might want to spend
> > optimization on the graphics.

> It is graphics that's the key of my optimization dilemma: using a
> complex and probably painstaking algorithm to accurately redraw only
> things that need redrawing or refre****ng the whole screen every time. 

Are you intentionally avoiding architectures that will do this for you 
which were written and evolved over decades by people who are very-very 
good at it?  If it were me, I'd use one of those (for example: Open-GL) 
and call it a day.

-- 
Please take off your pants or I won't read your e-mail.
I will not, no matter how "good" the deal, patronise any business which
sends
unsolicited commercial e-mail or that advertises in discussion newsgroups.
 




 13 Posts in Topic:
Need suggestions for game architecture!
Anton <anton.txt@[EMAI  2007-11-04 18:30:49 
Re: Need suggestions for game architecture!
Miss Elaine Eos <Misc@  2007-11-04 12:05:02 
Re: Need suggestions for game architecture!
Anton <anton.txt@[EMAI  2007-11-05 01:41:31 
Re: Need suggestions for game architecture!
Miss Elaine Eos <Misc@  2007-11-04 18:38:43 
Re: Need suggestions for game architecture!
Anton <anton.txt@[EMAI  2007-11-05 12:25:34 
Re: Need suggestions for game architecture!
"Ron AF Greve"   2007-11-05 12:19:55 
Re: Need suggestions for game architecture!
Anton <anton.txt@[EMAI  2007-11-05 12:25:37 
Re: Need suggestions for game architecture!
"Ron AF Greve"   2007-11-05 13:57:57 
Re: Need suggestions for game architecture!
Anton <anton.txt@[EMAI  2007-11-05 16:20:25 
Re: Need suggestions for game architecture!
"Ron AF Greve"   2007-11-05 00:06:50 
Re: Need suggestions for game architecture!
"Ron AF Greve"   2007-11-10 17:35:34 
Re: Need suggestions for game architecture!
Anton <anton.txt@[EMAI  2007-11-11 19:28:23 
Re: Need suggestions for game architecture!
"Ron AF Greve"   2007-11-12 00:29:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 18 19:46:48 CDT 2008.