Movement Code With Smooth Turning?

Requests go in THIS forum!
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
Enjay
 
 
Posts: 26884
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Movement Code With Smooth Turning?

Post by Enjay »

For info, I have come across a couple of problems while converting a few enemies to use this. I haven't done anything particularly fancy. I just used the Pastebin code (minus the line we spoke about), pasted the necessary stuff at the top of the relevant actors before the default block and changed instances of A_Chase to ChaseSmooth. So, I'm pretty sure it's nothing that I have done.

1) I noticed that some enemies (quite a few of them in fact - but I'm struggling to figure out the common factor(s)) can get "stuck" in their see sequence when they lose their target. It *might* be ones that have a A_CPosRefire in their attack, or it *might* be enemies that have complex see state sequences like:
Peudocode

Code: Select all

See:
Jump to See1 or See2

See1:
POSS A 4 Do_Stuff;
Loop;

See2:
POSS B 4 Do_OtherStuff;
Loop;
The problem is, such enemies can sometimes get "stuck" in their See sequence if they lose their target. An easy way I've found to replicate this is use summonfriend to summon an enemy (any enemy is fine), then summon the potentially problem actor that uses SmoothTurn (not as a friend). No clip out of sight, let them fight and, with any luck, the SmoothTurn (potential problem) one will win. If it does, it *might* then go into its see sequence - i.e. it will be going through its walking (or whatever) animation) - but it will be stuck. By that I mean it will be standing in one position, even though it is obviously going through the see sequence. If you noclip back into the room, it will not try to attack you. It will just stand there walking on the spot waiting to be killed.

I have also noticed that adding a simple 0 duration A_Chase frame back into the See sequence *seems* to fix it at the expense of a barely noticeable normal sharp turn occasionally. Not ideal, but better than an enemy becoming stuck in a loop.

2) While using this, I have had a few VM aborts. They have been rare, and came after a few hours of editing enemies to include the SmoothTurn code and testing them, but they have happened. I have not had problems when using these enemies before.

The aborts happened when I spawned several enemies to fight each other (investigating problem 1) and it seems to happen when an enemy dies. The aborts are of the "tried to read from address zero" type. Unfortunately, the VM abort message doesn't seem to point to any particularly meaningful code. e.g. one time it pointed to the line highlighted in this sequence:
Spoiler:
So, nothing particularly fancy there. I know that the VM Abort certainly seemed to happen when another enemy was killed by the abvoe actor. So, maybe that's just where it was in its sequence when the VM Abort happened?

Anyway, I thought you might want to know that it is possible to get the system to glitch.

Edit: However, it really is a huge improvement, when it's doing everything it's meant to:
User avatar
Enjay
 
 
Posts: 26884
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Movement Code With Smooth Turning?

Post by Enjay »

Enjay wrote: Sun Feb 23, 2025 7:49 pm BTW, the movement would be just perfect for Dalek models. Hmmm...
Just something that I threw together in 20 miunutes this evening:

It would need a lot of tweaking, and a LOT more input to be a worthwhile mod, but the movement style does indeed suit Daleks.


For info, I backed up the SmoothTurn enemies that I converted yesterday and reverted back to the old A_Chase versions. I tested them very heavily and was unable to get a single VM abort, or any of the other problems, like enemies forgetting how to move when they lose their target. So, I don't know what the problem is, but it does seem to be in the SmoothTurn code *somewhere*. :(

Return to “Requests”