English New Bot System - Testing Version Released

89 replies
Goto Page
To the start Previous 1 2 3 4 5 Next To the start
20.06.17 08:03:27 pm
Up
Zeik
User
Offline Off
@user Ortimh: It's true... I'll look for a solution now

But it's not so bad... you're not supposed to call new on an object. It would be a very rare mistake.

EDIT: You could create a copy of the Bot class and set its new key to nil, but you have to create that copy function by yourself...

EDIT2: Just realized there's a better solution, just add
Code:
1
new = 0
as an instance attribute.
edited 1×, last 20.06.17 08:36:51 pm
20.06.17 08:21:43 pm
Up
Hador
User
Offline Off
user Starkkz has written:
@user Pagyra: What would be actually fun is to train bots based on player actions via neural networks.


I have been thinking about solving the bot problem with ML for some time now and have discovered two main possibilities:
1. For a neural network to be trained on human actions you would need craploads of data. Basically, with current player numbers you would need to collect all data of all players playing on standard maps (mods and scripts could break the neural network), and still you would only have a bit that is average at best (but imagine the fun coding that).

2. Discard the neural network and let the bot figure it out all by itself with reinforcement learning. This would require setting out goals to learn one thing at a time do training would take a long time, but doesn't rely on player data.

This is however both rather utopian (think of the computation time involved, even the guys at Google DeepMind would groan), and, to my knowledge, beyond the current capabilities of Machine Learning.

In short: using ML to train bots is unrealistic but trying to could be fun, if you ask me
20.06.17 08:59:34 pm
Up
_Yank
User
Offline Off
@user Hador: I've also planned to do something like that some time ago! I even started writing a player recording script (prior to the analyzing and learning process) however due to the lack of time and maybe, motivation, I halted the project. I may give it a look again in a distant future.. I've also thought about discarding the neural network and let the bot decide what to do with training but then I realized that there's a limited amount resources (performance wise) and that it would take a lot of time to make it comparable or superior to CS2D's current A.I.

By the way, why do you think that human training wouldn't work ? It wouldn't need to be a "fully neural network" system. You could just write a partial/hybrid one, creating a default A.I. and improving it with human data.
Starting with an empty dataset for each server, as players would play on the server, their gameplay data (their behavior) at the various different times and parts of the map would be inserted into the dataset and analyzed. This process would determine if that data would be something to avoid or try imitate.

@user Ortimh: Your project seems promising! I'd love to use your A.I. on my servers! But, by the way, are you planning to make them be able to deal with buildings (for example, destroying an enemy turret wisely or heading back to dispensers when HP is depleted)
edited 3×, last 20.06.17 09:16:29 pm
20.06.17 09:17:48 pm
Up
Starkkz
Moderator
Offline Off
@user Ortimh: Sounds like you have interested people, you should open a repository and work on there.
lol
21.06.17 02:58:15 am
Up
Ortimh
User
Offline Off
@user Starkkz: I don't use repositories too often because well internet in here is bad.. real bad if you ask me. Another factor is I always change my code everytime I have time, and it's real tiring if I need to update it at that time.. but I'll look into it.
@user _Yank: Of course! It's part of the plans. Thanks for the kind words. It motivated me well.

I decided to use OOP with middleclass. It's fast but slow at class creations. But don't worry, I'll try my best as possible to avoid constant class creations on run-time. Currently class creations only happen when starting a server. For behavior tree, I use this but slightly modified for my using. Here's the code (real code) for the bots' behavior:
Code:
...
     self.behavior = Sequence{
          Bot.buy,
          Bot.look,
          Selector{
               Sequence{
                    Bot.findTarget,
                    Bot.hasTarget,
                    Bot.isTargetValid,
                    Bot.isTargetInRange,
                    Selector{
                         Sequence{
                              Bot.isInFreeline,
                              Bot.isTargetOnCorrectAngle,
                              Bot.attack
                         },
                         Bot.huntWhenNotInFreeline
                    }
               },
               Selector{
                    Selector{
                         Sequence{
                              Bot.isBombDefuseScenario,
                              Bot.hasBomb,
                              Bot.inBombPlantingArea,
                              Bot.plantBomb
                         }
                    },
                    Selector{
                         Sequence{
                              Bot.isBombDefuseScenario,
                              Bot.isBombPlanted,
                              Bot.goToBombPlantingArea
                         }
                    },
                    Sequence{
                         Bot.isBombDefuseScenario,
                         Bot.hasBomb,
                         Bot.goToBombPlantingArea
                    }
               }
          }
     }
...

It's still ugly and need some enhancements but it does its job. Currently it's doing good. But why only "good"? Because every second bot would stutter in a frame, so it's slighty unnoticable. I'll get down to it and see what's wrong with the implementation of the behavior tree.

Also buying is also up. It follows CS2D buying system but with a bit of spice poured to it. I reordered the buying steps to: equipment -> primary slot -> grenades -> secondary slot -> ammos -> switch weapon. It respects both cs2d lua cmd game's "bot_weapons" and "bot_skill". Highly skilled bots would always grenades, never buy secondary slot, and switch to knife at startround. Contrawise for the lowly skilled bots. Any ideas regarding to this area so the bots could be smarter at buying weapons?
I'm awesome ... and I really cookies
21.06.17 03:33:17 am
Up
Starkkz
Moderator
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module("ClassName")

ClassName = {}
ClassName.__index = ClassName

function ClassName:new(arg1, arg2, etc)
     
     local self = setmetatable( {}, ClassName )
     
     return self
     
end

function ClassName:getTer()
     return self.ter
end

function ClassName:setTer(ter)
     self.ter = ter
end

return ClassName


This is the simplest method I've used to create object oriented in Lua, so that I don't have to rely on libraries for that.
lol
21.06.17 03:50:03 am
Up
Ortimh
User
Offline Off
@user Starkkz: Thanks for the code but I already know how to create class-looking tables, but for the sake of simplicity and credibility for people that already the libraries for that particular area, I use a library. It doesn't really hurt, does it? It does its job wonderfully so I could focus more on the surface (AI stuff). Also my code would be prettier to see.
I'm awesome ... and I really cookies
21.06.17 05:55:40 am
Up
the bamboozle
User
Offline Off
Do something with the npc too, make them a bit like the bots.
IMG:http://i.imgur.com/25W0hbk.png
wow, such signature, much fabulous
21.06.17 09:51:37 am
Up
_Yank
User
Offline Off
@user the bamboozle: Unfortunately, NPCs aren't controllable with Lua unlike bots so this isn't possible.
21.06.17 11:03:07 am
Up
Mora_rus
User
Offline Off
You can make custom mobs via lua. Using imagehitzone, but projectiles wont hit them.

Would bots act more safety while have low hp?
S.T.A.L.K.E.R. - The Lost Land dev. https://discord.gg/aABCkHQ
21.06.17 12:05:31 pm
Up
Fraizeraust
Moderator
Offline Off
I totally agree the current AI system is not so consistent. Not saying that I blame user DC for it, indeed developing an AI system is hard however there are some flaws in the bot's behaviour which I find it just weird.

For the behaviour tree, you could create a list of main categories based on a handful of cases and situations such as Fight & Engage, Surviving, Communication and Teamwork, Understanding of a 2D Environment and Orientation and Decision Making.

For teamwork I was thinking about cooperation and fulfillness of objectives on Bomb & Plant mode. If a bot carries the bomb and plants it, other terrorist bots should hold the point of the bomb plant and counter-terrorist bots should cover the bot who's defusing the bomb. At the current AI system once the bot sees the bomb and defuses it, there's a 50% chance that the other bot, when he sees it, will going to defuse it too instead of protecting the bot who's already defusing the bomb
21.06.17 12:51:53 pm
Up
Ortimh
User
Offline Off
@user Mora_rus: Absolutely. It's part of the plans after all. (shit I didn't notice your post, my bad)

@user Fraizeraust: Sure, but it takes time to create a "tree" because there're a lot of cases that could happen in this game. And I'm aware of that problem and want to address that in the near future.

Also,
user Ortimh has written:
Any ideas regarding to this area so the bots could be smarter at buying weapons?
edited 1×, last 22.06.17 01:18:03 am
I'm awesome ... and I really cookies
21.06.17 01:49:58 pm
Up
TimeQuesT
User
Offline Off
Calculate the average money a team owns and let bots buy from classified sets. While a bot with good aim and motivation will buy a devastating rifle, a lower skilled bot might tend to buy MP's. Also the choice of buying kevlar on low money should depend on the bots skill.

You can also add some chance to make a high motivated bot to disfollow logical buying to simulate its feeling of superiority - might causing fatal outcome in teamplay.

Since, programming a bot to drop a weapon for a teammate (and making it pick the weapon up) is extra work, you might consider making it just transfer the money - causing the teammate to buy the weapon on it's own (of course for AI only!). : This situation is triggered whenever a bot is far away from average team money.
Muh
21.06.17 02:25:00 pm
Up
Ortimh
User
Offline Off
@user TimeQuesT: NICE. Love to see explanations like that. Well I'll look into the "drop and pick up" pattern. But is it a good choice for the bots to depend on team's average money?
I'm awesome ... and I really cookies
21.06.17 02:44:45 pm
Up
TimeQuesT
User
Offline Off
Maybe this can be determined on a bots coop level (like they have in cs:cz).
Muh
21.06.17 06:12:03 pm
Up
Ortimh
User
Offline Off
Finally the sound system is up! Thanks to user TimeQuesT for his beloved sound library, it really helps a lot. Don't worry, these sounds aren't classes, rather I use local table for a slight faster access:
Code:
...
local sounds = {}
...
function Sound.emit(...)
     sounds[#sounds + 1] = {...}
end
...

Sounds will be emitted on various occassions and weapon modes are taken into account. The maths done for the volumes and the likes are still kinda primitives but we could work on those later. Sounds are flushed every 100 ms. And after testing, sounds that were created by 2 bots were around 10 sounds (only moving) every 100 ms. From that we can assume that there'd be ~5 sounds each frame that'd be processed by a single bot. I'll dig more into it later on.

Now the tree is huge and I'm still far away from completion. I kinda worry about performance if the tree is this huge. You can see the tree inside the spoiler.
Spoiler >

There're problems here and there as well, but I'll fix them ASAP.
I'm awesome ... and I really cookies
21.06.17 08:39:56 pm
Up
Avo
User
Offline Off
user Starkkz has written:
you should open a repository and work on there.

It could be helpful (for you) yet educational (for others).

user Ortimh has written:
I don't use repositories too often because well internet in here is bad.. real bad if you ask me. Another factor is I always change my code everytime I have time, and it's real tiring if I need to update it at that time.. but I'll look into it.

Well, you don't have to commit everyday.
---
Quote:
Do something with the npc too, make them a bit like the bots.
Programming universal AI would make it ineffective. I mean, it's better to design dedicated (designed to play defusal maps for example) AI instead of general-purpose one.
22.06.17 01:23:51 am
Up
Ortimh
User
Offline Off
@user Avo: Yeah, I've been thinking about that lately. I guess I need to host it after all, huh? But I don't know how to use repository's capability to its fullest.. so I'll try to make it really simple.
I'm awesome ... and I really cookies
22.06.17 01:29:36 am
Up
Avo
User
Offline Off
You can use github for example. Public repositories are free there.
22.06.17 06:09:52 am
Up
Ortimh
User
Offline Off
@user Avo: Sure. Will put my hands on it later.

Hiding spots system is up! This mod would load the spots file of the map, and if it doesn't find one, it fails to continue. Everytime a bot moves to another tile, it scans the entire hiding spots in the map for the spots that are within the virtual screen of the bot (850x480 px). Bots will aim the hiding spots accordingly. Click on the spoiler for our current behavior tree.
Spoiler >

There are 2 severe problems that occured during testing. First, the way of finding hiding spot to cover when panic (basically when health below 50) was weird because the bots weren't going to cover but they were going FOR their targets. Second, after a few rounds played, some bots stopped moving while the rest played, but the rest played the game weirdly. I'll have to fix them right away.
I'm awesome ... and I really cookies
To the start Previous 1 2 3 4 5 Next To the start