Path: chuka.playstation.co.uk!news From: "Rikki Prince" Newsgroups: scee.yaroze.freetalk.english Subject: Main Game Loop Technique Date: Sun, 14 Jul 2002 10:04:22 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 35 Message-ID: NNTP-Posting-Host: pc-62-31-230-115-ba.blueyonder.co.uk X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.3018.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300 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