Forum

> > CS2D > Mods > New Bot System - Testing Version Released
Forums overviewCS2D overview Mods overviewLog in to reply

English New Bot System - Testing Version Released

89 replies
Page
To the start Previous 1 2 3 4 5 Next To the start

old Re: New Bot System - Testing Version Released

Pagyra
User Off Offline

Quote
For more experience, you should pay attention to source code, functional and principles embedded in various bots of 3d shooters - such as bots for cs 1.6 (like Podbot, nicebot, zbot, swatbot, realbot) or similar in other different games.

Moreover, to humanize bots it is required to add some human character traits and habits.
For example, here are a number of typically human habits,
- Look about in direction where you are moving,
- reload even ammo has more than 20 rounds
- stupid rush (even when player knows that enemies are waiting around corner) and panic if there are several opponents nearby
- forgetfulness to use grenades during round or their meaningless using at end of round (and even shooting last clip)
- constant switching between types of weapons
- throws grenades into area with allies
- shooting during movement (like run and shoot with awp and with using optical sight)
- running with a knife to opponent who is distracted or does not see player
- running in a dense crowd along narrow corridors
- using typical tactics (or cycle-actions)
- running with a grenade or a mine in hands
- rare switching to pistols

It also makes sense to add human characteristics that can affect at gameplay such as aggressiveness, greed for frags, greed for getting trophies, susceptibility to panic and fear, calmness, team feeling (understanding of allies' actions), teamwork (understanding order of personal actions in each situation), camper habits (habit of using certain places on map), habitual shooting distances, etc.

So you can use text files to save some waypoints and some team info for every analyzed map, i mean you can try to add analyze function to search areas for camping, defence, attack, for special actions. And it can be improved with addition of information about default view angle, about good weapon type for that map area, prefered method of typical distribution of team players in occupation of this sector of map, about "danger" of this sector and so on.

old Re: New Bot System - Testing Version Released

Dousea
User Off Offline

Quote
@user Pagyra: Well they're 3D games which is totally different on the calculations, but I'll look into it, maybe there're some things that I could take. And as I said, there're CS2D limitations regarding on weapon proficiency, especially with getting ammo values. So I couldn't do anything about it, unless I need to hack it, which is I don't want to because some critical factors. Also all your suggestions is really too map-specific, could take a lot of time and it couldn't be generalized for all maps (if you know what I mean). But if this is something that I could make money with, I'd do it though.

Okay, repository is up! You can check it out here. There're some minor features that I added but I can't remember what they are.

UPDATE:
I've been working on this as daily as I can, so DON'T WORRY. I'm not going to update this thread until something really interesting happens. Instead of updating it here, you can check the daily progress in the repository. Also I have a question that I have in mind that has been delaying this project.. (instead of creating a new thread, yes?)

How can I get the seconds a bomb would detonate? Or seconds until detonation?
edited 2×, last 27.06.17 12:46:35 pm

old Re: New Bot System - Testing Version Released

Dousea
User Off Offline

Quote
@user Masea: Ah, that's not what I meant. It's the seconds after the bomb has been planted, so it would return 35, 34, 33, ... until detonation. But I think there's none.. so another hack, huh? This mod is getting bigger that online use might be impossible.

old Re: New Bot System - Testing Version Released

Masea
Super User Off Offline

Quote
1
2
3
4
5
6
bomb_timer = game("mp_c4timer")

addhook("bombplant","_")
function _()
	timer(1000,"parse","lua bomb_timer=bomb_timer-1",0)
end
Something like this would work regardless.

old Re: New Bot System - Testing Version Released

Mora
User Off Offline

Quote
It's not that hard to make a function which repeat self.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
bomb_timer = game("mp_c4timer")

addhook("bombplant","_")
function _()
     timer(1000,"speat")
end

function speat()
	if not ((bomb_timer-1)==0) then
		bomb_timer=bomb_timer-1
		timer(1000,"speat")
		msg(""..bomb_timer.."")
	else
		bomb_timer=0
		msg(""..bomb_timer.."")
		bomb_timer=game("mp_c4timer")
	end
end

addhook("startround","_st")
function _st()
	freetimer()
	bomb_timer=game("mp_c4timer")
end
btw when it would lead to problems using w/o tonumber?

old Re: New Bot System - Testing Version Released

Pagyra
User Off Offline

Quote
I think you need use more hooks (like reload,walkover,flashlight, ...), and may be need to add some functions to check values of objects.

At this moment your code is not optimized but anyway it can be improved at finish stage.

These manuals can be usefull for your project.
https://www.cs.rit.edu/~jdb/tmp/making_of_official.pdf
http://www.csse.uwa.edu.au/cig08/Proceedings/papers/8071.pdf
http://sander.landofsand.com/publications/meIRL-BC%20-%20Predicting%20Player%20Positions%20in%20Video%20Games.pdf
https://www.hindawi.com/journals/ijcgt/2009/129075/

old Re: New Bot System - Testing Version Released

Dousea
User Off Offline

Quote
@user Pagyra: Thanks for the documents! Will sure read them all. Yeah, my code is unoptimized as heck, but I don't want to optimize it prematurely. Also could you elaborate more on...
user Pagyra has written
I think you need use more hooks (like reload,walkover,flashlight, ...), and may be need to add some functions to check values of objects.

old Re: New Bot System - Testing Version Released

Pagyra
User Off Offline

Quote
I looked at your code and noticed ai_hook_ for standart hooks
'spawn', 'startround', 'always', 'second', 'move', 'drop', 'collect', 'break', 'select', 'attack','attack2', 'hit', 'projectile', 'kill', 'die',
but there are no hooks for non standart actions with players, objects and tiles:
'join','disconnect','reload','walkover','flashlight','suicide','objectkill', ...

old Re: New Bot System - Testing Version Released

Dousea
User Off Offline

Quote
Since I don't want anyone to worry about this project being dead (it's been a week, heh?), I want to give an update.

Before, my bot system was using a general tree behavior for both teams, which meant idiotic. It resulted unexpected behaviors that I almost dropped this project (don't worry, it was just stress). Now the behavior tree is splitted each accordingly to their teams. Well my testing wasn't deep but I gave it a try and it worked wonderfully. And while I was it, I was thinking that with the behavior tree implemented, people with their own game modes could implement their own bot's behaviors using this, which means a good thing! There was a problem with the destination system, but it's fixed.

There're currently 3 game modes that are "partially" supported by this bot system: bomb/defuse; assassination; and hostage rescue. Why I said "partially"? Because there's a problem with the follow the leader function because cs2d lua cmd ai_goto returned 0 although the destination was walkable, which was the leader's position. I debugged it and saw nothing wrong with my function. I need to fix it soon.

I'm currently working on the Capture the Flag game mode. If you need more info (or want to read the code), head to the repository. I will soon need testers on this bot system, if you're up to it, let me know.

old Re: New Bot System - Testing Version Released

Dousea
User Off Offline

Quote
@user SQ: Sure, would love to see you participate.

UPDATE:
Due to the problem I've been facing for several days with cs2d lua cmd ai_goto, I've decided to use navigation mesh on CS2D maps. This way the making of paths for bots would be faster (I hope) and I could do something that previously impossible such as danger zones, one of my previous plans, come true. How, you ask? I will use the simple cs2d lua cmd ai_move on each node. I would be using triangles for the navmeshes and A* path-finding algorithm to find the path.

Relax, I've been working on the automatic generation of navigation meshes so you don't need to do it manually (you can if you want to). I've been working on my ass for several hours with the algorithms and this is what I found. Things that are done are the marching squares and Douglas Peucker algorithms. You want to see the mess, you could click below.
Automatic Navmesh Generation (unfinished) >


ANOTHER UPDATE:
After working my ass for hours and hadn't proper sleep last night, this freakin' automatic navmesh generator is done. Want to see it in action?
IMG:https://i68.tinypic.com/v80u0.jpg
IMG:https://i68.tinypic.com/huk70y.jpg

Or you prefer the "behind the scene", just click below.
Behind the scene >

Don't need to tell you all the details, right? Well but that doesn't mean it's working fully. It still has a problem when generating navmesh for as_mars which is sucks. If it still doesn't work then I will keep this generator, and would proceed with manual navmeshes. Now onto the bots again!
edited 4×, last 09.07.17 07:12:45 am

old Re: New Bot System - Testing Version Released

DC
Admin Off Offline

Quote
That nav mesh looks crazy. Nice work. What algorithm will be used to actually find paths using the nav mesh? I kind of doubt that it will be much more efficient than simply using a tile based pathfinding. At least on average maps - might be a different story for super huge maps or maps with large open areas.

I also have to admit that the built in pathfinding is implemented in a very crude and unoptimized way. It probably could be much faster (even when keeping it tile based)...
To the start Previous 1 2 3 4 5 Next To the start
Log in to reply Mods overviewCS2D overviewForums overview