Randomize the map-list

Ask questions and share info about GunGame 5

Randomize the map-list

Postby Xzero » Mon Jul 27, 2009 8:56 pm

We currently run GG5 with the built in mapvote. I've set the source to maplist.txt - so I can edit that list to whatever maps I want the server to run, instead of deleting maps from the folder, etc.

Now with that being set, the vote system automatically lists it in the order I've typed them in the maplist.txt file. So everytime the vote comes up, the same map will be on the first option and everyone will 1-spam and re-cycle the same maps over and over. I've found a small, less effective solution, by setting gg_dont_show last_maps to 12, but once the 12 maps are cycled through, they will reappear on the top of the list.

Another problem is when players don't wish to play on a certain map because it's been overplayed, they will select 2 on the votelist. Surely after the game is over on the next map, the same map that was on 1 will appear on 1 once again. Eventually enough 1-spammers will lead to server into the map that no one really wanted.

My question leads to; is there a way to randomize the map list when the vote comes up?
Xzero

Recruit
Recruit
 
Posts: 4
Joined: Mon Jul 27, 2009 8:50 pm

Re: Randomize the map-list

Postby XE_ManUp » Tue Jul 28, 2009 1:38 am

In "gungame/included_addons/gg_map_vote/gg_map_vote.py" you will find the following lines:

   # Remove maps in the recent maps list
    for map in dict_addonVars['recentMaps']:
        if map in dict_addonVars['mapList'] and len(dict_addonVars['mapList']) > int(dict_variables['voteSize']):
            dict_addonVars['mapList'].remove(map)
   
    setVoteList()


You can add the following just above "setVoteList()":

   random.shuffle(dict_addonVars['mapList'])


The code will now look like this:

   # Remove maps in the recent maps list
    for map in dict_addonVars['recentMaps']:
        if map in dict_addonVars['mapList'] and len(dict_addonVars['mapList']) > int(dict_variables['voteSize']):
            dict_addonVars['mapList'].remove(map)
   
    random.shuffle(dict_addonVars['mapList'])
    setVoteList()


This will randomize the list prior to building the votelist, and create a random list that is not in the order that it is typed. ;)
XE_ManUp

Site Admin
Site Admin
 
Posts: 662
Joined: Sat Sep 06, 2008 3:36 am

Postby Xzero » Tue Jul 28, 2009 4:03 am

Ah thank you very much!
Xzero

Recruit
Recruit
 
Posts: 4
Joined: Mon Jul 27, 2009 8:50 pm

Postby Xzero » Tue Jul 28, 2009 8:12 pm

Hey sorry for double posting, but just so you guys can see this new post:

I've added that line, but the map votes still go in order as typed.

This is what I have in my gg_map_vote.py

   # Remove maps in the recent maps list
    for map in dict_addonVars['recentMaps']:
        if map in dict_addonVars['mapList'] and len(dict_addonVars['mapList']) > int(dict_variables['voteSize']):
            dict_addonVars['mapList'].remove(map)
   

    random.shuffle(dict_addonVars['mapList'])
    setVoteList()
Xzero

Recruit
Recruit
 
Posts: 4
Joined: Mon Jul 27, 2009 8:50 pm

Postby Xzero » Wed Aug 05, 2009 6:38 am

Bump? ;)

Even with the line, the map order would go like this:


First vote -
gg_map1
gg_map2
gg_map3
etc

Map goes to gg_map1

Second vote -
gg_map2
gg_map3
gg_map4
etc
Xzero

Recruit
Recruit
 
Posts: 4
Joined: Mon Jul 27, 2009 8:50 pm



Return to General Discussion

Who is online

Users browsing this forum: No registered users and 7 guests