Real Time Menu for Game

Started by
16 comments, last by Dan Violet Sagmiller 11 years, 1 month ago

Actually, I do know how to make a menu. This question is for a real time rendering menu...

As mentioned, all GUIs (including menus) are either real-time or event-based. For event-based menus, you use a GUI toolkit like Win32, Qt, or another.
For real-time menus (like what 99.9% of games require), you make them yourself and treat them similar to any other game object in your game.

I suspect you are accidentally drawing your menus outside your rendering loop, so they don't get redrawn.

This is probably a communication issue because of different lingo we are using. Why don't you post an example of your working, non-realtime, code, and we'll tell you where to go from there? We might not all speak using the same terminology, but we all speak computer code.

What language are you using? Our answer will change depending on your chosen language. What APIs/third-party-libraries are you using to draw graphics on-screen? Our answer will also change depending on that.

Finally, what is a small working example of your existing non-realtime menu? We don't need an entire project, just the main loop and the functions involving the menu. We want to help you, but sometimes it's a bit difficult for us to understand someone's problem without seeing at least part of their code.
Advertisement

Well,

I understand.

Let me explain it further.

I want to make a menu intro where waves wash up onto a beach while cam is faced down on the sand and wash back down leaving behind the options.

Then when an option is clicked, it washes the current menu away and comes back with the new option. I hope this explains the question i'm asking..

Oh, and Sorry! Didn't really understand the concept of Real Time.

There is definitely no pre-built library for that and is something that has to be custom-made.

Is the beach scene a 2D image or a 3D scene? If 3D, you have to already know 3D programming. If 2D, you have to already know 2D programming.

Here's one possible way using gamestates:

Game starts up, or player returns to main menu:

PushGameState(GameState_Menu_Front) //Push the proper page of the menu onto the GameState stack.

PushGameState(GameState_OceanSlideInAndOut) //Push the ocean animation onto the stack over the menu.

When the OceanSlideInOut animation finishes, then it pops itself from the stack, leaving GameState_Menu_Front the topmost state.

GameState_Menu_Front has the menu buttons of the front page of the main menu, including buttons like "Options" and "New Game".

When "Options" is seleted, GameState_Menu_Front pushes "GameState_Menu_Options" and then pushes "GameState_OceanSlideInAndOut" again.

When the GameState_OceanSlideInAndOut is finished, it pops itself leaving GameState_Menu_Options at the top.

GameState_Menu_Options has buttons like, "Video settings", "Sound settings", "Player controls", and so on.

When "Sound settings" is pressed, GameState_Menu_Options pushes "GameState_Menu_SoundSettings" and "GameState_OceanSlideInAndOut" ...

GameState_Menu_SoundSettings also has a button called "Back", or "Return to previous", or whatever. When clicked, instead of pushing the previous GameState (which is already on the stack underneath GameState_Menu_SoundSettings), then it just pops itself, leaving the previous GameState at the top of the stack, and pushes GameState_OceanSlideInAndOut again.

Each gamestate might have Update(deltaTime), Draw(), HandleInput(), or similar functions to handle their own functionality.

That's one way you could handle the logic. Which part of the menu are you specifically having trouble with? The logic? The drawing? The buttons functioning?

There is definitely no pre-built library for that and is something that has to be custom-made.

Is the beach scene a 2D image or a 3D scene? If 3D, you have to already know 3D programming. If 2D, you have to already know 2D programming.

Here's one possible way using gamestates:

Game starts up, or player returns to main menu:

PushGameState(GameState_Menu_Front) //Push the proper page of the menu onto the GameState stack.

PushGameState(GameState_OceanSlideInAndOut) //Push the ocean animation onto the stack over the menu.

When the OceanSlideInOut animation finishes, then it pops itself from the stack, leaving GameState_Menu_Front the topmost state.

GameState_Menu_Front has the menu buttons of the front page of the main menu, including buttons like "Options" and "New Game".

When "Options" is seleted, GameState_Menu_Front pushes "GameState_Menu_Options" and then pushes "GameState_OceanSlideInAndOut" again.

When the GameState_OceanSlideInAndOut is finished, it pops itself leaving GameState_Menu_Options at the top.

GameState_Menu_Options has buttons like, "Video settings", "Sound settings", "Player controls", and so on.

When "Sound settings" is pressed, GameState_Menu_Options pushes "GameState_Menu_SoundSettings" and "GameState_OceanSlideInAndOut" ...

GameState_Menu_SoundSettings also has a button called "Back", or "Return to previous", or whatever. When clicked, instead of pushing the previous GameState (which is already on the stack underneath GameState_Menu_SoundSettings), then it just pops itself, leaving the previous GameState at the top of the stack, and pushes GameState_OceanSlideInAndOut again.

Each gamestate might have Update(deltaTime), Draw(), HandleInput(), or similar functions to handle their own functionality.

That's one way you could handle the logic. Which part of the menu are you specifically having trouble with? The logic? The drawing? The buttons functioning?

It's not the programming. It's HOW do i design the ocean? I know the programming for it, but the animations for it? I'm not necessary sure about that.. I don't know what program would best suit me.

That can be done in a number of ways, and almost seems like an art question.

You can use algorithms to manipulate pixels, like this (the concept applies to many languages and APIs, not just C++ with SDL).

You could use basic frames of an animation where you go from Frame 1 to Frame 2 to Frame 3, and so on.

It might even look fine just to have a static image move down the screen and then back up, depending on the style you are looking for.

Or you can use another method like playing a video (which can get more complicated, especially when you want your menus to appear underneath the waves).

That's assuming 2D. For 3D ocean waves, then you could google "OpenGL ocean wave simulation" (or DirextX if you're using that) where there are plenty of resources and discussions on many different methods.

When you say 'design', are you talking about how it should visually look, or how it should programmatically move?

You might have better luck creating a new thread about the art in the Visual Arts subforum, if you're asking how you can draw ocean waves or if you're asking about what art programs to use - those gentlemen would know better than I.

Otherwise, I just can't comprehend what you're asking. Maybe I'm just thick. smile.png

Is this a programming question?

To me this seems like an art question rather than a programming question. The easiest way to do such a thing would be through animations and have your menu system play the animations when appropriate.

Two possibilities are Adobe Flash to make vector based graphics (which isn't a free program but there are programs like Victorian Giotto which can also create flash animations), or Blender.

Personally I would probably choose to use Blender for this task. It is cross platform, open source, and free!

Blender has an Ocean modifier.

">

">

Granted it will not be trivial to create this in any program.

it seems you need 2 things.

1), you need to learn how to get water/waves in your game at all. @Servant of the Lord and @Shadowisadog have both provided some excellent starting points for that.

2), is simply how to separate your Update/Draw functions at the root of your game. (presuming you understand the idea of loading, and then repeating the Update then draw methods for the duration of the game.)

- What I will typically do, is setup a variable somewhere, called "bool InMenu = false;"

- Each section of my game will be split up for processing, so I might have background.update(), units.update(), shots.update(), foreground.update(), etc... and then .draw() for each as well.

Then, in my Update method, I would have "if(InMenu)"

background.update(); foreground.update(); menu.update();

else

background.update(); units.update(); shots.update();foreground.update();

Then, in my Draw method, I would have "if(InMenu)"

background.update(); units.update(); shots.update();foreground.update(); menu.draw();

else

background.draw(); units.draw(); shots.draw();foreground.draw();

When we are in the menu, I only process the things needed to keep the graphics updated, like the current wave position. but I'm also calling the menu update method.

The draw still draws everything, juyst including the menu.

It sounds like what you need is that you would just re-point the camera at a spot with the waves. However, you may want to consider letting it show what ever was happening at the point of pausing/starting the menu. Because if you always want waves at the pause menu, your going to have to either reload a wave scene, which opens up lag points, or you would have to manage repointing the camera.

However, it sounds like all you want this for would be a starting menu. and in that case, you just need the wave scene initially, which is fine.

Moltar - "Do you even know how to use that?"

Space Ghost - “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer."

Dan - "Best Description of AI ever."

You could also be playing a full screen animation or video behind the menu.

Moltar - "Do you even know how to use that?"

Space Ghost - “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer."

Dan - "Best Description of AI ever."

This topic is closed to new replies.

Advertisement