Freelancer Community Network
Reminder: Internet Explorer 6 or below are NOT supported.
HomeHome
ForumForum
WikiWiki
DownloadsDownloads
ForgeForge
Multiplayer Connection Tutorial
Collapse/Expand Donations
Monthly costs: -30€
Income (ads): +5€
Donations (last month): +0€

Current balance: -195€
(last updated 03/2017)

Please make a donation if you want to help keeping The-Starport online:

Bitcoin address:
Thanks!
Collapse/Expand Random Image
Collapse/Expand Login
Username:

Password:

Remember me



Lost Password?

Register now!
Collapse/Expand Chat
Collapse/Expand Who's Online
20 user(s) are online (11 user(s) are browsing Forum)

Members: 0
Guests: 20

more...
Collapse/Expand Links
Collapse/Expand Advertisement
There are currently 51 users playing Freelancer on 49 servers.
March. 29, 2017

Browsing this Thread:   1 Anonymous Users



 Bottom   Previous Topic   Next Topic  Register To Post

« 1 2 (3)


Re: Offset requests - ship spinning & docking speed
Home away from home
Joined:
2008/5/13 15:48
Group:
Registered Users
FLServer Admins
$$$ Supporters $$$
Senior Members
Posts: 657
Offline
Quote:


I don't think this will work very good with the FlHook versions
beyond the 196.

And for the v.196 I d recommend to use the
recompiled plugins from this thread:
2.0.0 Plugins/KosAcid Projects/Plugin Ports

Btw
- would be cool, if someone would recompile those once more,
to meet the latest FlHook version.

Posted on: 2014/3/10 6:49
Open in new window
Top
Re: Offset requests - ship spinning & docking speed
Just can't stay away
Joined:
2008/5/28 18:04
From Maine, USA
Group:
Registered Users
FLServer Admins
Senior Members
Posts: 457
Offline
Quote:
adoxa wrote:
I thought kosacid fixed it (see SpinProtection).

This is actually Kosacid's plugin port of M0tah's SpinProtection from FlakHook - it attempts to alleviate the issue by pushing away NPCs that come into contact with the player ship. However, the initial collision still causes some spin and it has no effect on player-player collisions, so it would still be ideal to solve the underlying cause directly (whatever is applying rotational force to the ship on collision).

If anyone hunts this down I will give them a cookie - and the last ones I baked were pretty damn good if I do say so myself. :)

Posted on: 2014/3/28 21:57
88 Flak for Freelancer
1.27 Betas | Wiki | Forums
Top
Re: Offset requests - ship spinning & docking speed
Home away from home
Joined:
2008/12/26 16:55
From Xarania
Group:
Registered Users
Senior Members
Posts: 806
Offline
even if you get a decent anti-spin plugin.. I'd still highly recommend Startrader's formula for overall ship value excellence.

It's good to know, WHY things do things i was dubious having modded for a while (heavy emphasis on ships) by the time i finally took a look it didn't just make sense, i kicked myself for not having that formula in my head for all those years.

It does go a long way to stopping spinning in big ships upon collision.. but meh.. if someone rams you with the osiris.. your gonna move.. hehe i'd feel cheated if i didn't.

Posted on: 2014/3/29 6:54
Open in new window
http://freexlr.forumotion.net - FL-XLR MOD http://www.smfweb.com/forums/MERCHQ - [MERC]
Top
Re: Offset requests - ship spinning & docking speed
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3410
Offline
Except ST's formula (and all similar formulae) lock your ships to a very narrow range of handling feel. It's way too limitative in general and still doesn't stop ship spinning in practice.

Posted on: 2014/3/29 14:31
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: Offset requests - ship spinning & docking speed
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3410
Offline
So I'm going to kind of resurrect this thread because I managed to get more data on Freelancer's collision handling.

Unfortunately, I don't have anything conclusive as of now, but I did figure out a chain of function calls that seem to be handling collisions.

The most interesting function is at 0x628fa40 in common.dll. I can't tell what the function does in its entirety, but I do know that towards the end, it sets a vector of CollisionEvent objects in a hidden PhySys object. Those CollisionEvents are what is eventually read by the game to send SPObjCollision events to the server.

Walking up the call stack reveals another function at 0x628c410 which appears to be handling collisions in a more direct fashion (for instance, there's a direct reference to MIN_TIME_BETWEEN_COLLISIONS), but a lot of what it is doing is unfortunately moving around member values which I can't trace down.

The hidden PhySys object can be obtained by peeking at PhySys::GetCollisions's source. The DWORD at 0x63fc09c seems to always contain the object, even though there's actually a case in the code where another value is used.

Relatedly, GetCollisions requires an integer as its first parameter and the value must be very specific in order for it to work. As it turns out, that value is directly returned by the function at 0x554e90, which may be called as a uint(void) function.

Finally, I have partially reversed the CollisionEvent struct:

Code:

struct CollisionEvent
{
CObject* a; // This is the damaged object in my limited tests
CObject* b; // This is the "other" object
uint iDunno1[2];
Vector position;
float fDunno2[3];
Vector velocity;
};


Now, what isn't done is actually fixing the collisions proper. I'm still not sure where the math is performed, but I'd hope that somewhere in the call stack we can at least hook the strength of the bounce to tone it down - I'd much rather see NPCs fly through the ship than bounce them around.

Anyone feel like taking a crack?

Posted on: 2016/5/28 1:45
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: Offset requests - ship spinning & docking speed
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1743
Offline
Quote:
The most interesting function is at 0x628fa40 in common.dll.

This function appends a CollisionEvent to this vector of CollisionEvents (arg1 is this.end(), arg2 is 1, arg3 is the CollisionEvent* to append). Perhaps that means you could hook this function, see if the objects are capital ship and fighter, and then either ignore the collision altogether, or reduce the velocity (or, at a guess, the rotation that might be the unknown floats).

Quote:
Relatedly, GetCollisions requires an integer as its first parameter and the value must be very specific in order for it to work. As it turns out, that value is directly returned by the function at 0x554e90, which may be called as a uint(void) function.

It's the ID_String of the current system.

Posted on: 2016/5/29 3:30
Top
Re: Offset requests - ship spinning & docking speed
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3410
Offline
I'm not sure what the floats are, but they're always 0.707, -0.707, 0 from what I've seen.

The problem is that I'm pretty sure the collision's velocity/position effect is already applied by the time the CollisionEvent is set, so I doubt intercepting it would be enough.

Posted on: 2016/5/29 4:16
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: Offset requests - ship spinning & docking speed
Just can't stay away
Joined:
2008/7/8 21:15
From Germany
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 456
Offline
If the numbers are correct, then in looks like a normalized vector (0.707²~=0.5). Could be the collision normal for example. But this is just a guess, the numbers jumped at me because after a while you see the typical values and your "vector" (if it even is a sequence) would make perfectly sense then as it has the length of one.

Posted on: 2016/5/29 20:17
Top
Re: Offset requests - ship spinning & docking speed
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3410
Offline
You're right, that's where I remembered seeing those numbers from. Oddly though, the collisions were pretty much all full frontal and definitely not perfectly identical... I guess I'd have to test more.

Still, the idea here would be to prevent the collision from affecting the ship at all while still actually being processed as a collision and doing damage.

Posted on: 2016/5/30 1:22
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: Offset requests - ship spinning & docking speed
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3410
Offline
Oh, here's the call stack I get from 0x628fa40 to PhySys::Update (ordered from last call to first call):

628fa40
634cf87
6358aa7
6358d36
63262799
634fe99
6360888
6360a9d
634ccbe
628cb63
62899f7 (in PhySys::Update)

The last few calls in the stack don't appear to matter, preventing their execution merely stops damage from occurring. As you go up, though, it becomes impossible to just prevent the call as the game just crashes.

I'm not sure if the function actually moving the ship after the collision is within that call stack, but if not, it's most likely in one of the functions called throughout.

Posted on: 2016/5/30 2:57
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: Offset requests - ship spinning & docking speed
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3410
Offline
So I noticed some peculiar behavior and was hoping someone would be able to shed light on this.

PhySys::GetCollisions seems to return all collision events, even those that involve beam weapons. Oddly, though, it doesn't put a CBeam pointer in the second slot, instead it puts a pointer to what appears to be garbage. All I could notice was that the pointer would point to another pointer which would point to another pointer and so on until the last pointer goes to 0x0. All data around those pointers is 0xcdcdcdcd, so invalid.

I tried looking into how FL handles the CollisionEvent list, but it doesn't seem to make any special case for those events, even though the second pointer obviously doesn't work. Is there a straightforward way of identifying those "broken" events short of just trying to cast them to a CObject and seeing if it breaks?

Even better would be figuring out a way of tracing back which CBeam did it.

EDIT: So apparently if a beam weapon's ammo has zero mass, it shows up in the CollisionEvent list, but does not refer to the proper object instance.

Posted on: 2016/6/11 16:13

Edited by FriendlyFire on 2016/6/11 22:56:30
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
« 1 2 (3)