design - Basic Game Archecture Question -
I am creating a simple 2d game, and I am thinking that if a better codemer I can recommend a better method I'll design its original structure.
The game is very simple on the screen there are many types of units that shoot, shoot, and perform hit detection. The screen zooms in and out, and there is a menu UI bar on the side of the screen.
Architecture I now look like this:
Load "stage" Load a UI and replace the UI pass reference one camera, load a camera, feed it as a "phase" parameter as shown on the screen to the camera to see the main loop {ifIsActive} {stage .update () ui.update () camera.updateAndRedraw ()} else {if (! Ui.pauseGame ()) {gameIsActive = true} if (ui.pauseGame ()) {gameIsActive = false} Phase Update () { Go through the list of objects on the platform, explore the collision and check the "Action" object on the platform, all the objects of an object Category that are in terms of the stage, and use the context object to the object (ie gun bullets). } UI Update () {Update Bar, etc} Anyway, it's all very basic if it's a better way to do this, then just curious.
Thanks, Matthew
There are several ways to build main loops because in the sky There are stars! You are perfectly legitimate and probably will work fine. Here are some things you can try:
-
Where do you read the controls? If you are doing this in your "ui.update" and then answering your "stage.update", then you are adding a frame of interval
-
Do you have a 3D Using APIs? Make sure that you "Control the controls -> Apply controls -> Update GameWorld -> Render" in that order in your loop.
When you render (using OpenGL-ish pseudocode) a lot of books are asked to do something like this:glClear () // buffer glBlahBlahDraw > > > Waiting for orders from the bar > > > > >> If you do this, the GPU can work on the drawing on the same screen. The CPU is updating the platform for the next frame. -
Some games continue to present the engine frame and accept some UI (for example, camera control), even if the game is "paused." This allows you to fly around a paused game worldwide and when you are trying to debug, what is happening in the office. (Sometimes it is called "debug pause" in opposition to "real breaks.")
-
In addition to this, many game engines "single-phase" (one frame Pause immediately). It is very easy if you are trying to catch a bug that occurs on a particular event.
Hope is helpful in some - this is just a random idea. I was looking at your code.
Comments
Post a Comment