Non-Physical Cover System

Non-Physical Cover System

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Non-Physical Cover System

Post by Evil4Zerggin »

A non-physical cover system (that is, not based on engine physics). To use, define features as providing cover using customParams cover_strength > 1 and cover_radius > 0. Damage to mobile non-flying units is reduced by a factor of the best cover_strength they are within. Requires UnitPreDamaged callin, new in 0.79.
Be sure to enable the gadget and widget if you want to use them.

Image
The rifleman in the background is taking less damage than the rifleman in the foreground due to cover.

Gadget:
http://spring1944.svn.sourceforge.net/v ... _cover.lua

Display Widget:
http://spring1944.svn.sourceforge.net/v ... radius.lua

VERY crude right now, especially where optimization is concerned, so you may want to hold off on obvious suggestions.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Non-Physical Cover System

Post by hoijui »

nice! :D
i see you further and further approaching a certain other game :D
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Non-Physical Cover System

Post by imbaczek »

yeah, but it only makes sense.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: Non-Physical Cover System

Post by Neddie »

Considering the only WWII RTS besides this he and I have ever played is Hearts Of Iron II, we'd have no idea.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Non-Physical Cover System

Post by hoijui »

really??!
the game i mean is: Company of Hereos
i was so sure that this was one of the favourite games of all S44 devs!

@imbaczek
it surely makes sense, i see nothing bad in this.. i like it!
User avatar
Otherside
Posts: 2296
Joined: 21 Feb 2006, 14:09

Re: Non-Physical Cover System

Post by Otherside »

yeh this reminds me of CoH and DoW2 cover system i.e made of win
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Non-Physical Cover System

Post by KDR_11k »

But is it directional? I.e. will an attack from the rear side of the cover hit at full strength?
User avatar
thesleepless
Posts: 417
Joined: 24 Oct 2007, 04:49

Re: Non-Physical Cover System

Post by thesleepless »

cool, this is one of the things i liked most in dawn of war 2. troops automatically running towards cover when attacked could be cool... but i suspect a bit more difficult. i'm sure you could do it with lua.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Non-Physical Cover System

Post by imbaczek »

you could, but it won't be efficient unfortunately. these kinds of things are best done in the engine.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: Non-Physical Cover System

Post by Evil4Zerggin »

KDR_11k wrote:But is it directional? I.e. will an attack from the rear side of the cover hit at full strength?
Not ATM, I may consider something like that although it might be tricky to keep performance under control.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Non-Physical Cover System

Post by imbaczek »

a simple dot product should be enough - once a unit is in cover, you should know the direction cover is in, and you always know the direction of hits. updating cover every N frames intead of every frame would make it feasible IMHO.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: Non-Physical Cover System

Post by Evil4Zerggin »

I suppose I was more concerned about the possibility of multiple cover, although now that I think of it, it shouldn't be too bad in practice as long as we're reasonable about cover ranges.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Non-Physical Cover System

Post by KDR_11k »

Evil4Zerggin wrote:
KDR_11k wrote:But is it directional? I.e. will an attack from the rear side of the cover hit at full strength?
Not ATM, I may consider something like that although it might be tricky to keep performance under control.
It might work to simply modify the flankingbonus settings (I think we can do that now? Lurker?) to give the unit cover instead of the current damage reduction, that way it's also easier to micro and you can assume the unit will take cover so that its front is protected.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Non-Physical Cover System

Post by lurker »

Yay, finally the fact that it's a unit setting instead of a unitdef setting will come in handy!

You'll have to use getunitcobvalue, as I didn't make any lua bindings at the time. I suppose I'll make some now.

I also need to make it use explosion location now that that's more accurate.
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Re: Non-Physical Cover System

Post by SpikedHelmet »

I've not played CoH ever either. Infact the only WW2 RTS game I can think of having played is one of the old, old, pixel-based Close Combat series (I believe A Bridge Too Far, and then only the demo). Which is where I personally get most of my inspiration from, except I'm in no way shape or form involved with anything other than modelling and texturing so such inspiration is completely wasted. Well, that and a couple of good WW2 FPS games.

Cover is a natural extension of the realism we've strived to create. Solid-slug shells that slow down and do less damage the further they travel, accurate-ish armour directional relations, suppression and pinning, etc, all came out of our own asses.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Non-Physical Cover System

Post by FLOZi »

I've played CoH, and I think Nemo has as well. But yeah, everything CoH-like that's in S44 we wanted to do ourselves anyway.

Dunno why I didn't think of this. :? Then again it wasn't so trivial before the new callin.

edit: we should also use this to replace the currently rather not at all working tank-fear-shield system.
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Re: Non-Physical Cover System

Post by Nemo »

I've not played CoH, but played Close Combat ABTF a fair bit.

This is going to be an exciting change once we refine it.
User avatar
kburts
Posts: 134
Joined: 22 Mar 2009, 00:36

Re: Non-Physical Cover System

Post by kburts »

this is soo stronghold crusader, i remember back in the time when i thought the roofs of towers made you guys invincible.

no, they just gave them a temparaly health boost of about 10* so if you ran your guys in and out of towers, for some reason they'd heal :P
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Non-Physical Cover System

Post by Argh »

Yeah, the PreDamage callin greatly helped me speed up my version of NoSelfPwn, too, by removing some checks.

Might want to look at that, if you're using the one from CA (and it hasn't already been fixed).
Post Reply

Return to “Lua Scripts”