New Difficulty mode

For AI and campaign script related discussions and questions
jh0242
Rookie
Rookie
Posts: 18
Joined: 18 Apr 2013, 15:41

New Difficulty mode

Post by jh0242 »

Hello everyone,

I am currently looking into developing a dynamic difficulty adjustment strategy in Warzone 2100. That is, a difficulty that adjusts to a players skill level while the player is playing the game and saving that state for future games. Rather than wading through the code aimlessly, could anyone give me a good starting point, such as where the Droids are initiallized or scripts that hold damage, health, etc. Any and all input is greatly appreciated and I apologize if I am in the wrong forum section.

jh0242
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New Difficulty mode

Post by Per »

For campaign?

I'd guess the non-ini droid loading function used by campaign in src/game.cpp would be the right place for that...
jh0242
Rookie
Rookie
Posts: 18
Joined: 18 Apr 2013, 15:41

Re: New Difficulty mode

Post by jh0242 »

I would like the difficulty to apply to campaign and bots in skirmishes. Basically I will take data such as user overall damage and ai overall damage, number of units, health, etc. and use an algorithm to lower or raise the stats of the ai to meet the player's skill level. Basically I need to know where the enemy units are created at (which file) when the player creates them in game and how the unit's stats (damage, health, etc.) are assigned. Are constant variables used? Where are those variables? Where are those variables used? Any and all information is greatly appreciated.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New Difficulty mode

Post by Per »

Starting reading src/droid.cpp

I'm not sure this is a good idea, though... People like knowing what they are playing against. "I beat the AI on hard", sounds a lot better than, "I beat the AI again today, and it is probably a bit harder than last time but I have no idea what has changed."
jh0242
Rookie
Rookie
Posts: 18
Joined: 18 Apr 2013, 15:41

Re: New Difficulty mode

Post by jh0242 »

I will add statistics demonstrating comparisons, maybe by percent or z-score, on how much more difficult or less difficult the AI, basically providing a way to gauge your own skill level.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: New Difficulty mode

Post by NoQ »

Well, if only a computer had a way to figure out how well does a human play, i would have had much easier time writing AIs XD
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: New Difficulty mode

Post by aubergine »

Allowing AIs to persist data across multiple games would be super-useful for adaptation. Maybe something for 3.2 branch?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: New Difficulty mode

Post by NoQ »

Or even for manual teaching (like understanding a chat message of "hey, please try to remember to build defenses around this spot next time").
Not sure how exactly i really want it to be implemented.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New Difficulty mode

Post by Per »

A simple key:value table stored persistently for each script-name? (Like we have a log file for each script-name now.)
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: New Difficulty mode

Post by aubergine »

Possibly, but IMHO a JSON formatted file might be nicer (particularly for easy viewing / debugging).
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
jh0242
Rookie
Rookie
Posts: 18
Joined: 18 Apr 2013, 15:41

Re: New Difficulty mode

Post by jh0242 »

Which files contain the code for creating new cyborgs or tanks when the user clicks to create them?
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: New Difficulty mode

Post by aubergine »

@jh0242 - the .txt or .ini files (depending on wz version), often under the stats folder. Eg. body.txt / body.ini defines the tank and vtol bodies. There's some info under the Development tab (top of this page) about the stats files.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
jh0242
Rookie
Rookie
Posts: 18
Joined: 18 Apr 2013, 15:41

Re: New Difficulty mode

Post by jh0242 »

I meant in the src folder, which .cpp or .h file/s. But that information is helpful as well, thank you aubergine.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New Difficulty mode

Post by Per »

jh0242 wrote:Rather than wading through the code aimlessly
If you are going to do this, you are going to have to wade through a lot of code. You start in droid.cpp and statsdef.h and trace everything from there. While I'd be happy to help with concrete questions, you will need to learn your way through the code base yourself. See it as a learning experience. Do not post multiple duplicate topics asking us to do all that work for you.
jh0242
Rookie
Rookie
Posts: 18
Joined: 18 Apr 2013, 15:41

Re: New Difficulty mode

Post by jh0242 »

I know that I am going to have to wade through the code and I am happy to do so. I have been reading through it and I feel as though I am starting to understand the structure. However, I am not sure where the units controlled by each player, including AI, are held. It seems to me that the loop.cpp file is where the game is being controlled, but where are the arrays (or other storage structure) of droids being held and acted on throughout the gameplay? If I can get that little bit of information, I feel I will have a great starting point. I am sorry for any confusion or misuse of posts and thank you for any help you can provide.
Post Reply