AAO25.com

Assist => Feedback & Suggestions => Topic started by: 82nd_DXO_COL=Shad on Tuesday, June 24, 2014, 12:51:49 PM

Title: mapvote
Post by: 82nd_DXO_COL=Shad on Tuesday, June 24, 2014, 12:51:49 PM
mapvote is unusable in a server.  It's primary bug is that it allows 1 player to change the map by spamming 'YES'.  It does not seem to ignore a player within the vote time after they have specified 'YES' or 'NO' or asked for a map vote.  That may not be the actual case, if indeed it only allows one vote per player per timer, but somehow 1 or 2 players in a populated server are able to do it, and there is no feedback from the server.
The other problem is that you cannot list the map names.  Experienced players might know what they are, but they do not allow for a truly public browsing of the map choices.
I suggest you keep an array of playernames with their vote choice, as well as where they are at in a list command (as there are a lot of map names) that resets with the timer as well as some feedback to the player who has already started a mapvote.
If you need help I can code unrealscript and have access to crusade's original mapvote for 2.5
Title: Re: mapvote
Post by: ELiZ on Tuesday, June 24, 2014, 19:36:02 PM
A maplist would not fit into the chat window.

This is the check for how many votes are required, I see nothing wrong with it:
Code: [Select]
MvVotesRequired = Level.Game.GetNumPlayers() / 2 + 1;
Playername is already saved and checked against:

Code: [Select]
class MVHandler extends BroadcastHandler HideCategories(Movement,Collision,Lighting,LightColor,Karma,Force);

var array<string> Voters;
var int iRequiredVotes;

function BroadcastText (PlayerReplicationInfo SenderPRI, PlayerController Receiver, string Msg, name Type)
{
if ((SenderPRI.PlayerName == Receiver.PlayerReplicationInfo.PlayerName) && (Caps(Msg) == "YES") && CheckCanVote(SenderPRI.PlayerName))
{
Voters.Length = Voters.Length + 1;
Voters[Voters.Length - 1] = SenderPRI.PlayerName;
Level.Game.BroadcastHandler.Broadcast(None, SenderPRI.PlayerName $ " has added their vote for a map change! [" $ string(Voters.Length) $ "/" $ string(iRequiredVotes) $ "]");
  }
else
{
    Super.BroadcastText(SenderPRI,Receiver,Msg,Type);
  }
}

function bool CheckCanVote (string PlayerName)
{
local int i;

i = 0;

if ( i < Voters.Length )
{
if ( PlayerName == Voters[i] )
{
return False;
}
    i++;
}
return True;
}
Title: Re: mapvote
Post by: Alex on Tuesday, June 24, 2014, 19:53:47 PM
A maplist would not fit into the chat window.

This is the check for how many votes are required, I see nothing wrong with it:
Code: [Select]
MvVotesRequired = Level.Game.GetNumPlayers() / 2 + 1;
Playername is already saved and checked against:

Code: [Select]
class MVHandler extends BroadcastHandler HideCategories(Movement,Collision,Lighting,LightColor,Karma,Force);

var array<string> Voters;
var int iRequiredVotes;

function BroadcastText (PlayerReplicationInfo SenderPRI, PlayerController Receiver, string Msg, name Type)
{
if ((SenderPRI.PlayerName == Receiver.PlayerReplicationInfo.PlayerName) && (Caps(Msg) == "YES") && CheckCanVote(SenderPRI.PlayerName))
{
Voters.Length = Voters.Length + 1;
Voters[Voters.Length - 1] = SenderPRI.PlayerName;
Level.Game.BroadcastHandler.Broadcast(None, SenderPRI.PlayerName $ " has added their vote for a map change! [" $ string(Voters.Length) $ "/" $ string(iRequiredVotes) $ "]");
  }
else
{
    Super.BroadcastText(SenderPRI,Receiver,Msg,Type);
  }
}

function bool CheckCanVote (string PlayerName)
{
local int i;

i = 0;

if ( i < Voters.Length )
{
if ( PlayerName == Voters[i] )
{
return False;
}
    i++;
}
return True;
}
I can verify that the mapvote counts the same player voting twice. A while back we had a full server on PCR (82nd server I believe) and these 2 idiots came into the server and voted it to Urban(or mout?) with just the two of them. Unless that was a different map vote mod, it's definitely broken.
Title: Re: mapvote
Post by: teddy_grizzly_bear on Tuesday, June 24, 2014, 20:35:25 PM
I can verify that the mapvote counts the same player voting twice. A while back we had a full server on PCR (82nd server I believe) and these 2 idiots came into the server and voted it to Urban(or mout?) with just the two of them. Unless that was a different map vote mod, it's definitely broken.
I, too can verify that I can vote twice for one map if I want to.
Title: Re: mapvote
Post by: ELiZ on Tuesday, June 24, 2014, 21:44:01 PM
When you say "spam", what interval does that mean?
Does it work with normal chat speed, or do they have use some type of bind?

Does it say "X has added their vote for a map change!" for all the votes a single player casts?
A screenshot of log file would be valuable for that.

Title: Re: mapvote
Post by: Alex on Wednesday, June 25, 2014, 00:08:50 AM
When you say "spam", what interval does that mean?
Does it work with normal chat speed, or do they have use some type of bind?

Does it say "X has added their vote for a map change!" for all the votes a single player casts?
A screenshot of log file would be valuable for that.


na, it's not a bind. They just type "yes", then open up the console and hit the up arrow and enter to enter "yes" again. All that the server does is say the updated total of the vote. like, "vote the switch to [insertmap] x/needed" It goes up by one every time the player types "yes", regardless if they already voted or not.

I would try to get a screenshot but I don't know of any server that still uses the mod due to this very problem.
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Wednesday, June 25, 2014, 00:28:33 AM
Voters is the string array that is checked for a playername already voting and the number of votes YES
CheckCanVote()  should return false is a player has already voted, so....Maybe there is an issue with SenderPRI.PlayerName in BroadcastText() being different each time, or maybe Voters is not getting reset.  Perhaps it is filling up over time. As a precaution maybe clear out Voters in CancelMapVote().  That would reset the Voters list every timer/mapvote

Technically enough players joining the server and saying YES while the vote is in progress can tip the vote as all this method does is just count 'YES's between different player names.

Log of that particular night on PCR with KillaMan (about 12-16 in server):
Quote
[05/05/2014 01:08:49]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:08:53]   gunna'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:09:07]   N@styTiger-Lisa   [ASSAULT SOUTH] yes
[05/05/2014 01:09:40]   gunna'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:09:54]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:00]   gunna'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:02]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:07]   gunna'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:07]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:10:09]   monster'6s   [ASSAULT SOUTH] yes
[05/05/2014 01:12:36]   Far_Side   [ASSAULT SOUTH] why do people always gotta F u c k it up
[05/05/2014 01:12:40]   [SWISS]t3ddy   [ASSAULT NORTH] good way to empty the server I guess...
Title: Re: mapvote
Post by: Ganja on Wednesday, June 25, 2014, 02:42:46 AM
About the map list being too big, perhaps you can split it up in different kind of maps so it would fit?

Like SF maps, lng range etc etc
Title: Re: mapvote
Post by: [SWISS]Merlin on Wednesday, June 25, 2014, 04:13:25 AM
map voting at all has a problem.

you as a player can say mapvote xxx  while doing so and if you do it again while the voting process is ongoing, you will "destroy" the whole mapvote process until a new restart of the server is done.
it will not work anymore, thats a fact. you can try that on the swiss servers (maybe there are different vesions about mapvote, don't know - but doing this above will NOT change the map at all)

edit:
and for the maplist: i think a solution could be to show it up at aao25.com - maplist - mapsnames to vote for (i do have it already, i will send the link if needed)
Title: Re: mapvote
Post by: teddy_grizzly_bear on Wednesday, June 25, 2014, 04:55:56 AM
I looked at the code and to me it seems like it's only checking if the player's name matches the first one in the array Voters (on the 0th position). While I'm not really familiar with the syntax, there doesn't seem to be a loop that would force it to check all names in Voters. It checks the 0th position and then adds 1 to i, but doesn't repeat the check with the next position.
Title: Re: mapvote
Post by: ELiZ on Wednesday, June 25, 2014, 08:49:51 AM
I looked at the code and to me it seems like it's only checking if the player's name matches the first one in the array Voters (on the 0th position). While I'm not really familiar with the syntax, there doesn't seem to be a loop that would force it to check all names in Voters. It checks the 0th position and then adds 1 to i, but doesn't repeat the check with the next position.

Look like you are right.

Current version of the mapvote mod was based of a decompile of the original mod.

A correct version would be:
Code: [Select]
function bool CheckCanVote (string PlayerName)
{
local int i;

for( i=0; i< Voters.Length; i++ )
{
if ( PlayerName == Voters[i] )
{
return False;
}
}
return True;
}
Title: Re: mapvote
Post by: teddy_grizzly_bear on Wednesday, June 25, 2014, 09:09:32 AM
Yay! I was good for something! :D
Title: Re: mapvote
Post by: [SWISS]Merlin on Wednesday, June 25, 2014, 09:10:47 AM
nice!
ELiZ, is there any way to correct that?
would be great...
Title: Re: mapvote
Post by: Ganja on Wednesday, June 25, 2014, 11:26:16 AM
He just did, didn't he?
Title: Re: mapvote
Post by: teddy_grizzly_bear on Wednesday, June 25, 2014, 12:33:54 PM
He just did, didn't he?
He's yet to implement it into the game I believe, but in general, the bug should be fixed by what ELiZ wrote.

But the part where you're allowed to start another mapvote while one is already under way, would need some additional work.
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Wednesday, June 25, 2014, 12:52:30 PM
The source I have is
Code: [Select]
function bool CheckCanVote (string PlayerName)
{
local int i;

For(I=0;I<Voters.Length;I++)
        {
if ( PlayerName ~= Voters[i] )
{
return False;
}
}
return True;
}
I never noticed Eliz's version.

As for the map list, have an int array for the page #  that matches up with the player's name, catch in BroadcastText a keyword like !maplist or something, and each time it catches it from the player increment the page # and reset it to zero when it goes over
so, say there are 80 maps, it'd be 4 pages of 20 lines.  Each time a player submitted !maplist the page# variable would increment until >3 then =0 again.  You would display only 20 lines each time.

I'm not sure why they even need mutate in the first place.  Just catch it all through BroadcastText using the say command.  Say !mapvote.  Say !maplist.
If you want, I can come up with a version that does this.
Title: Re: mapvote
Post by: [SWISS]Merlin on Thursday, June 26, 2014, 08:31:38 AM
can you send me this version please, i would like to check if the other things do work fine.
would be great

btw: i would love to have that modified, but let's hear that from ELiZ
Title: Re: mapvote
Post by: ELiZ on Thursday, June 26, 2014, 08:56:33 AM
A fix for the "yes" problem is easy to implement .
A fix for interrupting a previous vote should also be easy to implement.

The problem is that to implement a new version of Mapvote, then we'll have to release a completely new Client/Server Version of the Assist Software. At this moment I'm not ready to do that for this small change.
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Friday, June 27, 2014, 01:13:02 AM
OK well I offered.  I'm guessing you used tcplink in order to get the map list.  The ini and PerObjectConfig options seem to want class conforming sections that tours.ini can't give.
The code I have from Crusade for determining the vote in progress is that it relies on the var bool balreadymapvote, which is checked against or set in the StartMapVote() function, set to False in the ChangeMap() and CancelMapVote() functions.
Title: Re: mapvote
Post by: Spanky on Friday, June 27, 2014, 17:11:46 PM
Shad, there's nothing stopping you from building a better version. Hell, I think everybody here would encourage you do to so. The only limiting thing is the effort/reward for updating the Assist client. I'm sure if you make a new version that it will be implemented when ELiZ feels it's worthwhile to do so.
Title: Re: mapvote
Post by: ELiZ on Saturday, June 28, 2014, 10:59:36 AM
OK well I offered.  I'm guessing you used tcplink in order to get the map list. 

No, I'm using Tours.ini

Code: [Select]
function LoadMaps()
{
local int iNumTours;
local int iNumMissions;
local int iTour;
local int iMission;
iNumTours=GetPrivateProfileInt(GetBaseDir() $ "Tours.ini","Tours","NumTours");
for (iTour=0; (iTour < iNumTours);  iTour++)
{
iNumMissions=Level.GetTourMissions(iTour);
for (iMission=0; iMission<iNumMissions; iMission++)
{
if(Level.GetTourIsTraining(iTour)==False)
{
AvailableMaps[AvailableMaps.length]=Level.GetTourMissionText(iTour,iMission);
}
}
}
}
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Saturday, July 05, 2014, 20:15:09 PM
I had a few hours to kill today, so I took Spanky up on his challenge.  I hope I didn't waste time.
(https://aao25.com/forum/proxy.php?request=http%3A%2F%2Fshartley.net%2Fpictures%2Fmapvote1.jpg&hash=d703737e3996613f4707608d04046e6c)(https://aao25.com/forum/proxy.php?request=http%3A%2F%2Fshartley.net%2Fpictures%2Fmapvote3.jpg&hash=5ccfddac052edc0858d5604c8cc25038)(https://aao25.com/forum/proxy.php?request=http%3A%2F%2Fshartley.net%2Fpictures%2Fmapvote6.jpg&hash=f526f95bdc93bc1ab698d1d4e1c6640e)

Changes:
I completely nearly rewrote mapvote
Players can say !mapvote or !maplist instead of the mutator thing.  !mapvote takes a map name or number (from the !maplist showing)
I think Crusader did the mutate command to deal with the stopping the ut2004 SetTimer() function or it was a part of his Ultimate mod package
Players can say !maplist to get a list of maps.  Every time they say !maplist, it gives another page of maps (used with extended console),
each numbered and can be used with !mapvote
Map names are properly checked.  I didn't have a compiled object.u that supports GetPrivateProfileInt() and GetBaseDir() so I just rewrote LoadMaps() to parse tours.ini with an available FOPen() command.
Training maps and the current loaded map are excluded from the list
Players are better informed as to the mapvote progress and which map
Takes at least two players to switch maps, but majority otherwise
Broadcast to the players and sender are different colors
Advertises/broadcasts the mapvote availability every 60 seconds
The player asking for the vote can cancel the vote with "Say !cancel"
Tracks all players vote, tells them they've already voted if they try again, and clears votes after the mapvote has ended. 
If a player leaves the server and comes back, it shouldn't make a difference for a vote in progress
Added an .ini to add a few configurable things in

Needed:  Not absolutely needed, but an event function to detect when a player joins or leaves the server. 
I don't have access to native headers so a uscript event function would be nice. 
AAO seems to do it differently than Unreal and I haven't been successful with the Login/PostLogin and similar events

Since it's an unauthorized mod for testing purposes:
Submitted as "testmapvote.u", add "ServerActors=testmapvote.main" to the [Engine.GameEngine] if you want to test it out.
Can use "say !debug" to dump some state info into log when you need to
PM me for the source
Get testmapvote.u here (http://shartley.net/files/testmapvote.zip)
PM me for the source code
I have a sister non-debug version as mapvote.u as well
You can try it out on server 82nd ABD Dallas #4 MapVote PickAWeap
An optional .ini can be used for a few more options by admins, but doesn't have to be distributed
Code: [Select]
[testmapvote.main]
; How often to spam "Say !mapvote..." in the console.  Doesn't display during a vote.  Default is 60 without this .ini
advertiseSecs=60

[testmapvote.testmapvote]
; Maximum times a player can ask for a mapvote.  Set to 0 to disable.  0 is default without this .ini
MaxVoteStarts=0
;    Colors: 0=white 1=yellow 2=green 3=dark blue 4=cyan 5=purple 6=light blue 7=pink 8=magenta 9=red
;    personal message, map list...ect.  Default is 8 without this .ini
MsgColor1=8
;    broadcast, asked for a mapvote, mapvote running... ect.  Default is 1 without this .ini
MsgColor2=1
Title: Re: mapvote
Post by: Spanky on Saturday, July 05, 2014, 23:54:22 PM
Fantastic, excellent work. I wish this project had more people like you Shad. Don't get me wrong, ELiZ is the best thing to happen to this project since Jonny started it but he's a busy guy. If there was a dozen or so serious and knowledgeable devs like you, this project would be epic.
Title: Re: mapvote
Post by: ArmyAntiCheat on Sunday, July 06, 2014, 06:53:08 AM
Nice work shad!:)
Title: Re: mapvote
Post by: bollie on Sunday, July 06, 2014, 10:57:50 AM
Great work!

Sadly I know nothing about programming and stuff like that... if I could, I wanted to help...
Title: Re: mapvote
Post by: [SWISS]Merlin on Monday, July 07, 2014, 08:48:13 AM
thanks so much, good job!!
Title: Re: mapvote
Post by: [SWISS]Merlin on Saturday, July 12, 2014, 10:43:01 AM
but now it would be nice to have that implemented :)
i did try this, but my server do crash because of the checks about mapvote.u
Title: Re: mapvote
Post by: teddy_grizzly_bear on Saturday, July 12, 2014, 16:48:10 PM
The problem is that to implement a new version of Mapvote, then we'll have to release a completely new Client/Server Version of the Assist Software. At this moment I'm not ready to do that for this small change.
Title: Re: mapvote
Post by: [SWISS]Merlin on Saturday, July 12, 2014, 18:08:35 PM
thank you teddy, I know that.
maybe with a version without trainings its worth :)
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Sunday, July 13, 2014, 14:08:34 PM
at least for a non-honor server you can try it out by getting testmapvote.zip (http://shartley.net/files/testmapvote.zip) and install it as a non-honor mod.  Put testmapvote.u in your System folder and add
Code: [Select]
ServerActors=testmapvote.main to [Engine.GameEngine] section of your aa25srv.ini (and System/server/aa25srv.ini)

The mapvote.u that comes with testmapvote.zip is only meant for Eliz, should he decide to code in checking for it.

It'd probably be easier just to hop on the '82nd ABD Dallas #4 MapVote PickAWeap' server if you just wanted to test it out.
Title: Re: mapvote
Post by: [SWISS]Merlin on Sunday, July 13, 2014, 16:03:20 PM
thanks shad
i will try that. my fault was to set not testmapvote.main - I did set testmapvote.u
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Monday, July 14, 2014, 04:20:37 AM
testmapvote.zip (http://shartley.net/files/testmapvote.zip) Was updated yesterday to correct a problem tracking votes.
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Tuesday, August 12, 2014, 19:49:25 PM
did mapvote get included in the last update?
Title: Re: mapvote
Post by: ELiZ on Tuesday, August 12, 2014, 20:03:30 PM
did mapvote get included in the last update?

No sorry, when I decided to update the version, it was because of the error that caused all windows servers to stop functioning. So I was pressed for time, to get the update out as soon as possible.

When it comes to a new/updated mapvote, the only way that that could happen is if you provide the source, then I'll compile the u-file. You might have added source to one of the provided files, but I could not recall that I've seen it. Since I was pressed for time this morning, I had to skip it.

I have planned in a week or so a new version update, and the mapvote could be included in that.
One of the issues I plan to address in the update is how servers handle server files, hopefully I can get something like the autoupdate I got when a file should be updated on all Clients AND Servers, but just for Server files, and the corresponding ini changes needed.
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Tuesday, August 12, 2014, 21:59:36 PM
Sent you a PM with the source.
Title: Re: mapvote
Post by: ELiZ on Wednesday, August 13, 2014, 17:03:17 PM
Here is the version that will be used in the next version of Assist.
I've compiled with our SDK, and stripped source.

https://www.dropbox.com/s/t41s7owa9nlokmw/mapvote.u (https://www.dropbox.com/s/t41s7owa9nlokmw/mapvote.u)
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Sunday, October 12, 2014, 10:34:46 AM
mapvote updated to 1.2 for Assist 8.15 to just use keywords mapvote and maplist by default.
If you want them to be something different, use the following mapvote.ini file in your  System\Server folder:
Code: [Select]
[mapvote.main]
; How often to spam "Say !mapvote..." in the console.  Doesn't display during a vote.  Default is 60 without this .ini
AdvertiseSecs=60

[mapvote.mapvote]
; Maximum times a player can ask for a mapvote.  Set to 0 to disable.  0 is default without this .ini
MaxVoteStarts=0
; Colors: 0=white 1=yellow 2=green 3=dark blue 4=cyan 5=purple 6=light blue 7=pink 8=magenta 9=red
; personal message, map list...ect.  Default is 8 without this .ini
MsgColor1=8
; broadcast, asked for a mapvote, mapvote running... ect.  Default is 1 without this .ini
MsgColor2=1
; mapvote command.  Default is "mapvote"
Command1=mapvote
; mission list command.  Default is "maplist"
Command2=maplist
You'll need to wait on Eliz to release v8.15
Title: Re: mapvote
Post by: [SWISS]Merlin on Sunday, October 12, 2014, 18:06:06 PM
thank you!
Title: Re: mapvote
Post by: 82nd_DXO_COL=Shad on Wednesday, July 22, 2015, 20:50:56 PM
mapvote updated to 1.3 pending the next assist update
Ver 1.3
Changes:
-ini:  Added VoteRestSecs to allow timeout period between mapvotes per voter to discourage preventing others from starting a map vote
-ini:  Added Agree variable to allow custom vote agreement keyword (default is "yes")
-ini:  Added EchoCommand to allow/disallow global repeat of mapvote/maplist commands.  Turn off for less noise, turn on so others can see
how the commands are being used
-fix:  maplist command respects ini EchoCommand now instead of always repeating
-added support for timeout period per player between starting map votes
-various bug fixes and spelling corrections

(https://aao25.com/forum/proxy.php?request=http%3A%2F%2Fshartley.net%2Fpictures%2Fmapvote13.jpg&hash=65f30390542dd715a39da1dd52436d7b)

Instructions:
aa25.ini:
mapvote=1

aa25srv.ini in System and System/server is automatically created by assist and should contain:
ServerActors=mapvote.main
in the
[Engine.GameEngine]
section

configure to your liking
mapvote.ini
Code: [Select]
;mapvote ver 1.3 Original by -{DG}- Crusade, reworked by Shad for Assist
[mapvote.main]
; How often to advertise "Say mapvote..." in the console.  Doesn't display during a vote.  Default (minimum) is 60 without this .ini
AdvertiseSecs=120

[mapvote.mapvote]
; Everyone can see usage of commands (mapvote, maplist).  Can be too much noise and turned off, or left on to educate others on what to do
; 0 to disable, 1 to enable.  0 is default without this .ini
EchoCommands=0
; Maximum times a player can ask for a mapvote.  Set to 0 to disable.  0 is default without this .ini
MaxVoteStarts=10
; Rest period between starting a map vote in seconds.  Set to 0 to disable.  0 is the default without this .ini max is 600
VoteRestSecs=30
; Colors: 0=white 1=yellow 2=green 3=dark blue 4=cyan 5=purple 6=light blue 7=pink 8=magenta 9=red
; personal message, map list...ect.  Default is 8 without this .ini
MsgColor1=8
; broadcast, asked for a mapvote, mapvote running... ect.  Default is 1 without this .ini
MsgColor2=1
; mapvote command.  Default is "mapvote"
Command1=mapvote
; mission list command.  Default is "maplist"
Command2=maplist
; agreement keyword
Agree=yes
Title: Re: mapvote
Post by: ELiZ on Thursday, July 23, 2015, 00:20:58 AM
I'll add it to the next update.