Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


events in a game

This topic is 5723 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ive decided to finaly get around to making a video game that ive been meaning to make for years (ive had the idea for a looooong time, but never knew how to program till the last couple of years). before i write any code (other than some basic core game engine stuff) im trying to plan out how i will do EVERYTHING. i really dont want to get into this and find that im doing something in an incredibly retarded way. which leads me to my question. what is the BEST way to handle the usual events that will occur in a game? im sure that seems a lil vaque so let me clarify. the game i intend on making is gonna be a rather long and extensive rpg. for now ive decided to go with something sprite based (with the actual sprites drawn by a friend of mine who has artistic ability... which i lack). basicly i need to find the perfect (or at least close to perfect) way of handling ALL the typical rpg events. thinks like moving (easy), talking, battles, simple puzzles, automated events (when the player has no control over the character for a moment), menus, ect. see the problem i guess comes in updating the screen each frame. as of now the only way i have seen that works involves doing an infinate loop (well until a quit message is posted) that updates all sprites and textures and such on the screen. now. thats all fine and dandy. but, what about the transition between the world map and a town/dungeon? or the transition between the previously mentioned areas and a battle? i guess THAT is what is confusing me =/ transitioning between two scenarios, and then drawing all that is necessary for the scenerio. another thing that ive been wondering about is menus (well theres a lot more that similar too that im wondering about). ive got an idea for all of this. but im not sure if its like absolutely DUMB (keep in mind ive read no books on this and i have no formal experience with ANY of this). ive got a game engine class with vectors of all the sprites. each vector contains sprites that are to be drawn for any of about 15 or so modes (default, movie, world, town, battle, menu, world and menu, town and menu, battle and menu, others). the game engine class has a variable that keeps track of the current update mode (which basicly tells it WHICH sprites to draw on any given frame). then inside the winmain inside the loop thingy it calls the update function for the engine. inside the update function the sprite vectors to be updated are determined and the appropriate sprites are drawn bah, gotta run... im at school.... if anyone has any comments on this id welcome any and all of them... ill post more info when i get home tonight Bungo!

Share this post

Link to post
Share on other sites
Original post by BungoMan85
but, what about the transition between the world map and a town/dungeon? or the transition between the previously mentioned areas and a battle?

Basically what you''re looking for is a state machine. Ideally you have a stack of states, and each time through the loop you call the Update and Render functions of the top-most state. You might start with a splash-screen state, then replace that with the main menu state. When you run the game, you push the main game state onto the stack. You could access the options menu from the game, so push that onto the stack too. When you close the menu, you pop that state off and you''re back to the game. When you go to a battle or a different game mode, you push the appropriate state onto the stack and pop it off when you''re done.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!