Bug 2845 - Alien turrets sometimes work without OM
Status: RESOLVED FIXED
Alias: None
Product: Tremulous
Classification: Unclassified
Component: Misc
Version: unspecified
Hardware: All Linux
: P2 normal
Assignee: Tim Angus
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2006-08-23 16:06 EDT by Christophe Cavalaria
Modified: 2006-10-09 11:10:35 EDT
0 users

See Also:


Attachments
partial patch for building eggs just after growing om exploded (721 bytes, patch)
2006-09-22 23:38 EDT, rasz
Patch to prevent a killed om/egg from powering alien buildings (771 bytes, patch)
2006-09-23 06:52 EDT, Christophe Cavalaria

Description Christophe Cavalaria 2006-08-23 16:06:17 EDT
Here is how it happened, by now it has happened wuite enouth for me to notice how it works :
- someone killed alien OM
- I entered the alien base and clearly noticed that all turrets were offline
- I see an OM and attack it, since it wasn't finished building, I don't really know when it's killed ( but that is a different bug ), anyway, soon enouth it explodes violently
- Alien turrets then got back online at that point !!!

For the end of the story, I got stuck by an offline trapper on the way back I've entered the base and died :/

I think the same bug happens when you kill a egg in building which would have been the only egg powering nearby turrets.
Comment 1 rasz 2006-09-15 20:44:35 EDT
thers more, I was just in a game where I killed GROWING om, and 10 seconds later granger that 0.2 seconds before just made an egg. So the egg was made a good 10 seconds after growing OM exploded (id didnt grow 100% before explosion).
Comment 2 Christophe Cavalaria 2006-09-16 06:00:16 EDT
I think I pinpointed the problem. In src/game/g_buildable.c, we do the test if a buildable as finished spawning/building and set their ent->spawned flag to true. But we do that even if the buildable was killed already.

It is only a problem for aliens because their building remains as an acid pool on the floor when they die. Human buildings which get killed during spawn will simply disapear.
Comment 3 rasz 2006-09-22 23:38:29 EDT
Created attachment 1093 [details]
partial patch for building eggs just after growing om exploded

I'm not 100% sure it works (3 tries worked = couldnt build egg just after the om blew up). I have only one computer able to run trem , and its hard to check things that need 2 grangers and a human that way :).
Someone willing to help me test it would be GREATLY appreciated.

this patch adds && (tempent->health > 0 ) when checking if OM is available, and doesnt let to build anything when OMs health is below one. Same has to be done to evolve code.

Now that Im aware of this bug I cant keep myselfe from seeing it in almost every game, ppl build eggs/evolve when 'not fully grown om blows up' all the time :(( its driving me crazy :/

BTW I tested this bug extensivelly and cant make ACID work when om blows up, will try with eggs/trappers later.
Comment 4 rasz 2006-09-22 23:54:07 EDT
trappers dont work either when om gets blown up, either normal om or before its fully grown.

There is one other thing that drives me nuts, grangers have to wait till blown OMs acid wears out before they can build new om, something like 
            case BA_A_OVERMIND:
              if( tempent->spawned && ( tempent->health > 0 ) ) break; 
              reason = IBE_OVERMIND;
              break;

on line 2525 would let grangers build om as soon as old one gets killed (health <1). 
Comment 5 Christophe Cavalaria 2006-09-23 06:52:13 EDT
Created attachment 1096 [details]
Patch to prevent a killed om/egg from powering alien buildings

I'll have to find a way to create a fix and test it. For now, I have made only client changes :)

Ok, I pretty sure now of what is the exact cause and I'll put my hands on a second computer to test that soon.

I don't think your patch will work because the killed OM ( and eggs ) have more than 0 hp ( nothing in BuildableThink prevents an already killed but not finished building from gaining health and getting the ent->spawned flag to true.

Here is a patch which fixes that. Tested and working for OM death. I have no doubts it'll work too for egg death but that one is harder to test since the other buildings will decay fast when there are no eggs to sustain them.
Comment 6 rasz 2006-09-24 12:33:22 EDT
btw same has to be done to the evo code, aliens can evo when not fully grown om blows up, makes egg hunts pointless :(
Comment 7 Christophe Cavalaria 2006-09-25 04:52:43 EDT
No need to touch at the EVO code. The same that my patch doesn't touch at the "build" code. I changed the fact that alien buildings would still regen their health even if killed before finished building. Now, since they do not regen health at all, all the places in the code where we check for OM->health > 0 and/or OM->spawned are fixed by my patch.

Of course, you can't be sure until you've tested it, yet I'm sure it'll work :)
Comment 8 rasz 2006-09-26 05:11:15 EDT
we can test it together if you build qvms and upload them here :)
Comment 9 Christophe Cavalaria 2006-10-05 06:14:56 EDT
I'll just note that we need both patch applied if we want to fix that for good.

My patch makes it so that an alien OM/egg killed before it finished building will not be considered finished and working until the acid disapears. The other patch will make it so that an already FINISHED OM but killed and in the "acid pool" state will not unlock the ability to build.

The second case maybe isn't considered a bug, but it sure makes egg hunts harder since even if you kill the OM as soon as it spawned, the aliens will still have a few precious seconds during which they can still build as many eggs as they want.
Comment 10 Tony J. White 2006-10-09 11:10:35 EDT
Thanks Christophe, applied in changeset 828