So I'm currently doing a Software Design and Development course in my last year of school and have been tasked with a Major project. Basically, we can make any sort of program we want (within reason).
Being the iPhone fan boy and original guy I am, I settled on remaking Space Invaders as an iPhone app.
The project is currently in Phase 1, meaning a shit load of planning. Things like IPO charts, flow charts, dataflow diagrams, pseudocode, the works. Now I'm a pretty shit/unskilled coder myself, so I thought I'd see if you guys could help me with my pseudocode.
So far this is what I've done.
[code]
[MainProgram]
BEGIN InvadersFromSpace
INT enemySpeedvar = 10 //Global settings
INT scoreMultiplier = 1
CALL MainMenu
END InvadersFromSpace
[DisplayMenu] //Displays main menu elements ie; buttons, logo
BEGIN DisplayMenu
DISPLAY BackgroundColour = black
DISPLAY InvadersFromSpace.text
DISPLAY Logo.image
DISPLAY PlayGame.button
DISPLAY Options.button
END DisplayMenu
[Options] //Displays options menu elements ie; buttons
BEGIN Options
RELEASE (InvadersFromSpace.text, Logo.image, PlayGame.button, Options.button) // 'RELEASE' is my why of saying these elemnts are released from memory/cleared from the screen etc
DISPLAY ChooseDifficulty.text
DISPLAY Easy.button
DISPLAY Medium.button
DISPLAY Hard.button
DISPLAY Return.button
END Options
[MainMenu]
BEGIN MainMenu
CALL DisplayMenu
IF touchPressed = PlayGame.button //'touchPressed' signifies if the element, in this case PlayGame.button is in the area that has been pressed on the touch screen.
CALL PlayGame
ELSE
IF touchPressed = Options.button
CALL Options
IF touchPressed = Easy.button
BEGIN SetOptions
SET GLOBALVAR enemySpeed = 10 //these actions just sets the enemySpeed and scoreMuliplier variabes that were declared at the beginning of the program
SET GLOBALVAR scoreMultipler = 1
END SetOptions
ELSE
IF touchPressed = Medium.button
BEGIN SetOptions
SET GLOBALVAR enemySpeed = 25
SET GLOBALVAR scoreMultipler = 2
END SetOptions
ELSE
IF touchPressed = Hard.button
BEGIN SetOptions
SET GLOBALVAR enemySpeed = 40
SET GLOBALVAR scoreMultipler = 4
END SetOptions
ELSE
IF touchPressed = Return.button
RELEASE (ChooseDifficulty.text, Easy.button, Medium.button, Hard.button, Return.button)
CALL DisplayMenu
END IF
END IF
END MainMenu
[/code]
This is obviously pretty basic stuff, I'm just trying to get the logic of it down pat.
Seriously, rip this to shreds, I need all the help I can get. I'll be updating this post with more as I write it.
Thanks
I'd worry less about the main menu and worry more about the flow of the game itself. I personally haven't touched the OpenGL ES bindings for the iPhone / Objective-C, but look into that a bit, see how a video game's main loop works. You'll want to structure the game in a way that makes it easy to modify (at least to some degree) and not overly complex so as to lower framerate.
Yeah I've been working on the flow of the game now, just trying to get my head around it currently.
well generally a game's main loop would look something like this (at a very high level)
[code]while the game is running:
clear the screen
check for user input (if you decide to poll for input)
do all the logic
render all the sprites
swap buffers[/code]
if you aren't polling for input, the input is pushed to the game by an event, in which case you'd do all input stuff in that method.
How does this look for the logic behind loading all the game elements to the screen?
[code]
[GameElements]
BEGIN GameElements
DISPLAY playerShip.object //playerShip exists in an array containing information for image location
INT i = 0 //this is the variable for the number of enemy instances
FOR i<30 //this creates 30 instances of the enemyShip object from an array containing image location and speed of enemy movement
CREATE enemyShip(i).object
DISPLAY enemyShip(i).object
i++
END FOR LOOP
DISPLAY Score.text
DISPLAY scorevar.text
DISPLAY Lives.text
DISPLAY livesvar.text
END
[/code]
It's loaded when PlayGame (now GameScreen) is called. It sort of works in my head, but I truly have no idea how I will translate this into code
you should be initializing separately from drawing, creating 30 sprites every frame then displaying them will likely take longer than 16ms (60fps).
This should help you get started: [url]http://en.wikibooks.org/wiki/Video_Game_Design/Structure[/url]
Ah, rightio. Awesome, thanks for the help.
[QUOTE=robmaister12;28398502]well generally a game's main loop would look something like this (at a very high level)
[code]while the game is running:
clear the screen
check for user input (if you decide to poll for input)
do all the logic
render all the sprites
swap buffers[/code]
if you aren't polling for input, the input is pushed to the game by an event, in which case you'd do all input stuff in that method.[/QUOTE]
Swap buffers?
Swap back and front buffer.
[editline]3rd March 2011[/editline]
:ninja:
All of us have been sucked down the whole 'work chronologically first', as in start the splash screen, then menu, then options, then game.
But that's not how you do it. You work on the game first, even using shitty graphics then work outwards.
[QUOTE=Jookia;28400226]All of us have been sucked down the whole 'work chronologically first', as in start the splash screen, then menu, then options, then game.
But that's not how you do it. You work on the game first, even using shitty graphics then work outwards.[/QUOTE]
this. Do the harder stuff first, that way if you're running out of time (deadline), you have the game almost done and can quickly slap together some fluff for the main menu, grab an artist to put together some art, etc. Releasing an incomplete game is worse than releasing a game that doesn't have a ton of polish but works well.
Sorry, you need to Log In to post a reply to this thread.