Shield rewrite

Shield rewrite

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
Agon
Posts: 527
Joined: 16 May 2007, 18:33

Shield rewrite

Post by Agon »

Hello,

I am planning to rewrite the Shield/Repulsor mainly because they don't look good and aren't really much modifiable.
(Also I need to learn C++.)

The plan is to have a shield which can look like a personal shield or a area shield. Deforms on impact and wobbles. Grows and shrinks. Connects with other shields. Has different shapes like a front shield similar to the one in UT which one of the tanks has.

I'm planning to write something like that:
Visual variables:
  • bool IsShield
  • string ShieldTexture
  • float4 ShieldColor
  • string ShieldShader
Repulsor variables:
  • bool ShieldRepulsor
  • bool ExteriorShield
  • bool SmartShield
Resource variable:
  • int ShieldPower
Size/Shape variables:
  • int ShapeType //Circle, square, ..
  • float3 Size
  • float Radius
  • float StartRadius
The goal is to modify most of the variables through Lua like shield power and impact effects. Maybe even resources but I don't know yet.

Would be cool if we had a math library which could read mathematic expressions which I could use to create a shield or I could make it somehow possible to shape the Shield via Lua...

Thats only a small concept, I would like to have some feedback on that and some thoughts. I will probably not finish that over the 4 days over easter.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Shield rewrite

Post by zwzsg »

No matter how much better is the new system in your mind, you'll get flak if it isn't 100% backward compatible.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Shield rewrite

Post by hoijui »

please make vars start with lower case ;-)
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Shield rewrite

Post by SirMaverick »

User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Re: Shield rewrite

Post by koshi »

Agon wrote:Would be cool if we had a math library which could read mathematic expressions
I think dolfin/fenics has an expression parser you could have a look at.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Shield rewrite

Post by Pxtl »

I really don't see the point, since any math expression you would want to write you could do just as easily using a Lua callout. Spring doesn't need any more languages.
User avatar
Agon
Posts: 527
Joined: 16 May 2007, 18:33

Re: Shield rewrite

Post by Agon »

Instead of a math expression we could use a simple mesh for collision detection.

Edit:
Pxtl wrote:I really don't see the point, since any math expression you would want to write you could do just as easily using a Lua callout. Spring doesn't need any more languages.
No new language. I thought of a math expression but adding one more library dependency is a no go.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Shield rewrite

Post by Beherith »

zwzsg wrote:No matter how much better is the new system in your mind, you'll get flak if it isn't 100% backward compatible.
Seriously, dont worry about it. There were plenty of such changes (that werent backwards compatible, or even much better than the previous) but are now accepted after a small amount of initial bawing.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shield rewrite

Post by Argh »

Shield hit callin would be nice.
+1

Personally, I think that if we just had a shield-hit callin that would give us the weapon ID, we could do practically anything we wanted to, using only Lua. I'd really just see shields be just a generic collision volume that was separate from the Unit collision volume, but used the same math (i.e., move the collision-volume code to an include, if it isn't already) that we were expected to code graphical effects for, myself. I don't mind keeping the current Shield tags intact, although I'd like to see an if-then excluding all the resource code per-hit if we set the values to zero, so that Lua-based solutions run without hidden overhead.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shield rewrite

Post by AF »

The core of the logic for the shields should be implemented as a lua gadget, so that those who see fit to mess around with the fundamentals can do so without hitting barriers
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Re: Shield rewrite

Post by Das Bruce »

Different reactions to different weapons, eg one should be stopped and one shouldn't.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shield rewrite

Post by Argh »

The core of the logic for the shields should be implemented as a lua gadget, so that those who see fit to mess around with the fundamentals can do so without hitting barriers
It's impractical to do that without having a fast volume-search for projectiles via a callin.
Different reactions to different weapons, eg one should be stopped and one shouldn't.
They can already do that.
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Re: Shield rewrite

Post by Das Bruce »

Argh wrote:They can already do that.
Excellent. Can they respond with different behavious? Missiles explode shells repel ?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Shield rewrite

Post by Argh »

Short answer, no. Long answer... if we had a ShieldHit() callin and could create new WeaponProjectiles on the fly, we could make them do anything we want. For details on how filtering works, read the Wiki, it's in the weapon specifications.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Shield rewrite

Post by zwzsg »

Das Bruce wrote:
Argh wrote:They can already do that.
Excellent. Can they respond with different behavious? Missiles explode shells repel ?
Could do that with two shields, one that repell shells and let missiles through, one that make missiles explode and let shells through...
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Shield rewrite

Post by Google_Frog »

Wishlist:
  • Shieldhit callin with the arguments stated in the thread
  • A shield type(or ability to do in lua) which has predictable cost/projectile like the destructor shield and the repulsion behaviour of replellers. This would be done by paying a certain initial cost which then lets the projectile be replelled for free for the duration of it's time inside the shield.
  • Shields which do not repel shots shot inside them but do repel shots which where shot out and re-entered.
  • The ability to disable sections of shield. This would be used for directional shields and the creation of supcomm style shield melding.
  • Shield melding.
  • The ability to turn off wobbling and deformation.
Most of these wishes could be fullfilled with a shield hit calling. It has arguments (ShieldID, AttackerID, damage, collision position, weaponID) and returns whether the shield is allowed to destroy/repel the projectile. The callin would trigger even if the shield does not have enough charge to normally stop the projectile, like UnitPreDamaged.

Resizing shields and disabling sections of them would be nice but I would preffer a quick addition of shieldHit than a fully fledged new system. If you're going with a new system resizing, disabling segments (maybe defined as intersections of spheres or planes?) and different shapes would be really nifty.

Would the impact deformation and wobble be purely graphical? Like water effects?

I don't think shield linking should be coded into the engine at all. Linking algorithms are bound to be game specific so there is no point hardcoding anything about it into the engine.CA has a functional shield link system that would be vastly improved with a shield hit callin.

Disabling segments with lua would improve the linking options slightly though if it is impractical to expose to lua at least let lua define shields that are 'overlapping'. Overlapping means that projectiles inside a shield would not be affected by shields that are overlapping with the shield they are inside.
The plan is to have a shield which can look like a personal shield
What is a personal shield? Just a really small area shield? If it's a Starcarft style shield don't bother with it as it is very luaable.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Shield rewrite

Post by jK »

@Agon

Please, don't do what you plan to do. Spring is already at its CPU limit. Such effects (wobble etc.) should be done on the GPU, don't even try to compute them on the CPU. Also as the other responses already mentioned, the visual of shields should be totally implemented via the mod (LuaRules) cause of the missing flexibility via tags & support for non-GLSL gpus etc.

So just following changes should be done to the engine:
* ShieldHit lua-callin
* 2 new shield primitives: box & cone
* ability to add multiple shields to one unit
* ability to change the size of a shield via lua
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Shield rewrite

Post by zwzsg »

jK wrote: * ability to add multiple shields to one unit
We already have that.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Shield rewrite

Post by Pxtl »

Ooh, the ability to disable a segment of a shield would be nice. You could even have an anti-shield device that actually punches holes in the shield, or an anti-shield mobile unit that projects an anti-shield zone around it. And, of course, graphical shield melding... however you'd want to weld the vertices at the edge.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Shield rewrite

Post by jK »

zwzsg wrote:
jK wrote: * ability to add multiple shields to one unit
We already have that.
Yeah, I remember it vague.
Post Reply

Return to “Engine”