View unanswered posts | View active topics It is currently Sat Dec 28, 2024 5:04 pm



Reply to topic  [ 7 posts ] 
 Open-Source: ACrab Movement Improved 
Author Message

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Open-Source: ACrab Movement Improved
Hiya. Downloaded this game back in 2009 (when you could play 5 minutes for free), thought it was OK but didn't like the way character movement worked, especially the ACrabs. Didn't buy it.

Came back a little bit ago, read that there was a campaign finally, paid my $18. Little disappointed in the overall polish, and the fact the campaign doesn't actually work with an AI even in a rudimentary way, but whatever, skirmish stuff with mods is reasonably fun.

However, character movement still is, well, sub-optimal. Mod characters that aren't flying around with jets or ignoring forces don't generally work well. I found this very annoying; I paid for a game where you can buy tanks and various flavors of vehicular death machines, and most of them are, well, not fun.

Here's some code to fix that. It still has some issues (see notes below) but it's close to being a good standard solution and after testing it with a lot of different ACrab variants, I think it's solid enough to use. License is CC-NC(iow, you can't use it in a product you charge for, but otherwise fair game, I don't care about credit).

Anyhow, hope it helps people out; I got the Werhmacht mod's tanks working nicely with this, and you should see how well it works with the Coalition Dreadnought- definitely makes things a lot less frustrating :-)

This variation is for the Coalition Dreadnought. See comments in the code to adjust for your own creations. Should note that making a hovercraft or hovertank with this is pretty easy; just adjust the sections regarding height to apply anti-grav forces and sensor distances.


Notes:

1. Unresolved bug: characters are going to be able to do some strange behaviors in terms of wall-climbing. Best solution is to bring the sensors inside a bit, but it doesn't totally get rid of it because the force vector allows for upwards movement, then the collision creates a friction force and the character is stuck to the side of a wall. Probably can't be solved without using some beams to check then shoving characters out of the wall.

2. Unresolved bug: characters can, in very specific (and thankfully, rare) situations get themselves buried in pixels but able to climb upwards, as in bug 1. This really should result in the character's destruction, imho, but I guess the game doesn't see it my way. Shouldn't happen often unless you screw up your parameters.

3. Unresolved bug: angles aren't always going to provide appropriate data for the rotational force, and longer characters will have more issues with this, leading to some unrealistic behaviors. I don't think there's anything that can be done about this, but I got the T-90 in the Russian mod working pretty well with this, so I'm not quite sure how limited it is. Just don't expect miracles.

4. There's no specific AI support for patrolling or mining or whatever; should be possible to borrow that from DR's base code without too much trouble, as this does not use new keys for movement or otherwise create a nonstandard scenario.

5. Really should use forces along the character's vector instead of absolutes for a lot of this for better simulation, but tbh I felt like that was probably spending too much CPU for too little improvement.

6. Wheeled things just need straightforward spring sim to adjust final positions or just fake it by offsetting wheels based on height_then vs. height_now and do some body roll. I noticed the Dummy APC does it really brute-force; having done that before I will advise faking it, it's much cheaper if you lerp between test frames.

Oh, and one last thing: please don't send me PMs or expect me to answer questions, IDK whether I'll be around here much or not, given the slow pace of development... and most of this is self-explanatory and the code's commented very heavily to help the people who know ACrab stuff already.


Fri Dec 30, 2011 4:20 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Open-Source: ACrab Movement Improved
Looks like some cool stuff, although I haven't had a chance to try it out yet. Your spoiler tag was broken, so I fixed it for you - hope you don't mind.


Fri Dec 30, 2011 7:49 pm
Profile WWW

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Open-Source: ACrab Movement Improved
Sorry for that goof, I thought it looked OK in Preview but after I hit submit it told me I had to wait until somebody approved it, otherwise would have fixed it then :-)

Did tests with the AI last night; this seems to work surprisingly well for them, although they continue to have major issues pathfinding through tunnels as usual.

I'd like to do the same with AHumans, but I'm fairly certain that it can't be done without major mucking around with how they operate graphically.


Fri Dec 30, 2011 8:50 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Open-Source: ACrab Movement Improved
Mehman already did something like this for AHumans.

I tried this on a dummy dreadnought, and it worked very good.


Fri Dec 30, 2011 10:07 pm
Profile
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1198
Location: Sydney
Reply with quote
Post Re: Open-Source: ACrab Movement Improved
I suppose this means I have to re-sprite my tanks. Thanks very much for this opportunity to get them to work.
But dammit now I have to resprite my tanks


Sat Dec 31, 2011 12:26 am
Profile

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Open-Source: ACrab Movement Improved
@Kettenrad: No resprite should be necessary; I got it working on your medium tank without modification. I mean, unless there are artistic reasons? I really thought the tanks were cute, although I'd honestly like to see them at scale and quite a lot less flimsy :-)

One lil' thing to note is that for pure vehicle stuff, offsetting the feet so that the engine can't screw up and try to make it walk is a good idea.

@Asklar: I've tried Mehman's stuff over here. It's a start, but it's very slow, does weird stuff to pixels on the ground and has some other things going on that I think could be better. Moreover, it is causing some Lua errors over here, involving weapons becoming un-attached which appears to be causing the script to halt with an error state. Probably an easy fix to stop that from interfering with the script's operations, but I haven't looked into it.

TBH, I think that the problem with AHumans is engine-side and the only way to fix it mod-side is not going to be efficient, because of the number of joints involved and the math steps that would probably be required. The problem with AHumans is that their constraints don't operate correctly and they behave like floppy ragdolls all the time, when really they should only do that when they're being affected by impulse forces from impacts strong enough to change the character's velocity in a meaningful way. Fixing that on the Lua-side would involve a great deal of math fairly frequently.

There doesn't seem to be any way to change joint constraint strength Lua-side, or I'd try that out. I know that Lua can reposition the joints manually, but that's not really what I'd want the behavior to be; I'd rather see constraints that were a lot stronger unless the AHuman has been hit by something and a general lack of floppiness otherwise.

The only mod-side solution I've thought about that might provide an interim solution is to do like the "vehicles" and basically get rid of the legs entirely, representing them in a different way. IDK what that takes in terms of sprites or whether it's even possible to continue to support crouching at that point, although I'd honestly give up crouching if it meant characters could run smoothly and not generally behave very badly on the ground. This game would be so much cooler if most soldiers were ground-bound, especially if friendly Actors could pass through one another freely.


Oh, and lastly, since I mentioned the engine-side stuff. If I were a developer for this, I'd look very seriously at giving modders a generic Actor class that did not have any joints or joint behaviors defined and allow joint rotations to be defined as animations, with the joints set up to obey instructions to rotate relative degrees with constraints and constraint strengths.

Probably the vast majority of that is already in the code, other than allowing for arbitrary joints; doing it engine-side with the existing joint handler has got to be a lot cheaper than having people code it up in Lua. If Lua could call sequences to named joints, all sorts of arbitrary animations would then become possible, in a non-hackish way.


Last edited by xenoargh on Sat Dec 31, 2011 2:28 am, edited 1 time in total.



Sat Dec 31, 2011 2:20 am
Profile
User avatar

Joined: Mon Oct 25, 2010 5:51 am
Posts: 1198
Location: Sydney
Reply with quote
Post Re: Open-Source: ACrab Movement Improved
Yup, artistic reasons.

xenoargh wrote:
One lil' thing to note is that for pure vehicle stuff, offsetting the feet so that the engine can't screw up and try to make it walk is a good idea.

I'll keep that in mind, thanks.


Sat Dec 31, 2011 2:27 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.052s | 14 Queries | GZIP : Off ]