Topic: Yet another bot in teeworlds
Hi all,
I'm working on making a bot for teeworlds.
It's not a aimbot but 100% computer controlled.
The code is based on teeworlds 0.6.3 client source. I removed graphics to run it on a server side. Thus the bot uses 2% cpu on average.
Basically, the bot has two modes : fight and idle.
On map load, the bot computes a simplified map by homotopic thinning of air tiles.
Example with cft5: http://pastebin.com/cxTs0Z4R
Crossing points are marked as waypoints.
When idle, the bot tries to follow path between two consecutive waypoints. At a waypoints, the bot choose randomly the next path to follow.
To follow a path, the bot uses jump and hook.
The bot grab the flag when it sees it. However it still does random moves so it can hardly capture the flag.
It enters fight mode when a enemy enter in a line of sight and is in idle mode otherwise. If there are many enemies, it takes the closest one.
If the flagcarrier is in hookrange, he becomes the new target enemy.
When in fighting mode, the bot tries to get close to the enemy and uses all the weapon it have from laser to hammer, choosing according to the distance. The bot does not care of other tees (except the flag carrier if in ctf).
About aim, at the moment, the bot assumes that target tee are not moving. Thus grenade are not really accurate.
When the target is in hookrange, the bot hooks in his direction regardless of other tees.
I run the bot on my server (search "Random" or "bot()") if you wanna test it. 163.172.95.239:8303)
I add autorejoin when kick/ban/spectator since the server run for the bot.
There is many things to do such as :
- route planning (on whole map and not locally)
- weapons/armor/heart pickup
- grenade boost/jump
- dead-end (the bot tries to go on the top on ctf5 from the main level)
- startegy on ctf: defence, attack (or trolling when winning)
- difficulty parameters
- …
Please, leave some feedback
PS: i m doing this for fun, because i never did bot or ai before and i like teeworlds and i miss bot|royale. The bots may have some interest in the future for training (a running tee to train aiming for example).
Updates
Wish list/suggestions/Ideas:
- auto leave when server is full (-> priority for human player)
- leaves when no player and joins when >0 player
- communication between bots (=> strategy)
- server mod (?)
- running/evading bot
13-09-2015
------------------------------------
- some stuff i forgot
- the server run on 195.154.80.148:8303
27-07-2015
------------------------------------
- Clean client.cpp using config file to connect a server
- Add command to add messages in config file
------------------------------------
25-06-2015
Changelog:
- Fix segfault on dm type
- Add Econ
------------------------------------
14-06-2015
Changelog:
- Chat every ~5min
------------------------------------
05-06-2015
Changelog:
- Occasional rocket jump
- Random weapons pickup
------------------------------------
03-06-2015
Changelog:
- Higher ping (5 -> 20)
- don't vote yes for ban/move to spectator
------------------------------------
28-05-2015
Changelog:
- Add random deviation on fire
- don't ignore enemy in hook range when carrying the flag
------------------------------------
26-05-2015
Changelog:
- Pathfinding on the whole map
- Go to the enemy flag if at stand and go to its flag stand if has the enemy flag
- Don't follow enemy when carrying the flag
Technical:
- a graph is made from the homotopic thinning with vertex (waypoints) and edges.
- pathfinding is only done between two waypoints
- the graph don't handle multi edge yet
Issue:
- following long path can imply big cpu usage, thus the algorithm is not fitted with complex map (standard maps are fine)
- when carrying the flag, the bot fires in wrong direction.
- try to take impossible way without rocket jump (or skill, depends ) (ctf5)
Well, at this point, the bot is competitive on ctf1/2/7, i did not try (or get feedback) on ctf3/4
ctf5 is still too open for it.
ctf6 has death tile that i don't handle properly.
Edit: server changes IP