Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Team Initiative
#21
(03-01-2012, 04:19 PM)Jayof9s link Wrote: They're here, if you have specific questions ask and they'll likely help you out so you're not shooting in the dark on it.

But... but... Shooting in the dark is how I program.  Tongue
Reply
#22
From what I got from the Code, the Initiative order is kind of determined by the turn order, which again is player specific (Each GameTurn has a player id that stands for the specific player, who is allowed to move on this specific turn).
Now, my Idea would be: change the turn order from player to team. I would expect this to be a potential source of trouble if several players on a team then try to move at once, but ignoring this it should be a way to achieve a "true" team initiative.

Am I (in theory) right about this?

Reply
#23
I think the question is which computer client is waiting for data from which computer client. I'll explain (which is quite long. :-\)

Team 1: Alpha, Beta, Charlie
Team 2: DeltaBot

Each player has 2 mechs while the bot has 6. Team 1 won initiative. MM determines that Team 1 move order is Alpha, Beta, and then Charlie(who won initiative). So the move order is (and I hope I am right):
Code:
D, A, D, B, D, C, D, A, D, B, D, C
So while DeltaBot is moving all other clients are waiting for the data from DeltaBot. The same is true when Alhpa is moving. The players can choose which of the 2 units it want to move while the bot can choose out of all 6 (so it is unfair-ish).

What we want, as far as I can tell:
Code:
Movement order:
T2, T1, T2, T1, T2, T1, T2, T1, T2, T1, T2, T1
Suggestion so far for getting this, as I've understood, is to allow T1 to decide who goes first. So MM would still decide the team initiative as it did before (first box) except Alpha could sort of click a button, maybe a new button, which says basically "pass turn to next teammate." Which would make the turn order look like this:
Code:
D, B, D, C, D, A, D, B, D, C, D, A
except the first D has already been moved.
It is basically like just making A go to the back and move everyone else forward once. However, if Beta doesn't want to move his units or Charlie tells him to give him his turn, then Beta clicks the "pass" button and now Beta goes to the back and everyone is moved forward one slot and now Charlie can move either of his units. And I think it would be possible to even have Charlie "pass" if in the meantime the team has changed its mind about who should move first. If Charlie "passes" then it is Alpha's turn just like it was at the beginning. This only works with turns that have not been made, the right end of the list. So if 3 moves have already been done and Charlie did move, then it would look like this:
Code:
D, C, D, | A, D, B, D, C, D, A, D, B
Now if Charlie tells Alhpa and Beta to "pass" him the turn and he moves then it would be this:
Code:
1st: D, C, D, | B, D, C, D, A, D, B, D, A
2nd: D, C, D, | C, D, A, D, B, D, A, D, B
After Move (DeltaBot's turn): D, C, D, C, | D, A, D, B, D, A, D, B
Hopefully this is making sense. Wink

Pros: IMO, this eliminates needing a CO to elect the turn order. And this promotes team communication and active strategy planning using each others units and their capabilities. Notice how Charlie could move all of his unit right at the beginning without screwing up the move order. It is like there are slots the team is moved about in.
Cons: In order to get to Charlie from Alpha, the turn has to go through Beta. Also, the order will change each turn as MM does what it does now and finds team initiative and then player initiative within the team. So Charlie won't always be after Beta.

Now the programming details. Each client would be waiting for a signal that it is their turn to move, just like it waits now. Bot's would probably need some additional code to get them to work with a new "pass button" but this can be avoided unless the bot is on your team. Or make the bots just not use the "pass button" and stick with the old MM way of moving. Teams don't have to use the "pass button" if they like the order MM decided things would go. Bots could do the same and ignore it.

Difficulty to implement is anyones guess. This is more just a brainstorm of a how to do it. And a check for "is the end result what you want?" So would the above work? And those that have looked at the code, is it within the "doable" realm?
Reply
#24
No real clue about the "is it doable" question, as I have only had a short look at the code. But it is indeed a very good description of what (at least I ) would like to have.

One thing one would have to think about however are things like the individual initiative option, were (from what I understand) each unit gets an Initiative and accordingly an initiative phase and where players can not decide which unit to move at which point in time, so it would be necessary to take this into account.
Reply
#25
(03-02-2012, 06:41 PM)Neth link Wrote: One thing one would have to think about however are things like the individual initiative option, were (from what I understand) each unit gets an Initiative and accordingly an initiative phase and where players can not decide which unit to move at which point in time, so it would be necessary to take this into account.

Actually, I don't think team movement is compatible with individual initiative since it is suppose to represent individual units. So it doesn't matter who owns the unit, right? So, as I see it which might be wrong, individual initiative would not include any of the stuff I've talked about above. Instead it would be either you choose Regular Initiative or Individual Initiative. And if you choose Regular then you can choose Regular MM Style (the current way) or Regular Team Choice Style.
Reply
#26
True. And yes, if it is implemented as an additional option or a modification of the "Team initiative" option, then it should work fine.
Reply
#27
Btw:
How would you commit changes into the svn? just into the trunk? Or is there a policy for features?
Reply
#28
Into the trunk. I'm thinking of dong a feature-freeze for a while soonish, though, because I really want a new stable release.
Reply
#29
While trying to implement this I just noticed something, which I am not quite sure about.

First thing mentioned in the Game class is:
"Clients and Server have copies and its their job to keep them synced".

My initial attempt was to add some functionality, that allows you to "hand over" a turn, changing the current player with the next "legal" occurence of the teammate he has chosen if his current turn is a general (movement) turn (i.e. if it is a type specific turn or similar you can't give your turn to the another player, even though this might be in theory possible (multiple infantry/tanks for multiple players etc) I did not want to go to this extreme...

However after some implementation I found the above sentence.

My current implementation was assuming that I can just change the turns in the turnVector of the Game class and everything would be ok. Is that a valid assumption or would I have to write something to update the turn sequence on each client seperately? Is there already some implementation to achieve this?


Seems like it is quite some more work as I originally expected...
Reply
#30
And apart from that:

Who to contact to be able to commit something into the repository?

I did implement some basic things that I (for a long time) was looking for in MM (Partial repairs for Mechs) and would like to commit those but can't at the moment.

I am also working on the Team ini thing, though this seems to be a more tricky issue. However I manged to understand (at least I think so) what to do to keep clients+server synced.
One question though, as it is a very large function:
Is it necessary to call the "endcurrentTurn" function to do cleanup for the current turn? Or could I just swap the turnvector and send the new index and turnvector to all clients and it "should" work?
If the first, I will have to change my line of thought a bit but it should not be too much of a problem.
Reply
#31
(03-08-2012, 05:36 AM)Neth link Wrote: And apart from that:

Who to contact to be able to commit something into the repository?
Just submit a patch on the patch tracker on the sourceforge site.

Quote:One question though, as it is a very large function:
Is it necessary to call the "endcurrentTurn" function to do cleanup for the current turn? Or could I just swap the turnvector and send the new index and turnvector to all clients and it "should" work?
If the first, I will have to change my line of thought a bit but it should not be too much of a problem.
I don't actually know, because I've never changed that code or even looked at it. I'll have to take a look.
Reply
#32
I think I am quite close to finishing the implementation (still don't knwo exactly about the endturn routine but I don't think I need to call it from all I have seen.

However I encounter one problem:
Is there a simple way to determine whether a given turn is a "general" turn i.e. all units could be moved in it or if it is a turn specific to a certain type of units (Protos, Infantry, etc pp).
I need to check this to determine whether it is allowed for a player to forward his turn (as I would disallow it in case he started an Infantry turn while multiple infantry movement is enforced by the options. This could otherwise get extremely strange results.
Reply
#33
Check if the Turn is an instance of EntityClassTurn, SpecificEntityTurn or UnitNumberTurn (that's for ProtoMech units) should be what you're looking for.
Reply
#34
Code:
boolean isGeneralMoveTurn = !(turn instanceof GameTurn.SpecificEntityTurn)
                   && !(turn instanceof GameTurn.UnitNumberTurn)
                   && !(turn instanceof GameTurn.UnloadStrandedTurn)
                   && !(turn instanceof GameTurn.EntityClassTurn)
                   && !(turn instanceof GameTurn.TriggerBPodTurn)
                   && !(turn instanceof GameTurn.TriggerAPPodTurn);

This is what I am currently checking for. (which does not work). It is similar to what is checked in the EndCurrentTurn() function in the server class. However, it when my code reaches this point my current turn (as obtained by game.gameTurn() ) leads to this being false. And I have no Idea as to why yet.

I will check this tomorrow testing what kind of turn it actually is. I just had hoped, that there is another way as I was unable to find out what kind of turns "normal" game turns actually are. Maybe I'm just blind ...

Edit: Found it. It seems that every entity gets a turn which is a SpecificEntityTurn. Even though this is kind of strange but the GameTurn vector is set up as a vector with the length of "all turns" and then for each entity turns are added. So maybe I should not check for SpecificEntityTurn. But on the other hand this is indeed kind of strange...
Code:
Vector<GameTurn> turns;

       if (strandedUnits.hasMoreElements() && (game.getPhase() == IGame.Phase.PHASE_MOVEMENT)) {
           // Add a game turn to unload stranded units, if this
           // is the movement phase.
           turns = new Vector<GameTurn>(team_order.getTotalTurns() + team_order.getEvenTurns() + 1);
           turns.addElement(new GameTurn.UnloadStrandedTurn(strandedUnits));
       } else {
           // No stranded units.
           turns = new Vector<GameTurn>(team_order.getTotalTurns() + team_order.getEvenTurns());
       }

       // add the turns (this is easy)
       while (team_order.hasMoreElements()) {
           Entity e = (Entity) team_order.nextElement();
           if (e.isSelectableThisTurn()) {
               turns.addElement(new GameTurn.SpecificEntityTurn(e.getOwnerId(), e.getId()));
           }
       }

EDIT2:
Another update:
The turn I get is an EntityClassTurn. My current "testgame" consists of 3 Mechs. 2 in one team and one in another team. My only guess how this happens currently is with this strange "moveeven" thing in the code...


Reply
#35
I implemented it and it (seems) to work. At least I can forward the ini to another player on my team.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Commanders and Initiative TigerShark 0 592 10-04-2014, 02:18 PM
Last Post: TigerShark

Forum Jump:


Users browsing this thread: 1 Guest(s)