View Single Post
Old Oct 26, 2012, 02:04 AM   #16
SaltyFish
75 Posts
 
SaltyFish's Avatar
 
Join Date: Jun 2012
Posts: 175 (0.50/day)
Thanks: 18
Thanked 59 Times in 37 Posts

System Specs

Somebody else working on a turn-based hexagonal grid RPG? Oh snap!

At its heart, it's really just the game portion. It could be contained entirely as a text based game like many earlier PC games. The graphics is just a user interface and embellishment. What you're trying to think of as "Managing user input (the player clicked on this button, etc.) and telling the game what action the player is trying to do" is mostly a "GetCursorPosition()" call and comparing the results with other visual elements (both the menus and the game world).
  • Game engine reads first entry in turn queue. It finds out it is John the PC and tells the graphics to center the camera on him.
  • Graphics engine centers camera on John the PC.
  • The game checks what actions are valid for John the PC, if any.
  • The game tells the graphics to generate an action menu pertaining to John the PC and gray out any invalid options. This menu can be worked by keyboard, but I'm going to assume you want mouse cursor interactivity.
  • Player mouses over the "Move" button and clicks it. Here you will need to check the mouse cursor position and compare it with the location of the menu buttons. For easy checking of this, you might want to give your buttons a glow when they're moused over.
  • If the action is invalid (already grayed out, but the player clicked it anyway). The game either ignores it or returns a message stating why that action is invalid.
  • If the action is valid, it proceeds. In this case it's a move command. Game engine runs a call to check for all valid movement locations and tells graphics to highlight them.
  • Player clicks on a location. Again, check mouse cursor position and what, if any, hex is selected.
  • Check validity of destination hex. Since all legal moves have been highlighted, it's an easy check. If invalid, either ignore or return a message saying it is out of movement range.
  • If destination is valid, proceed. Tell graphics to process the object "John the PC" with a walk animation and give it the list of hexes to traverse to make a path to the destination.

You'll notice I've done checks earlier to make the menu more informative and less redundant checking. Also, from what you've described, it seems a bit like Elven Legacy and/or Fantasy Wars (due to the whole sight thing) combined with an character queue-based SRPG (Sacred Blaze, Wind Fantasy 6, Phantom Brave, Final Fantasy Tactics, etc.).

The other thing is to tell the game to wait while the graphics are doing their thing. For example, waiting until the walking is completed before bringing up the action menu again. You could have a fancy cursor following the mouse pointer. But then again, if you can get that working, the rest of this should a breeze.

EDIT:temp02 got it. You're trying to combine the game logic with the graphics display. Do the game logic first. The graphics is just for user (player) convenience. It should reflect that by simply embellishing game actions.

Last edited by SaltyFish; Oct 26, 2012 at 02:11 AM.
SaltyFish is offline  
Reply With Quote