Wolf3d Haven Forum

Please log in or register. Smile
Wolf3d Haven Forum

A friendly Wolfenstein 3D community, about Wolfenstein 3D, the game that gave birth to first person shooters...


    projectiles can exceed maxactors, help preventing this?

    Share

    racquetball1987
    Wolf3d n00b
    Wolf3d n00b

    Number of posts : 9
    Age : 29
    Registration date : 2011-03-05

    projectiles can exceed maxactors, help preventing this?

    Post by racquetball1987 on Wed Mar 16, 2016 2:53 pm

    I don't ask for help much but here's one I just can't figure out..

    I'm using the DOS code, including poets rocket launcher tutorial, but if you're only fluent in the 32 bit code, any input is a big help.

    Currently when there are too many rockets flying around (whether the players or the enemies), max actors can be exceeded which of course crashes the game.

    Ideally I would want the game to check before a rocket firing enemy starts their attack sequence (in the case of my TC that's only Giftmacher) to make sure there's room for the rocket on the actors list, and if there's not, they just don't attack. So in other words, if a particular map has the max amount of enemies minus one, enemies firing rockets would have to wait until their first rocket explodes and is completely removed before they could fire another one.

    Even better.. how difficult would it be to have the code search for a random dead body and remove it to make room for the projectile? And if no dead bodies exist yet, then prevent the enemy from attacking.

    Ideally I would like the code to perform the same check every time the player fires a rocket too. Remove a dead body only if necessary, or if there are no bodies, remove a random melee enemy or just nothing comes out when the player fires. That isn't a perfect solution but it's way better than being dumped to dos. And 90% of the time no one would notice a guard or a body missing from the stage.

    Nexion
    Bring em' On!
    Bring em' On!

    Number of posts : 216
    Age : 111
    Location : Dimension of Anti-Time
    Hobbie : bringing chaos & madness into universe
    Message : Planet N
    Registration date : 2008-02-27

    No warranty

    Post by Nexion on Wed Mar 16, 2016 3:18 pm

    You might want to try something like

    if (!objfreelist)
    {
    ob->state = &s_giftchase1;
    return;
    }

    in the T_GiftThrowSomething function.

    For removing you could do

    void A_KilltheCorpse (objtype *ob)
    {
    if (!objfreelist)
    ob->state = NULL;
    }

    and put that in the death state to remove a undead corpse

    statetype s_grddie4 = {false,SPR_GRD_DEAD,66,NULL,A_KilltheCorpse,&s_grddie4};

    racquetball1987
    Wolf3d n00b
    Wolf3d n00b

    Number of posts : 9
    Age : 29
    Registration date : 2011-03-05

    Re: projectiles can exceed maxactors, help preventing this?

    Post by racquetball1987 on Wed Mar 16, 2016 3:47 pm

    Thanks I'll try these out,

    regarding removing the body though,

    Wouldn't that only remove the body immediately after killing a guard, so it would look like he disappears when you shoot him? What I had in mind was a way of scanning the map for an existing dead guard and removing him right before a projectile is fired, not removing a guard upon killing him. Or do I have this wrong?

    racquetball1987
    Wolf3d n00b
    Wolf3d n00b

    Number of posts : 9
    Age : 29
    Registration date : 2011-03-05

    Re: projectiles can exceed maxactors, help preventing this?

    Post by racquetball1987 on Wed Mar 16, 2016 4:25 pm

    Oh wait, I get it now.. dead bodies check every 66 tics to see if the object list is full and if it is they are removed from the game. I'll try this out later. The only problem I can see is in a scenario where the object list is almost full and several rockets are fired from different enemies within 66 tics (could happen). it could still crash, but I'll see what I can do with this. Thanks.

    Mega Luigi
    Bring em' On!
    Bring em' On!

    Number of posts : 135
    Age : 13
    Registration date : 2012-11-01

    Re: projectiles can exceed maxactors, help preventing this?

    Post by Mega Luigi on Wed Mar 16, 2016 5:32 pm

    @racquetball1987 wrote:Oh wait, I get it now.. dead bodies check every 66 tics to see if the object list is full and if it is they are removed from the game. I'll try this out later. The only problem I can see is in a scenario where the object list is almost full and several rockets are fired from different enemies within 66 tics (could happen). it could still crash, but I'll see what I can do with this. Thanks.

    Just something to help you out on that, you can always change that number to 1, should you want to. Also, the field with "NULL" right before the "A_KilltheCorpse" function. You can also put functions there, and those are to be executed once every tic, unlike the functions in the second field, which are executed once every X tics (in that case, 66). That could be helpful at times.

    Sponsored content

    Re: projectiles can exceed maxactors, help preventing this?

    Post by Sponsored content Today at 2:13 pm


      Current date/time is Thu Dec 08, 2016 2:13 pm