Xonotic Forums
Help with Client for Machine Learning - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10)
+--- Forum: Xonotic - Development (https://forums.xonotic.org/forumdisplay.php?fid=12)
+--- Thread: Help with Client for Machine Learning (/showthread.php?tid=8029)



Help with Client for Machine Learning - QuakingInFearOfQuakeC - 04-09-2019

I'm working on a project where I'm training a bot to play this game and I'm trying to make a version of the client that exposes the game state information and controls and let's me communicate with my training files in python. For that last part, I'll planning on trying to use SWIG, since that works for C.
That being said, I've been having a hard time understanding the code structure enough to get that done. Can someone point me in the direction of where the client and server communicate? 
I briefly looked into xrcon but the console commands that the server supports didn't seem enough to spoof a player and all that. It seems like what I want is to have the client console exposed, since there are commands to connect to the server, press buttons, and lookup environment information, etc. Is there an easy way to run a headless mode of the game with access to the console?
Any help would be appreciated, thanks!


RE: Help with Client for Machine Learning - BuddyFriendGuy - 04-17-2019

I like the enthusiasm here -- our bots can use some intelligence (in addition to perfect aiming) in strategy.

However, this sounds very difficult. If this is a dissertation/thesis/term project, then you probably want to evaluate the time feasibility. However, if this is a pet project, then go for it!

I don't have much answer for you, but here are some food for thought:

Sending out commands to console is not fast enough, especially with Python.

Perhaps you can study how demo files are recorded and parsed back, and see whether you can inject your own function there.

Are you training your machine to beat the current bots? I'm not sure our bots are deterministic. You may need to collect humongous amount of data to start. Let alone the complexity of the nature of the game -- I can't imagine how wide your feature set could be.

What's your cost function? Final total score? Survival? Damage caused? Damage taken? This gets tricky quickly:
  • For example, for survival, perhaps you just need to find a spot where the other bots won't see you, and stay there until the game ends. Does that count?
  • For scores, just make your bot a super aim bot. I believe our current bots don't have perfect aims.
  • Does your bot listen for the direction of footsteps (and other enemy sounds) and then shoot perfectly?
That said, I think there are many interesting smaller scoped problems, even without the complexity of enemies.  For example, could your machine look at a map, and figure out how to travel around in it, making use of jumpads, teleporters, etc.? If so, we can either automatically calculate waypoints, or even implement your AI model.

Best of luck!