PDA

View Full Version : Player Collision CoD UO



fabio
28th October 2014, 20:01
Hello,

I am running a UO Bot Zombie Mod and have some problems with bot collisions.
When 2 Bots are at the same position i cant damage them.

Does anyone know how i can disable the playercollision - or modify it - with a hex editor or something like that?
I actually don't have a clue about libcod, but it might work for uo too? :)

Thanks for your help.

Best regards,
Fabio

Tally
28th October 2014, 20:17
Hello,

I am running a UO Bot Zombie Mod and have some problems with bot collisions.
When 2 Bots are at the same position i cant damage them.

Does anyone know how i can disable the playercollision - or modify it - with a hex editor or something like that?
I actually don't have a clue about libcod, but it might work for uo too? :)

Thanks for your help.

Best regards,
Fabio

The player damage is hard coded into the engine. There is no way to intercept it with a Hex editor as there is no file to edit. Libcod - or at least the principle behind libcod - could work, but you are talking about a massive re-write as the CODUO engine is not the same as the COD/COD4 engine. But there is no need for either approaches to the solution, as your problem is merely one of timing - the damage to players starts in the engine, but it then brought up into the runtime arena and is then handled by script. All you need to do is create a precise timer for when players start to take damage, add players to an array sequentially in terms of time they start to be monitored, and then perform the damage on the first one and then the next, and so on.

CODUO was/is notorious for players not taking damage. And it is all to do with the runtime scripting not being precise enough. The developers vastly improved the damage engine with COD2, in order to take account of this timing problem.

fabio
28th October 2014, 20:20
Is it really a timing problem?
Looks like the Bots/Players get something like a Godmode when they are stuck in each other.

How can i monitor the damage then?

Tally
28th October 2014, 22:09
Is it really a timing problem?
Looks like the Bots/Players get something like a Godmode when they are stuck in each other.

How can i monitor the damage then?

Okay, I thought you CREATED the zombie mod. In which case, you would know how to monitor damage. Clearly, you just admin a server that it runs on. I suggest you go to the zombie mod creator and ask them for help. I wont script it for you.

fabio
28th October 2014, 22:34
Ow well, I am the creator of the mod :O
The mod only exists on my server :)


But it is impossible to monitor damage of 2 Players stuck in one position.
They have like "Godmode" and the bullets just go through.

php
28th October 2014, 23:50
Yes, this is easily patchable.

Get lost Fabio, I highly discourage anyone helping him.

He's known for stealing mods (CoD1/UO), hacking servers for fun, claiming anything you use in your mod is his and he doesn't feel like he has the privilege to atleast credit the original authors and being an enormous prick (even a bigger prick than me).

Also he's one of the reasons I won't do something with CoDExtended and UO.

kung foo man
29th October 2014, 00:16
Just measure the distance between all players with distancesquared() and if they are too near, replace one of them e.g. to an older position (or kill, kick, ban, burn with ants or so).

fabio
29th October 2014, 06:25
Yes, this is easily patchable.

Get lost Fabio, I highly discourage anyone helping him.

He's known for stealing mods (CoD1/UO), hacking servers for fun, claiming anything you use in your mod is his and he doesn't feel like he has the privilege to atleast credit the original authors and being an enormous prick (even a bigger prick than me).

Also he's one of the reasons I won't do something with CoDExtended and UO.
Well, if you say that...
My RotU mod is done by myself and everyone is asked for permissions. I even asked the Developer of COD 4 RotU Revolution if this is ok.

Everything of this mod is clear.

I justed asked a small question, so please don't tell shit about this mod.



Just measure the distance between all players with distancesquared() and if they are too near, replace one of them e.g. to an older position (or kill, kick, ban, burn with ants or so).
Isn't there a better solution? So i can see zombies disappear when they come close to each other, what happens very often...

Tally
29th October 2014, 10:52
There really isn't a better solution. Your problem is one which would only affect bots - human players cannot get stuck together. Only bots, because their hitboxes are not the same as the ones human players have.

So, your problem - caused by 2 bots ascending a waypoint node at exactly the same time (I've had this problem myself when I developed Pezbot for COD4) and their hitboxes becoming fused together - is one of timing: when the 2 bots occupy the same space, the callback_playerdamage code cannot determine which is the one to take damage. Hence why they are invincible! The code cannot apply damage to an entity unless it can determine who the entity is. And with 2 fused bots, it can't do that, because they are both receiving damage at the exact same time.

So, there are only 2 solutions to it: 1) make some code to prevent 2 bots ever arriving at the same waypoint node at the same time (I tried this, with no great success), or 2) write a timer which always determines who should receive damage first - it would just be an entity array formed each server frame in the callback_playerdamage() module. The problem seems to be that the engine doesn't know who "self" is as there are 2 entities receiving damage at the same time. Hence, the timer array is more precise and can tell you exactly who "self" is at any given moment.

fabio
29th October 2014, 11:41
To Solution 2:
Is the callback_playerdamage() even called when the bots are stuck in each other?


/*================
Called when a player has taken damage.
self is the player that took damage.
================*/
CodeCallback_PlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc)
{
[[level.callbackPlayerDamage]](eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc);
}

Tally
29th October 2014, 12:00
To Solution 2:
Is the callback_playerdamage() even called when the bots are stuck in each other?

Well, using the codecallbacks to place your timer probably isn't the best idea. Put it in a gametype file, at the callback_playerdamage() method.

But, to answer your question: yes: it is called, but no damage is returned because the victim is undefined. To actual produce any damage, the victim and damage amount has to be passed to the finishPlayerDamage() function. If either the victim or damage amount (iDamage) is undefined, no effect is produced. And that is precisely what is happening here - both bots are receiving damage and the code can't work out which one is the victim, so it returns 0 damage to them. Creating the timer will solve that problem.

This solution is one that Perry Heart aka PEZZALUCIFER of Pezbot fame came up with. You might want to check out his code for it.

fabio
29th October 2014, 12:52
Where can I find his code? I have absolutely no clue...
The callback_playerdamage() is called on the victim isnt it? So if no victim is defined, how can the thread be called?

Tally
29th October 2014, 13:13
Where can I find his code? I have absolutely no clue...
The callback_playerdamage() is called on the victim isnt it? So if no victim is defined, how can the thread be called?

No, the damage from eInflictor/eAttacker is passed to the callback_playerdamage() method. From there, it picks up who should receive it. It is here that the code is failing.

And, you can google for Pezbot source code.

I am very sceptical about your assertion that you "have no clue". I am just waiting for the "can you do this for me?" request.

fabio
29th October 2014, 13:24
The one who recieves it is "self".
I can't see anything special in the code of Pezbot.

I downloaded different versions of pezbot but callback_playerdamage() doesn't show up anything special.
(or I just don't see it......)

fabio
29th October 2014, 15:58
callback_playerdamage() is not being called when Bots are stuck in each other...
I just tested it

IzNoGoD
29th October 2014, 16:30
So, the victim variable is undefined while self is defined? Should be easy to fix then, as self is the one getting the damage. Just check distances to other bots and set a flag on them to not recieve damage from the same player in the same frame again.

Only difficulty would be the amount of damage...

fabio
29th October 2014, 16:34
The callback isn't even called..

Tally
29th October 2014, 16:43
The callback isn't even called..

How do you know that? What checks have you tried?

fabio
29th October 2014, 16:45
I added some iprintln and logprint
No result

Tally
29th October 2014, 18:37
I added some iprintln and logprint
No result

Then you have an unsolvable problem. Tough luck dude!

fabio
29th October 2014, 19:02
I'm sure it can be done by editing the engine. Some small HEX data...
Well, for now i am using the distance check between 2 bots.

Thank you anyway :)