Monday, July 6, 2009

floors and falling

Well, I've successfully coded some routines so that every time a unit moves forward, a check is made to see if the ground it's standing on is strong enough to support it. If they step onto a weak tile, (for example, say something has been damaged by an explosion, or the unit is a 4-ton tank and it's driving inside of a house) it will break through the floor and fall down. It will keep falling until it hits something that can support it, (or until it reaches the bottom z-level) No damage is currently done, but it does keep track of the distance that the unit fell. I'll likely institute falling damage, based on some preset 'free' bit of cushion based on whatever a unit's species/training may be, how much weight they're carrying, how far they've fallen, and perhaps how many spare TUs they have when they've hit the ground.

Next I'll need to write some sort of recursive function, perhaps, to check if every floor tile is being supported by something strong enough. I'd like to incorporate the aspects of X-Com Apocalypse that I found nice; and one of those was a destructible city. I want a high-explosive round to be able to topple a 3 story house. (though, the residents wouldn't like it that much and would likely demand compensation)

I'd like to make this game a bit more dynamic than X-Com was. Things I plan to include:

being able to jump various distances.
being able to climb over various things.

3 comments:

droid factorial said...

Nice work.

About collateral damage: keep it simple. I would abstract that out completely, lest you track of the price to replace every single square of terrain, and who owned what. Not saying it would be impossible to do all that (if you wanted to it wouldn't need to be that complicated). Just look for ways to make it simple.

However if you destroy a building and there were people in it then you would get a bad mission rating because of the deaths of civilians were a result of x-com action (in x-com a civilian killed by an alien costs fewer points than one killed by x-com operatives). This simple mechanism (vary the points awarded) gave the player hard decisions (do we take the shot at an alien even though a civilian is in the way?) as well as revealing the pessimism of the founding nations ("We are sure that the person would have survived if you hadn't shot them. Perhaps we are better off without X-COM")

It is interesting that you are checking that the ground can support the unit (as opposed to only whether the ground exists at all). It would be cool if a unit that had enough spare TU and good reactions stepped on a weak spot then immediately jumped back as the floor collapsed. Might be hard to balance and make understandable to the player, because the player might have wanted the soldier to go down the quick way through the damaged floor. If you want to do this I see a few options:
1) The time units are refunded if the soldier immediately chooses to go back to the square that collapsed (and thus fall down).
2) Jumping back is free in TUs but is a very tough reflex save.
3) Only jump back if falling would cause damage or death, but actually consume TUs without worrying about giving them back.
4) If the saving throw is made ask the player if they want to fall or not ( 4 could be the worst solution, for some reason it feels wrong).

Another idea I will throw out is Left 4 Dead style cliff-hanging-on to avoid death from falling. Another person could help the clinger-on up. The clinger would hang on based on endurance which would drain based on strength vs weight.


(And I thought it was hilarious that you could destroy completely just the first floor of a building and leave everything above it hovering.)

abagoforanges said...

I'm glad that you find some of my ideas interesting. I do plan to have a sort of 'just hanging on' status for agents who've fallen through a hole. I think it will likely be an extension of the way that opportunity fire works; there would be some arbitrary number of TUs that you'd need to have left when you fall/jump through a hole to hang on. If you meant to jump through, perhaps hanging, you'd be roughly one level lower so that when you did finally jump (on purpose) you'd have one less level to fall. If you didn't jump on purpose... depending on strength/energy/your weight, you could pull yourself up. Or, like you suggest, someone else could help you up.

You could hang on for as many turns as perhaps you had energy, each consecutive turn would drain more energy in the same way that low-powered agents can't just use up all of their TUs every round to move around, without eventually depleting their energy. Except, when you're hanging and you no longer have energy, you fall.

I do hope to abstract the damage to civilian buildings. Killing civilians will definitely be a bad thing, killing their pets will likely be less-bad, destroying the outdoors won't be that big of a deal. (I figure, if aliens come to a neighborhood and a few trees get set on fire, that's not a big deal) damaged houses might count against you in some way, but it won't be, 'you busted up 14 tiles at 500$ a tile.' I'll likely have a few 'special' varieties of mission where there is something of keen interest to the aliens, (perhaps a national monument) that will be much more valuable if it's destroyed. Also, there's the possibility that once I get to the point where I'm making missions, that killing civilians will do more than just cost points, but could occasionally get civilians to be alien sympathizers, etc.

Jotaf said...

Nice :)

About the reflex when standing on weak ground, there's one cue that the player would surely understand - if that weak ground actually collapses, the player can clearly see that the unit just evaded a bad situation.