Hajas

Bots from COD4X?

Recommended Posts

Hello there, I already started to port Frontlines to COD4X using all new features, but I'm having some problems with bots, I'm having a very weird behavior.

Simply sometimes they move, sometimes they don't... sometimes appears this in the log, sometimes not...

Bot movement done at (551.759, 730.797)
Bot movement done at (-457.083, -395.174)
Bot movement done at (150.602, 738.911)

This appears if they REALLY move or not... Already spent many hours and didn't found any conclusion. :(

If I spawn 10 to each side, is like half of them are stuck in the spawn (can fire weapons and aim to targets, but not move), and the other half play fine. moving and firing... but usually after been killed they comeback stuck. Already made several debugs and all the needed threads are loading fine to make the bot think in the right order and sequence, but they simply are stuck. I already even removed ALL freezecontrols functions from the entire code, but no difference. :/

Anyone succeed in make the bots REALLY work? Move around the WayPoints, Objectives, Respawn, Change Sides, Change Rounds, etc? 

Thank you

 

 

Edited by Hajas

Share this post


Link to post
Share on other sites

Suspicious : is there a limitation in the botmoveto function if the origins are too close it will ignored?

Share this post


Link to post
Share on other sites
7 hours ago, Hajas said:

Suspicious : is there a limitation in the botmoveto function if the origins are too close it will ignored?

7 units.

Edited by T-Max

Share this post


Link to post
Share on other sites

7 units? Do you mean 7 squared players units distance? Around 350 X/Y distance?

Or just for exemple 100x100 to 107x100 will be ignored, but will work to 108x100?

If I send 2-More bots to the same WP, there's also any kind of limitation?

thank you

PS: is a move using BOTH methods (botmoveto + move the ent like pezbots) I got them moving all around with animations, but seams very lag since are doing the same thing twice, and they are kind move over the ice, sliping all the time, I needed to reduce the speed to 1/4 of the original pezbot to appears more natural. not good enough yet.

Share this post


Link to post
Share on other sites

Player origin is a point. So bot thinks (100, 100, 100) and (103, 100, 101)  is the same point. When bot reaches it's target point (or bot origin is inside circle with radius 7 around its target) it stops. When I have tested that, I forced bot to move exactly to it's target point. As a result there was an infinite movement because bot couldn't achieve it's target point because of float rounding. So I decided to add this 7 units sphere to get rid of rounding issue.

11 hours ago, Hajas said:

Or just for exemple 100x100 to 107x100 will be ignored, but will work to 108x100?

Yes.

11 hours ago, Hajas said:

If I send 2-More bots to the same WP, there's also any kind of limitation?

I guess after some time one bot will achieve target location faster than other bot and will stop. After this, second one will push him out of his location and will stop too.

When bot stopped moving it'll fire "movedone" event so you can track movement like

self waittill("movedone");

 

11 hours ago, Hajas said:

PS:

Get rid of that movers and just send commands to bots to look/move at specific location and everything will be fine.

Share this post


Link to post
Share on other sites

Yeah, I want to remove everything move related and use the all new features, was only a test.

I found the problem, if a bot get a botmoveto command and for any reason not reach there, he is stuck and can't do anything else even without the waittill command, the loop continue without problems but the bots become zombies. I solved notifying the movement done anyway after a time, so they will be free to move again.

few questions:

1. I found also why they become zombies after first round, is because they don't have more self.isBot set anymore, for now the only way (that I know) to id them as bots is with their names, or exist any kind of test available to let me test if a player is a bot or not to start the thinking threads? like IsBot(player) for exemple?

2. botnames.txt is great, but aside I had filled with more than 40 names, in my 20 bots game matches is normal have 2-3 with the same names. Is possible to make the names not repeat?

3. The Bots from our team are always without collision, is possible to make them have collision like the enemy bots?

thanks

Edited by Hajas

Share this post


Link to post
Share on other sites

Hello, another problem that I found... the function botLookAtPlayer is lagging the server at max,aside no errors in the log.

Tryed everything, even put waits to 5 secs or just one bot, same results (works great if I just use player pos with botLookAt function).

Then I run your tests and I get the SAME results, seams the new version of COD4X bugged this function. Please take a look.

Keep the excellent work!

Cheers

Share this post


Link to post
Share on other sites

Not sure if it helps but i wanna share my experience with the bot lags since i switched from 17.5 (may 2017) to the latest new_arch build. 

 

The server is running multi threaded on 4 CPU Kernels. 

When bots join and start to play the CPU of Kernel 1 is increasing to 100% and the server starts to lag badly. 

Removing the bots fixes the lags. 

 

The new Server is a vps only but it's weird that only CPU 1 maxes out. 

Maybe the bot functions are not multi threading, if that's even possible. 

Share this post


Link to post
Share on other sites

Same experience happened with me on RotU. Some uptime and the first thread just capped on 100%

Share this post


Link to post
Share on other sites

few questions...

But which bots exact are you working with?

Are you using default PezBot scripts changing only the moveto functions? Or did you rewrote everything?

Was working fine before the update? Or never worked at all?

Share this post


Link to post
Share on other sites

The A* function is from pezbots, everything else was done by myself.

On the old server (root with cod4x 17.5) there were no lags but since we switched to the new server (vps with cod4x new_arch) we can not use the bots anymore.

Share this post


Link to post
Share on other sites
11 hours ago, Viking said:

The A* function is from pezbots, everything else was done by myself.

On the old server (root with cod4x 17.5) there were no lags but since we switched to the new server (vps with cod4x new_arch) we can not use the bots anymore.

Should be the function botLookAtPlayer which I reported here, it's lagging everything... you will need to replace for botLookAt(player.origin) instead until they fixed. 

Share this post


Link to post
Share on other sites
12 hours ago, AlexC said:

It was working, and still working in RotU-Revolution, which is using some kind of pezbots. I'm not a developer of RotU-Rev so I guess it using the old methods still. But the sourcecode is available on github if you interested.

https://github.com/doctorluk/rotu-revolution

I just take a look, they are still using pezbot method. But thanks anyway. I'm trying here use the COD4X methods and getting lot's of weird stuff. Started from Zero to see what happens, but the bots at some points seams lost don't respond anymore aside the threads are running and passing accross the movements parts, but seams ignored.

Share this post


Link to post
Share on other sites

Just checked my script, i never use botLookAtPlayer(), what i do is botLookAt(target getTagOrigin("pelvis"), time);

Share this post


Link to post
Share on other sites
2 hours ago, Viking said:

Just checked my script, i never use botLookAtPlayer(), what i do is botLookAt(target getTagOrigin("pelvis"), time);

Hmmm... so should have another (or even more) function which now is causing this.

For now I'm using botLookAt with a random value for the Z axis, to make the bots more real, so they can miss the target like us. ;)

Still looking to make this work again. :D

Share this post


Link to post
Share on other sites

I'm since the last post talking with Viking and already a month working/testing to find what's wrong with the latest COD4X version, and I still getting very weird things which is making impossible to dev for COD4X since I can't trust the core anymore, mainly because I can't say when something is wrong, if was my error or from the core, then I need to spend several hours to isolate the problem to find out it's a core problem and not mine.

I don't know how this is happening, but seams something very weird was done with stack operations, that are giving very weird behaviors even with the known function A* which is used without problems with the original COD4, which seams to be working before with COD4X too since some people already reported like Viking.

Doesn't matter the maps/waypoints/targets, this happens EVERYTIME, when reach on the last wp before the objective, in this exemple another wp. the sever lags with this error inside the A* :

undefined is not a field object: if(parent.parent.wpIdx == -1)

Here the video:

youtu.be/bW4qANpnybw

Seams illogical to me, since work PERFECT without the COD4X bots.

To who don't know this function, it's simply given the ID from a WayPoints List of the actual WayPoint which the bot is close and the ID to the Target WayPoint, and it's returned to ID to the next WayPoint to move. Trying to get the last WayPoint which in my exemple was another WayPoint give that error.

Maybe was the same cause that made BotLookAtPlayer cause lag on the server. Really don't know.

To not waste more time with that which seams pointless right now, I want to step back and work with a stable version of COD4X. and when we get a new COD4X with all these working again move to the new version.

Can anyone confirm that v17.5.4  was the last stable version which the bots were working?

keep the excellent work!

Cheers

 

 

Edited by Hajas
Video link

Share this post


Link to post
Share on other sites

I'm getting several errors in the forum too, posting and in the messages too, I can't use any kind of formatting like BOLD for exemple, that give me errors.

Same if post a video, I need to remove the preview and post as text only.

Forbidden
You don't have permission to access /index.php on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

 

Share this post


Link to post
Share on other sites
parent

or

parent.parent

Is undefined. Make sure there are at least 2 guards right before field usage:
 

if (!isDefined(parent))
    return <something that acts as error>;
if (!isDefined(parent.parent))
    return <something that acts as error>;

Actually, each subprogram must check arguments it have to use. Only then you can be sure nothing go wrong.

 

And I want to conclude that discussion about "bugs in core": did you tried to play entire match on non-modded server at latest binary? If everything is ok, no crashes, script lags, etc.: then it's a mod problem (A* implementation in this case.)

Edited by T-Max

Share this post


Link to post
Share on other sites

Thanks @T-Max, but you really think that I don't know what undefined means? :D

This was exactly what I did first aside was already illogical, since it's the ORIGINAL A* function, in my original code, which is running flawless for years.

I saw many people reporting weird behaviors with the new version of COD4X, probably the same reason that BotLookAtPlayer stop to working it's causing this too. Codes can't simply "stop working" without a change in the core that cause that.

Bots seams not working anymore, I suspect about stack iterations... I'll test with older versions now, I bet will work! :D

 

Share this post


Link to post
Share on other sites

Bots worked fine for me until i switched to the new_arch version. Latest version i can confirm working bots is 17.5.2. 

I used 17.5.6 for a few days only but if i remember correctly the bots did work there too. 

 

So yea, i can confirm what Hajas is saying.

Share this post


Link to post
Share on other sites

Problems that I found not related with my code:

1. BotLookAtPlayer lags the server until crash. No error in the logs.

2. Bots become zombies after first round, is because they don't have more self.isBot set anymore, happens the same with PezBots and the only way (that I know) to id them as bots is with their names, but since we now can change their names would be great if the core have a function like IsBot(player) to ID a bot, then we don't need to set any other var to ID them anymore, specially they will be lost after first round.

3. botnames.txt is great, but aside I had filled with more than 40 names, in my 20 bots game matches is normal have 2-3 with the same names. They should not Repeat. And if we could have two botnames.txt, one for each team will be even great.

4. Bots get lost after botmoveto command not completed (object in the middle for exemple), of course without waittill, the looping still running with new commands but they are ignored after that. To fix I notify a movedone after a while anyway and the bot is released. But this wasn't supposed to happen. The bot should be able to get new commands in the middle of commands, then simply when moving from A to B and receive move to C command, he must move from where he is then move to C which IS happening if nothing block him in the middle, what is even weird. The bot seams disabled if can't reach the objective.

5. The known A* function from PezBots get lost when have two parents (parent.parent is unreachable). Stack iterations problem I guess? (reported above)


 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now