Jump to content

Help with menu dialogue and saving between states


Segger
 Share

Recommended Posts

Hey everyone! I am a little discouragingly stumped and hopefully my questions will be easily answered / aren't too dumb.  :(

 

My goal is to create an open world space game that allows you to:

  • fly around a solar system
  • walk around inside your ship
  • fight enemy ships
  • walk around space stations and other space objects

Here's what my game looks like so far (Since I'm actively developing this, it may not work :unsure: )

 

I thought that switching states would be the best method of scooting between areas like space and the ship interior when you wanted to walk around, since the control scheme, map and numerous other things would change, but since reloading states means that everything gets reset, it seems like it may not be the best way of going about it unless I could somehow make a global object that contains all the values I want to save. I tried doing this to save my ship sprite as well as the group of asteroids a while back but I met failure and was unsure how to proceed so I scrapped it and figured "maybe I just needed to load the maps all from the same state" but it would seem that doing that would end up putting a TON of stuff in one state and kinda defeats the purpose of having states so I'm not sure what to think. 

 

Since I wasn't sure how to go about switching between the ship interior and flying around teh cosmoz I decided to focus on fleshing out my flying gameplay and realized that I want to have a menu that appears when you press X so you can do things like request access to dock if a space station is nearby or switch your main weapon out or something. So basically I want to be able to create a menu dialogue box like something you might find in an RPG battle system.

 

This is probably way too long and drawn out and I'm going to blame it on it being almost 5:00 AM but 

TL;DR:

 

How can I save my group data, sprite positions etc between state switches and is this feasible for moving between two different "play modes"

 

What's the best way of going about creating a menu dialogue in-game whose options I can navigate between?

Link to comment
Share on other sites

I think you're on the right track, yeah. If you randomly generate the positions of all the asteroids, space stations, planets, etc in the "flying around" state then you'll need to save them when you come back to the "flying around" state from somewhere else.

 

Don't save the sprites, though, those will get destroyed on state transition. Save enough data to reconstruct your sprites, e.g. their positions, rotations, fuel, etc. The sprites are just a representation of the underlying simulation, if that makes sense. It's not the graphics that matter, it's the data underneath. The graphics just happen to be a very enjoyable way of representing that data instead of, say, a chart.

 

There's a library called EZGUI you should check out. You'll also have to figure out how to pause your game when the dialog is showing (I'm not sure how to do that, it's more dependent on how your game works).

Link to comment
Share on other sites

Cool, thanks! For some reason I thought that if I saved the sprite into a global var it would be preserved but I guess it's really only a reference to the sprite that gets deleted that I thought I was saving... If that makes sense.

 

I checked out EZGUI but sadly it looks like too much for what I need with all its skins and themes and such. All I really want is a retro-esque little window to pop up with simple text entries that I can cycle between. I guess I'll just have to make my own menu object that changes the control scheme when activated.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...