[Tool] Wargame Automatation Script

deserteagle
Corporal
Posts: 24
Joined: Thu 18 Sep 2014 21:33
Contact:

[Tool] Wargame Automatation Script

Postby deserteagle » Wed 7 Oct 2015 22:37

Wargame Automation Script

Overview

- Hello, I want to present you a script, that I have been working on for quite some time. It is essentially a server log parser, that can react on pre-determined events automatically. Originally, inspired by naizarak's deck change script (big thanks to him) and my willingness to learn python, the script made a long way from deck changing to general purpose automation.

Application

  • Enforcing specific custom deck to players (thematic matches)
  • Limiting min/max allowed player level on the server
  • Server map autorotation
and more

Usage

  • Place it into your wargame server folder
  • Setup rcon access settings
  • Run the script

Workflow

  • User operates, depending on the information about current state of the game (gamestate var), players information (players dictionary, keys - player id) and information of event happened (handler function arguments)
  • User reacts with rcon commands via Rcon.execute()
  • Several rcon commands are incapsulated in Player class, so user can just call player.change_deck() or player.kick()
  • Methods, that perform rcon operations are called change* to differ from setters
  • User code intended to be placed in functions in "Custom actions" section and be called from callbacks in "User event handlers" section.

Script already contains example functions on how to handle events
The script requires python 3
Would like to hear your feedback on this.

Script is available on Github https://github.com/desert5/wargame-serv ... l/releases

User avatar
Shifu
Lieutenant General
Posts: 4106
Joined: Wed 13 Jul 2011 16:06
Location: :noitacoL
Contact:

Re: [Tool] Wargame Automatation Script

Postby Shifu » Thu 8 Oct 2015 17:01

Nice, will take a close look as soon as I have more time ..

Sticky.
I'm currently running short on time. Hence, it takes some time until I respond. In urgent cases, consider contacting another mod.
Forum rules | A Forum's guide. | Tech Support Posting instructions & Tech FAQ

kassad
Corporal
Posts: 24
Joined: Thu 20 Mar 2014 19:04
Contact:

Re: [Tool] Wargame Automatation Script

Postby kassad » Tue 12 Apr 2016 00:44

You have done a truly amazing job. I would suggest some improvements. Let this script reads the data from a separate configuration file in which the syntax will have a clear and readable form. For example:

------------------------------------------------------------------------------------------------
enable_lvl_limit = 1 #1-enable, 0 disable
lvl=10 #kick if level<lvl

enable_support_deck_limit = 1 #1-enable, 0-disable; per team
sd_limit = 2 #change to default deck for next player If he runs out of sd_limit

enable_air_deck_limit = 1 #1-enable, 0-disable; per team
aird_limit = 2 #change to default deck for next player If he runs out of aird_limit

enable_map_rotate = 1 #1-enable, 0-disable
maps = [map1;map2;map3…mapN]

ban_leavers_enable = 1 #1-enable, 0-disable; DONT KNOW THIS POSSIBLE ? Need some timer that is started after the start of the game.
time = 10 #minutes, ban if player leaved less than “time”
ban_time = 24 #hours
------------------------------------------------------------------------------------------------

Think what percentage of players able to run the server? And how many of those who are able to do so, understands the scripts? I think they can be counted on the fingers. I do not know Python too. I think you understand what to start learning python only for WRD server is not a rational decision.
Thanks.
Last edited by kassad on Wed 13 Apr 2016 14:55, edited 1 time in total.

MadMantiz
Master Sergeant
Posts: 179
Joined: Mon 5 Mar 2012 17:35
Location: Umeå
Contact:

Re: [Tool] Wargame Automatation Script

Postby MadMantiz » Tue 12 Apr 2016 21:08

Hi,

I have used this script on a few servers with good success (I hosted the air only server and some others). At first I did not understand how it worked as it seemed to do nothing upon starting, the key to success in my case was to understand that it is pre-configured to basically do nothing except map rotation at the end of match. Other script events (such as level limitations) has to be activated (by editing the file).

The ban leavers would certainly be doable, script should just start an internal timer at the beginning of the match, and anyone leaving within the set timeframe would be banned. It would work because the server gives both the information when the match starts and when someone disconnects. This is actually a great idea, even if I do not understand a lot of python, I think I could just be able to manage by trial and error. I will certainly try.

The most difficult job for a script of this type would probably be to limit the number of certain deck types allowed for a side. The reason for that is how it works by reacting to the server output, and the server does not output this information in clear text (only the deck code strings). In order to do a deck type limitation, the script needs a way to decode the deck strings on the fly to extract the deck type and then act accordingly to the set rules.

DarkRyder
Corporal
Posts: 47
Joined: Fri 21 Nov 2014 17:20
Contact:

Re: [Tool] Wargame Automatation Script

Postby DarkRyder » Wed 13 Apr 2016 09:48

https://docs.google.com/spreadsheets/d/ ... sp=sharing

all nations follow same rules (first string is nation string, 2nd string is deck type), coalitions are a bit tricky

Nation:
1.char -nation
2.char -thematic constraint
3.char -date constraint // Q='85 A='80

Coalition:
1. and 2.nd char coaltion+thematic
3. char -date same as nation

kassad
Corporal
Posts: 24
Joined: Thu 20 Mar 2014 19:04
Contact:

Re: [Tool] Wargame Automatation Script

Postby kassad » Wed 13 Apr 2016 14:55

It is a pity that the last activity of the author on 10 October.

MadMantiz
Master Sergeant
Posts: 179
Joined: Mon 5 Mar 2012 17:35
Location: Umeå
Contact:

Re: [Tool] Wargame Automatation Script

Postby MadMantiz » Wed 13 Apr 2016 20:39

DarkRyder wrote:https://docs.google.com/spreadsheets/d/15Q3F4DOKdgjnkO--wKxWt3PMYaW59zsLdbblyr21T9o/edit?usp=sharing

all nations follow same rules (first string is nation string, 2nd string is deck type), coalitions are a bit tricky

Nation:
1.char -nation
2.char -thematic constraint
3.char -date constraint // Q='85 A='80

Coalition:
1. and 2.nd char coaltion+thematic
3. char -date same as nation


Thank you for that information, a lot of work put into that! Much appreciated.

It makes things a lot different in this case, it is exactly what is needed in order to implement a working automatic limitation of the number of a specific deck type. It can also be used to enforce specific nation limitations (such as only North vs South Korea or reject certain nations).

DarkRyder
Corporal
Posts: 47
Joined: Fri 21 Nov 2014 17:20
Contact:

Re: [Tool] Wargame Automatation Script

Postby DarkRyder » Thu 14 Apr 2016 00:41

F*ck it,
now i'm writing python script where you will be able:
1. Set number of specific decks (limit support) - Date of the deck i will not incorporate since you can set this via RCON tool
2. Set deck (or decks) to players during countdown (usful for specific game mods, like vietnam war -let's say you want to give americans 6 airborne decks 1 support deck and 3 mech. You can create and import your own decks.)
Problem with this is that people will get this decks random. In script you can see which player is redfor or bluefor but you cannot transfer this information via rcon to your rcon client (or can you, eugen?)
3. Set min and/or max player level
4. Randomise team during countdown process
5. Map rotation
6. make text file where you can configure all the options (text file will be updateted manually or with rcon commands)


Script will be able to listen to screen, and send commands to screen. Also you will be able to control this script with your RCON client (since script will read screen), i will publish all the commands here... and i will expand my rcon tool with this options.
Any other idea?

BTW. I had this idea for rcon client to select which players will be in which team once countdown starts, somting like player list and drag+drop to bluefor or redfor, and then server executes your choices during countdown. I could implement this also with this script.
We all know how hard is to find 10vs10 games as a team if you have good stats. With this one team could be in redfor and bluefor.. and when game is about to start server would sort all of them into one team. There was discussion to make "whitelist" player list and always force them to the same team.
I did discuss this with my teammates, and they were ecstatic abot this. We could 'ambush' players, they would see two balanced teams and stay on the server, not leave after they see stats of the enemy team.
But.... it would be very very bitchy move toward rest of the players, your comments on this?

P.S. sorry for bad english, and the/a, we don't have this in my language

MadMantiz
Master Sergeant
Posts: 179
Joined: Mon 5 Mar 2012 17:35
Location: Umeå
Contact:

Re: [Tool] Wargame Automatation Script

Postby MadMantiz » Thu 14 Apr 2016 08:06

DarkRyder wrote:F*ck it,
now i'm writing python script where you will be able:
1. Set number of specific decks (limit support) - Date of the deck i will not incorporate since you can set this via RCON tool
2. Set deck (or decks) to players during countdown (usful for specific game mods, like vietnam war -let's say you want to give americans 6 airborne decks 1 support deck and 3 mech. You can create and import your own decks.)
Problem with this is that people will get this decks random. In script you can see which player is redfor or bluefor but you cannot transfer this information via rcon to your rcon client (or can you, eugen?)
3. Set min and/or max player level
4. Randomise team during countdown process
5. Map rotation
6. make text file where you can configure all the options (text file will be updateted manually or with rcon commands)


Script will be able to listen to screen, and send commands to screen. Also you will be able to control this script with your RCON client (since script will read screen), i will publish all the commands here... and i will expand my rcon tool with this options.
Any other idea?

BTW. I had this idea for rcon client to select which players will be in which team once countdown starts, somting like player list and drag+drop to bluefor or redfor, and then server executes your choices during countdown. I could implement this also with this script.
We all know how hard is to find 10vs10 games as a team if you have good stats. With this one team could be in redfor and bluefor.. and when game is about to start server would sort all of them into one team. There was discussion to make "whitelist" player list and always force them to the same team.
I did discuss this with my teammates, and they were ecstatic abot this. We could 'ambush' players, they would see two balanced teams and stay on the server, not leave after they see stats of the enemy team.
But.... it would be very very bitchy move toward rest of the players, your comments on this?

P.S. sorry for bad english, and the/a, we don't have this in my language


Very nice ideas. I was in the mood of starting something similar too, since the majority of the work is already done by Deserteagle (been running his script a lot, since map rotation min/max level is already there). But if your solution is planned in the very near future, I will not spend the time inventing something already in the works.

With regards to point 4, I can understand the intention and I support the idea of random teams, but bear in mind that when you force a player side change in the last second, it will also change their decks to whatever they last had active on that side and they will have no time to react to it and change to something they want to use (in case they want to play the other side at all if they end up being switched).

The idea to have hidden teams preset to be revealed and set at game start will also share the same issue regarding decks. It is possible to be prepared and counter the issue if you make sure you have the right deck set on the other side, but for anyone unaware, it will be a less pleasant experience. I would leave immediately, which I figure a lot of other players would too.

You might be able to lure some people into a 10vs10, believing they will have a fair and randomized game, but end up in a stompstacked lobby without knowing. I guess those games will most of the time be rather one-sided and basically a waste of time for all parts, but some people might find amusement from it so why not. Some hosts kick the other team when they are losing, I guess each win is a win...

DarkRyder
Corporal
Posts: 47
Joined: Fri 21 Nov 2014 17:20
Contact:

Re: [Tool] Wargame Automatation Script

Postby DarkRyder » Thu 14 Apr 2016 14:07

You don't have to do it in the last second. This is why you have option for countdown.. you cannot change decks last 10 sec (i think). But you can put 40 sec countdown and put in the server name that server will randomise teams.

If server is full (min player reached) it will randomise the lobby. You cannot swith team after that since teams will be full, if someone leaves and another person joins it will randomise once more.

This is how it would go: let's say you have 10vs10 game
when 20 players join the server, it will change state -> countdown of 40 sec (or whatever) will start.
script will send command:

setsvar MaxTeamSize 20
setsvar DeltaMaxTeamSize 20


then foreach player it will go in the loop of assigning random value of 0 or 1 (0= bluefor, 1=redfor) until NbMinPlayer / 2 is reached, rest of the players will get 0 or 1 depends on which team reached threshold first.
setpvar [id] PlayerAlliance 0 or 1 will be part of the loop

again sends commands
setsvar MaxTeamSize 10
setsvar DeltaMaxTeamSize 10


now we will wait for 1 second and repeat foreach but only
setpvar [id] PlayerAlliance 0 or 1

if some smartass maneges to switch side during first foreach process.

I think that this together with option on max player level (let's say we put max player level = 10 on one server)
will give very much needed noob friendly server.
Hell with your deck (custom generic bluefor and generic redfor) and max player level limit you could make very friendly noob server where they don't need their own decks.


About team stack i agree. This is why i will not do it.

I think i will do it in next 5 to 7 days. i have my job and other stuff i have to do, cannot code all night. Another 2 or 3 days to put all of this into rcon client.
Testing and bug fixing will be harder.

I have one open question for eugen, is there any way to brodcast message to server lobby?

Shifu?

EDIT: i just had an idea that we should have ability to set custom income rate for each map in rotation list. Some maps are small and require high or very high income rate, while other are larger or huge (10vs10) where we would need smaller income rate.

Who is online

Users browsing this forum: No registered users and 1 guest