Sign in to follow this  
Telastyn

RFC: A design for concurrent orders in a TBS.

Recommended Posts

Telastyn    3777
Hey folks, just sharing some design and offering opportunity for questions, comments, suggestions, criticisms... Backround The game (codename and hereafter MOE) is a turn based strategy game akin to Master of Magic, Civilization, Imperialism and their kin. MOE has no set towns. Units exist in tiles, and can work in projects which are not necessarily tied to a town or factory. They may also move, fight, die, and what normal things you might expect. Units have Action Points (AP). AP is gained each turn, and the amount is variable based on the health of the unit, its food intake, its race, and perhaps other factors. Making an action (such as working on a project, moving along the map, or slaying enemies) takes AP. AP may drop below 0, but may not rise above a max AP which is variable amongst units. No orders may be given by units with AP <= 0. Units are the only game objects which can do commands. Problem The problem comes with the multiplayer requirements of the design. Turn based strategy games are a bit slow. Really slow when you have to wait for every other guy to issue their orders before you can actually play. It would be better if players could issue their orders concurrently, and they then all would be resolved at end of turn. The problem is how to do that. Solution Enqueue-ing commands is fairly straight forward. Player issues command, command goes in player's queue. Player hits ready/end-turn, player's queue goes to server. Taking the various players' queues and deciding what order to process the commands is a little less straightforward. Here is the design that I'm aiming for: Once all players are ready, and their queues of commands are received, turn processing begins. - Take all units and save their AP at the beginning of the turn into the command structure. - Run through the command queues, pulling the first order for every unit. - Take those commands and calculate a double: ( (2 * current AP - AP cost of command) / 2) / AP at beginning of turn - Place those commands into a Sorted container, descending on the float. - Process all commands where the double equals the double of the first command in the container. - For each unit's command processed, pull the next command for that unit from the queues, inserting it as needed into the sorted container. - Repeat until queues and container are empty. What this should do is normalize the commands to be a percentage of the turn time. An example:
Unit 1, some guard. AP 8 max AP 10       Unit 3, evil zombie, AP 3 max AP 3
Commands:

Move into tile (0,0) [cost:2]            Move into tile (0,0) [cost:2]
Fortify [cost:2]
So, processing, the first guard command is (8 + 8-2)/2/8 or 7/8. The first zombie command is (3 + 3-2)/2/3 or 2/3. 7/8 > 2/3 so the guard goes first and moves into the tile. Process guard command #2: (6 + 6-2)/2/8 [remember, 2 ap spent moving already] or 5/8. 2/3 > 5/8 so the zombie goes next and moves into the tile, causing combat before the guard is fortified. And that's the idea. The guard can do more, and if both start at the same time the more 'rested' unit should gain the initiative. But the zombie shouldn't have to wait until the guard makes moves until he's only got 3 AP left until starting his only action.

Share this post


Link to post
Share on other sites
TechnoGoth    2937
Why not take a phased aproach where all actions take place at the same time during those phases?

Players issue all their orders and then each order takes place during a different phase.

You could decide phases one of two ways.

Each command has a set phase it occurs at, such attack phase, move phase, build phase. So build bridge always occurs during the building phase. Charge zombie always occurs during the attack phase. If units can only take one actions per phase then players have to plan their choice more carefully as they can only do one of each type of action a turn regardless of AP. But it aso provides a more consistant gameplay.

The other option is to give units order queue and have all orders at that point in the queue take place at the same time. So the first orders for all units occurs and is resolved, before moving on 2nd, 3rd, and so on. This method favors units with more AP and add more uncertinty into the game.

Share this post


Link to post
Share on other sites
Telastyn    3777
Quote:
Original post by TechnoGoth
Why not take a phased aproach where all actions take place at the same time during those phases?


Because that does still has problems with multiple commands which are mutually exclusive. Two players say... trying to mine from the same ore spot. Ore can only be mined once per turn. Who gets it? Actions cannot take place at the same time. You can fake it, but the computer (or tabletop gamers) will still resolve one after the other.

Quote:

Players issue all their orders and then each order takes place during a different phase.

You could decide phases one of two ways.

Each command has a set phase it occurs at, such attack phase, move phase, build phase. So build bridge always occurs during the building phase. Charge zombie always occurs during the attack phase. If units can only take one actions per phase then players have to plan their choice more carefully as they can only do one of each type of action a turn regardless of AP. But it aso provides a more consistant gameplay.


I would like not to make such action constraints. As it stands on paper, projects to work on are not so clear cut as to if they're building, research, spellcasting, exploration... I also think that might remove strategic options. (should I spend all my points working on this building, or should I scout around?)

I'm also curious what your thinking is behind the consistent gameplay comment. I don't quite see that, but then again I've a poor perspective; hence the post [grin]

Quote:

The other option is to give units order queue and have all orders at that point in the queue take place at the same time. So the first orders for all units occurs and is resolved, before moving on 2nd, 3rd, and so on. This method favors units with more AP and add more uncertinty into the game.


Sounds similar, though it gives less favor to units with high AP whilst simplifying things.

Thanks!

Share this post


Link to post
Share on other sites
RolandofGilead    100
It's been so long I forgot how to quote, forgive me.

"Who gets it? Actions cannot take place at the same time."
This one is troubling. Here's why, it's a game logic/rule question rather than a programming one. You simply must come up with a rule for dealing with that scenario.

I'm using phases. The key to phases is that only actions which may conflict go into the same phase.

Consistency is achieved because you always know what actions can happen now and in the next phase because the phases always follow the same order. It simplifies planning.

Another option is to give commands different times for completion and allow units to spend AP to complete tasks more quickly.

If you really want to make sure every zombie gets a chance, combine TechnoGoth's idea and your idea, resolve all the 1st orders, then sort and resolve the 2nd and 3rd's 4th's etc. based on your system(7/8 > 2/3).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this