Path: chuka.playstation.co.uk!news From: "Ben James" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Main Game Loop Technique Date: Sun, 14 Jul 2002 18:51:32 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 44 Message-ID: References: NNTP-Posting-Host: du-035-0023.claranet.co.uk X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 It's not really worth worrying about to be honest. The checks are only done once per frame and will take up a tiny fraction of 1% of the CPU time. I tend to use a case statement but the results the same. i.e: "Rikki Prince" wrote in message news:agrf9f$d9k24@www.netyaroze-europe.com... > Before I would do the following: > main loop { > Prepare screen drawing stuff > if(TITLE_SCREEN) { > GsSort Title Screen stuff > } > elseif(GAME_SCREEN) { > GsSort Game stuff > } > etc > > if(ONE_PLAYER) { > Proccess for 1 player > } > elseif(TWO_PLAYER) { > Process for 2 player > } > etc > > } end of loop > > However, I'm wondering whether it's better to get rid of these checks > every loop by checking what screen it is first, then going into a > special loop for that screen, and doing similar for the number of > players. Do those checks cause much of a performance hit - is it worth > worrying about? Or is it better to keep the amount of code down (due > to the 2MB limit), rather than duplicating it? I suppose I could use > pointers to functions, so the main loop would be the same code, but > somewhere else changes which function is pointed to, which does the > specific proccessing. Could this be a good method? > > Cheers, > Rikki > >