I'm working on a map that draws inspiration from AC brotherhood's mutliplayer. If I think it's going to be fun to play after its partially done, I'll continue to work on it. Anyway...The way the game works is that every player has a target whom they must kill. Therefore each player also has a pursuer who is trying to kill them. Each player can only have 1 target at a time, but one player can have more than 1 pursuer hunting for him. (I'm going to try to make players with higher scores be hunted by more players at once)...Anyway, I'm trying to figure out how to set this up. I had a loop in the start of the map that dumps all the players into a group and removes them and targets the next player in the group. But then the last player is always left with no target. I also don't know how many players there could be at a given moment, since it will be able to be played with anywhere from 5 to 10 players, and people might leave mid-game. Any advice on how to set up all the targets like this?
Simple recap of the requirements:
1- Each player needs to have at least 1 other player hunting them most of the time.
2- No two players can hunt each other (Example, player 1 assigned to kill player 2, and player 2 told to kill player 1)
3- One player CAN be hunted by more than one person at once. I'd really like to make players with higher scores have more people hunting them down, but its not totally necessary.
Haven't played the game but have seen some of the developer diaries, so i only have a vague understanding of how the game-play mechanics work.
Anyhow, you only need to store either a player's target (as indices), you can store this as a user integer.
Or a unit's target, you can store this as a behavior, which one you should choose i can't tell you as it depends on the game-play mechanics and i do not know how they will unfold (i.e can a player have more than one unit), but you should abandon the group method.
When a player disconnects, just find players that are targeting that player/unit and re-assign their target to someone new.
Not sure what rules would be used to dictate who targets who, so if you could elaborate on that.
Player1targetsPlayerXEvents------- new round or whateverLocalVariablesConditionsActionsVariable-SetPlayer1targetsPlayer=(Randomintegerbetween0and10)General-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditionsPlayer1targetsPlayer==1AndConditionsPlayer1targetsPlayer==2(Statusofplayer2)==UnusedAndConditionsPlayer1targetsPlayer==3(Statusofplayer3)==UnusedAndConditionsPlayer1targetsPlayer==4(Statusofplayer4)==UnusedAndConditionsPlayer1targetsPlayer==5(Statusofplayer5)==UnusedAndConditionsPlayer1targetsPlayer==6(Statusofplayer6)==UnusedAndConditionsPlayer1targetsPlayer==7(Statusofplayer7)==UnusedAndConditionsPlayer1targetsPlayer==8(Statusofplayer8)==UnusedAndConditionsPlayer1targetsPlayer==9(Statusofplayer9)==UnusedAndConditionsPlayer1targetsPlayer==10(Statusofplayer10)==UnusedThenTrigger-RunPlayer1targetsPlayerX2(CheckConditions,Waituntilitfinishes)Else------- Tell Player what his Target is
I tell the trigger to do the following checks, if one of them doesn't work it repeats the trigger.
1.Check if target player is actually in the game.
2.Check if target is not equal to killer.
That seems like it would make sense but there are some potential problems I see. This just occured to me- I need every player to be hunted by at least 1 other player 99% of the time (a few seconds waiting after a kill or something is fine). This would just randomly assign everybody. Another issue is that player 1 and player 2 could end up hunting eachother. I don't want 2 players to ever both need to kill the other (its instant kills so that would just be stupid- whoever clicks first wins...) Also you could probably simplify the trigger alot by just checking to see if the status of player ( Player1target) == unused instead of having them all separate...Anyway, its a good start, so thanks :D
Anybody else have suggestions to help prevent 2 players from getting each other?
edit- Maybe you could put in a 3rd check..something like if player_target[player_target[1]] == 1 then repeat or something? That might work. I guess the on;y improvement I'd still like would be a way to control which players get more people chasing them.
How should it be possible that every player is hunted and, at the same time, some players might be hunted by more than 1 other player?
If you have n players then every player can be hunted by exactly 1 other player before you run out of free players.
Anyway, that's what I'd do:
LocalVariable:t=0<Integer>Actions://We set t to a random number at first. Then we set t to a different//random number as long as PlayerIsHunted[t] is true.//Once it's false we got a player that hasn't been taken yet.//Let's assume we have 8 playersSett=Randomnumberbetween1and8While(Condition)do(Action)Condition:PlayerIsHunted[t]==trueAction:Sett=Randomnumberbetween1and8EndWhile//Now we mark the number t as taken.SetPlayerIsHunted[t]=true;Player(t)isnowyourrandomlyselected,unhuntedplayer.
Once a player dies you set his PlayerIsHunted flag to false.
There is another problem - with this set-up it can happen that two players hunt each other. However, that's something you can't simply change because it might just happen.
Let's say you randomly assign a victim to every player it *might* happen that the last victim you assign has to be given to the player he hunts himself.
In this case you could assign him a different target which will then be hunted by two people. But you won't have every player being hunted if at all possible.
PS: Got a better idea, I think:
LocalVariablesPlayers=0<Integer[8]>t=0<Integer>r=0<Integer>temp=0<Integer>ConditionsActions//We make an array which will hold the numbers 1 through 8 - our players.General-Foreachintegertfrom1to8withincrement1,do(Actions)ActionsVariable-SetPlayers[t]=t//Now we take the indexes and switch them with each other randomly. This isn't a very good//way to randomize, but it'll do. Now we have the numbers 1 through 8 but in random order.//So we have every player ordered in random order.General-Foreachintegertfrom1to8withincrement1,do(Actions)Actions//We rVariable-Setr=(Randomintegerbetween1and8)Variable-Settemp=Players[t]Variable-SetPlayers[t]=Players[r]Variable-SetPlayers[r]=temp//Now we just make every player hunt the the one who comes after him. Note that we only loop//trough 1 to 7 now, because we don't want player 8 to hunt player 9, but instead hunt player 1.//(Well, they're not actually player 8 and 1 - since we got them in random order. But they're the // players in the 8th and 1st spot.)General-Foreachintegertfrom1to7withincrement1,do(Actions)ActionsMakePlayerXHuntY(Players[t],Players[(t+1)])MakePlayerXHuntY(Players[8],Players[1])
This way (if I'm not mistaken) we should satisfy all of your conditions. Of course it's still mathematically impossible to have every player hunted AND some players hunted by more than one player.
See my above post. I tried that and it should work...it says err "stack overflow"....I've never gotten that err before and have no idea what it means. Does it mean I'm running the trigger to many times? Should I use the while condition is ture that you (s3rius) used? (Cant believe I forgot about that..duh I've used it loads of times before...)
Also, you're right about the fact that it won't make sense for people to have more than one on them at once...What the heck, though, because in AC brotherhood you can have up to 4 guys on you at once....Hmmm wierd. Whatever :D
Rollback Post to RevisionRollBack
Feel free to Send me a PM if you have any questions/concerns!
Anyway, please see my above post for another solution I just came up with. Oh and yes, you should use that while-loop. It's faster than writing a dozen if-then-whatever conditions. Much faster and more convenient.
That "stack overflow".. I think you get it when you're trying to access an index which isn't available. So if you have an array of size 10 and try to access index 11. Don't take my word on it though, I haven't worked with the editor for a while and forgot what all that error messages mean.
Okay. Also, I looked at the trigger you suggested and it looks good. One question before I make it though, will that make it so each player is hunted? And also do you have a suggestion about what to do when one player kills their target? How would I set that up? Also, you are right about not being always hunted. It occurred to be that when you mess up and the target gets away, you are assigned somebody else. Meaning that the target that got away no longer has a pursuer. :D Anyway thanks for the help.
Rollback Post to RevisionRollBack
Feel free to Send me a PM if you have any questions/concerns!
We ordered all players in a random order and let them hunt each other. Like a circle of hunters.
When killing/respawning you have to consider one thing:
When the victim dies we need to assign a new victim to the killer.
The victim's victim is now free, so it'd the best thing to just make the killer hunt this one.
But then you would know who is hunting you, if you always go for the same guy. Maybe you get assigned a random player, unless a second player is free...anyway...thanks
Rollback Post to RevisionRollBack
Feel free to Send me a PM if you have any questions/concerns!
No, you wouldn't go for the same guy all the time.
Look at my graphic. Let's say Player 4 kills Player 3. Now Player 4 needs another victim. And look! Now that Player 3 is dead Player 6 is not being hunted anymore. So Player 4 now goes after Player 6.
At this point poor Player 3 is out of the picture. The other 5 players have basically closed the circle without him, so for now we'll order him to hunt a person who's already being hunted (for example the highest ranked player).
A little later Player 1 dies. Now Player 5 needs another target. We do the same thing we did before and order Player 5 to go after Player 4.
Now Player 1 respawns. We remember that Player 3 is not hunted yet and order Player 1 to go after him. Now the circle is complete again and they're all looking for other targets now.
It's 5:26 AM here and I shall now go to bed. Good night world!
Search the web if you want an explanation of what a stack overflow is, no point in repeating what is already out there. In very short terms you are allocating more memory on the call stack and what is available. Looping and recursion will do that.
Using data this way is just a much more flexible approach IMO, removes the need for timers etc (AFAIK you can run until a contract expires in assasin's creed).
s3rius already went into the cyclic referencing issues etc so skipped that part.
(You guys post to quickly, this post is already outdated before posting)
The number of players can vary from game to game (at least, thats what I was planning on). It doesn't look like the method you chose would work with less than 8 players, is that right? If I only used the first X slots of the array (X being the # of players) it would still work, right?
edit- I attached a pic of my trigger. Instead of simply using "8" for the loops, I use the number of players. That way (if it works) I can still test the game with just me and 1 other person and also I don't want 8 players to be required to play.
edited again- It says "an error has occurred starting starcraft 2"...What the heck? I've got that occasionally before but its not very descriptive of the problem... Through some testing with disabling parts of the trigger, I traced the problem to the
"Variable - Set r = (Random integer between 1 and 8 )
Is this going to be elimination style? If not, what happens when a killed victim respawns? He will have no one hunting him, and everyone else is already assigned a victim.
Like S3rius said, lets say right now its like this:
means going after (1 going after 2, 2 going after 3 etc..)
1 >> 2 >> 3 >> 4 >> 5 >> 1
player 3 kills player 4. Now its 1 >> 2 >> 3 >> >> 5 >> 1 because 4 has been removed, and the circle of targets closes.
Now player 4 respawns. Now its 4 >> 1 >> 2 >> 3 >> >> 5 >> 1
This means 4 doesn't have anybody chasing him. But as soon as somebody else dies, they will notice 4 doesn't have a target and get assigned to kill him. When a respawning player needs a target but all other players are already being targeted, the re spawning player is told to kill whoever has the highest score currently. But If there is another player who currently has nobody chasing him, the re spawning player is told to kill them. The period that any one player has nobody chasing them should be really short because it ends as soon as somebody dies.
And another question (wow this is getting ridiculous)...With the method I used (the one from S3rius), would it be possible for a player to be assigned to kill themselves?
edit- its working now except that for some reason I can sometimes get myself. ??? What the heck, it seems like that is impossible.
FINAL EDIT- I think I got it. See attached picture #2.
I'm working on a map that draws inspiration from AC brotherhood's mutliplayer. If I think it's going to be fun to play after its partially done, I'll continue to work on it. Anyway...The way the game works is that every player has a target whom they must kill. Therefore each player also has a pursuer who is trying to kill them. Each player can only have 1 target at a time, but one player can have more than 1 pursuer hunting for him. (I'm going to try to make players with higher scores be hunted by more players at once)...Anyway, I'm trying to figure out how to set this up. I had a loop in the start of the map that dumps all the players into a group and removes them and targets the next player in the group. But then the last player is always left with no target. I also don't know how many players there could be at a given moment, since it will be able to be played with anywhere from 5 to 10 players, and people might leave mid-game. Any advice on how to set up all the targets like this?
Simple recap of the requirements:
1- Each player needs to have at least 1 other player hunting them most of the time.
2- No two players can hunt each other (Example, player 1 assigned to kill player 2, and player 2 told to kill player 1)
3- One player CAN be hunted by more than one person at once. I'd really like to make players with higher scores have more people hunting them down, but its not totally necessary.
edit:
Thats a video showing how the game should work.
Haven't played the game but have seen some of the developer diaries, so i only have a vague understanding of how the game-play mechanics work.
Anyhow, you only need to store either a player's target (as indices), you can store this as a user integer. Or a unit's target, you can store this as a behavior, which one you should choose i can't tell you as it depends on the game-play mechanics and i do not know how they will unfold (i.e can a player have more than one unit), but you should abandon the group method.
When a player disconnects, just find players that are targeting that player/unit and re-assign their target to someone new. Not sure what rules would be used to dictate who targets who, so if you could elaborate on that.
maybe this helps:
edit: see next post. (how do you delete a post??)
I tell the trigger to do the following checks, if one of them doesn't work it repeats the trigger. 1.Check if target player is actually in the game. 2.Check if target is not equal to killer.
That seems like it would make sense but there are some potential problems I see. This just occured to me- I need every player to be hunted by at least 1 other player 99% of the time (a few seconds waiting after a kill or something is fine). This would just randomly assign everybody. Another issue is that player 1 and player 2 could end up hunting eachother. I don't want 2 players to ever both need to kill the other (its instant kills so that would just be stupid- whoever clicks first wins...) Also you could probably simplify the trigger alot by just checking to see if the status of player ( Player1target) == unused instead of having them all separate...Anyway, its a good start, so thanks :D
Anybody else have suggestions to help prevent 2 players from getting each other?
edit- Maybe you could put in a 3rd check..something like if player_target[player_target[1]] == 1 then repeat or something? That might work. I guess the on;y improvement I'd still like would be a way to control which players get more people chasing them.
edit- now It says "stack overflow"...its an err
How should it be possible that every player is hunted and, at the same time, some players might be hunted by more than 1 other player?
If you have n players then every player can be hunted by exactly 1 other player before you run out of free players.
Anyway, that's what I'd do:
Once a player dies you set his PlayerIsHunted flag to false.
There is another problem - with this set-up it can happen that two players hunt each other. However, that's something you can't simply change because it might just happen.
Let's say you randomly assign a victim to every player it *might* happen that the last victim you assign has to be given to the player he hunts himself.
In this case you could assign him a different target which will then be hunted by two people. But you won't have every player being hunted if at all possible.
PS: Got a better idea, I think:
This way (if I'm not mistaken) we should satisfy all of your conditions. Of course it's still mathematically impossible to have every player hunted AND some players hunted by more than one player.
See my above post. I tried that and it should work...it says err "stack overflow"....I've never gotten that err before and have no idea what it means. Does it mean I'm running the trigger to many times? Should I use the while condition is ture that you (s3rius) used? (Cant believe I forgot about that..duh I've used it loads of times before...)
Also, you're right about the fact that it won't make sense for people to have more than one on them at once...What the heck, though, because in AC brotherhood you can have up to 4 guys on you at once....Hmmm wierd. Whatever :D
In AC you probably don't get hunted all the time.
Anyway, please see my above post for another solution I just came up with. Oh and yes, you should use that while-loop. It's faster than writing a dozen if-then-whatever conditions. Much faster and more convenient.
That "stack overflow".. I think you get it when you're trying to access an index which isn't available. So if you have an array of size 10 and try to access index 11. Don't take my word on it though, I haven't worked with the editor for a while and forgot what all that error messages mean.
Okay. Also, I looked at the trigger you suggested and it looks good. One question before I make it though, will that make it so each player is hunted? And also do you have a suggestion about what to do when one player kills their target? How would I set that up? Also, you are right about not being always hunted. It occurred to be that when you mess up and the target gets away, you are assigned somebody else. Meaning that the target that got away no longer has a pursuer. :D Anyway thanks for the help.
Yes, everyone will be hunted.
Check out my proffessionally-made graphic:
http://simplest-image-hosting.net/png-0-unbenannt52
We ordered all players in a random order and let them hunt each other. Like a circle of hunters.
When killing/respawning you have to consider one thing:
When the victim dies we need to assign a new victim to the killer.
The victim's victim is now free, so it'd the best thing to just make the killer hunt this one.
But then you would know who is hunting you, if you always go for the same guy. Maybe you get assigned a random player, unless a second player is free...anyway...thanks
No, you wouldn't go for the same guy all the time.
Look at my graphic. Let's say Player 4 kills Player 3. Now Player 4 needs another victim. And look! Now that Player 3 is dead Player 6 is not being hunted anymore. So Player 4 now goes after Player 6.
At this point poor Player 3 is out of the picture. The other 5 players have basically closed the circle without him, so for now we'll order him to hunt a person who's already being hunted (for example the highest ranked player).
A little later Player 1 dies. Now Player 5 needs another target. We do the same thing we did before and order Player 5 to go after Player 4.
Now Player 1 respawns. We remember that Player 3 is not hunted yet and order Player 1 to go after him. Now the circle is complete again and they're all looking for other targets now.
It's 5:26 AM here and I shall now go to bed. Good night world!
Okay. :D Thank. (by the way that graphic is so amazing you should be a professorial artist)
Search the web if you want an explanation of what a stack overflow is, no point in repeating what is already out there. In very short terms you are allocating more memory on the call stack and what is available. Looping and recursion will do that.
s3rius, that would be a buffer overflow.
Anyhow, my take on how i would implement it.
Using data this way is just a much more flexible approach IMO, removes the need for timers etc (AFAIK you can run until a contract expires in assasin's creed). s3rius already went into the cyclic referencing issues etc so skipped that part.
(You guys post to quickly, this post is already outdated before posting)
Another question came to mind! @S3rius
The number of players can vary from game to game (at least, thats what I was planning on). It doesn't look like the method you chose would work with less than 8 players, is that right? If I only used the first X slots of the array (X being the # of players) it would still work, right?
edit- I attached a pic of my trigger. Instead of simply using "8" for the loops, I use the number of players. That way (if it works) I can still test the game with just me and 1 other person and also I don't want 8 players to be required to play.
edited again- It says "an error has occurred starting starcraft 2"...What the heck? I've got that occasionally before but its not very descriptive of the problem... Through some testing with disabling parts of the trigger, I traced the problem to the
"Variable - Set r = (Random integer between 1 and 8 )
Variable - Set temp = Players[t]
Variable - Set Players[t] = Players[r]
Variable - Set Players[r] = temp"
part...
Is this going to be elimination style? If not, what happens when a killed victim respawns? He will have no one hunting him, and everyone else is already assigned a victim.
@Abion47: Go
Like S3rius said, lets say right now its like this:
means going after (1 going after 2, 2 going after 3 etc..)
1 >> 2 >> 3 >> 4 >> 5 >> 1
player 3 kills player 4. Now its 1 >> 2 >> 3 >> >> 5 >> 1 because 4 has been removed, and the circle of targets closes.
Now player 4 respawns. Now its 4 >> 1 >> 2 >> 3 >> >> 5 >> 1
This means 4 doesn't have anybody chasing him. But as soon as somebody else dies, they will notice 4 doesn't have a target and get assigned to kill him. When a respawning player needs a target but all other players are already being targeted, the re spawning player is told to kill whoever has the highest score currently. But If there is another player who currently has nobody chasing him, the re spawning player is told to kill them. The period that any one player has nobody chasing them should be really short because it ends as soon as somebody dies.
And another question (wow this is getting ridiculous)...With the method I used (the one from S3rius), would it be possible for a player to be assigned to kill themselves?
edit- its working now except that for some reason I can sometimes get myself. ??? What the heck, it seems like that is impossible.
FINAL EDIT- I think I got it. See attached picture #2.