FeatureRequest: Spring.SetUnitShadowOnly

FeatureRequest: Spring.SetUnitShadowOnly

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

Moderator: Moderators

Post Reply
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

FeatureRequest: Spring.SetUnitShadowOnly

Post by PicassoCT »

Feature Request: Spring.SetUnitShadowOnly(unitid, bool true/false)

Basically sets a unit invisible, but for its shadow- which still can slowly wander across the battlefield, drowning the world in fear of -the deathstar.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by Jools »

Why not incorporate this in Spring.SetUnitCloak() instead, an optional parameter whether it casts shadow or not.

Hint: Vampires™ cast no shadow.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by Anarchid »

Do you even into rtfm
For the following calls drawMode can be one of the following, notDrawing = 0, normalDraw = 1, shadowDraw = 2, reflectionDraw = 3, refractionDraw = 4.

addon.DrawUnit(unitID, drawMode)
return: bool suppressEngineDraw

For custom rendering of units, enabled here.
So....

Code: Select all

function gadget:DrawUnit(unitID, drawMode)
  if (isOnlyShadow(unitID) and not drawMode == 2) then return true end
  if (isVampire(unitID) and drawMode == 2) then return true end
end
There you go, some units are only shadows, and units which are vampires, don't drop shadows.
Also units which are shadows and vampires at the same time, are completely not rendered.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by PicassoCT »

Why to even use engine? Fucking Linux Kernel and all drivers needed are here
https://github.com/torvalds/linux

If you can modify everything easily (by Anarchid standards) doesent mean the rest of the world get its.
So why use spring engine, you could code spring games in assembler, with open gl- fuck the API- if you truelly want to stick it to the man, why be here anyway?

The simple answer is- that call is going to be there in the wikki- that codesnippet is going to be burried under a ton of picasso posts, and never to be seen again.

The reason why there are apis, is to shield away knowledge - a concept called abstraction.. you propably never heard of it.


:)
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by Anarchid »

And i there thought that addon:DrawUnit was part of a documented API.

Apparently though it's as brutal as assembler, huh.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by PicassoCT »

Because that is something basic. Making stuff binary visible and invisible is so basic, it was in OTA as cloak. But to modify cloakyness means modifying gamemechanics, while all you might want, is hide it from plain sight of the player. Which transports you into advance coding country, where you have to hang around with the opengl/glsl guys who can not even comprehend why this might be difficult stuff. And on how many levels a newb might botch this.

Fuck this, i shall write a patch.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by Jools »

Opengl to draw unit shall be avoided (gl.Unit and gl.UnitShape etc). See Ghostradar and Ghostsite for example why this is very expensive.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by smoth »

that's nice, and the alternative you want to suggest?
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by gajop »

You can pretty much assume that no such changes will happen if that functionality can be achieved by other means.
It kinda looks hacky (seeing as it doesn't function as a property of the unit, e.g. you couldn't do a GetUnitShadowOnly()), but it allows you to do unsynced rendering which is nice.
Jools wrote:Opengl to draw unit shall be avoided (gl.Unit and gl.UnitShape etc)
That's not what Anarchid's code is doing.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by Anarchid »

So, is your engine modification done yet?

Code: Select all

shadowUnits = {};
vampireUnits = {};

function isOnlyShadow(unitID)
      return tobool(shadowUnits[unitID]));
end

function isVampire(unitID)
     return tobool(vampireUnits[unitID]);
end

function setUnitVampire(unitD, value)
     vampireUnits[unitID] = tobool(value);
end

function setUnitShadowOnly(unitD, value)
     shadowUnits[unitID] = tobool(value);
end

Spring.SetUnitShadowOnly = setUnitShadowOnly;
Spring.SetUnitVampire = setUnitVampire;
Look what we have now!

Spring.SetUnitShadowOnly
Spring.SetUnitVampire
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by zwzsg »

You might want to remove from the lists units which are destroyed.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by gajop »

Anarchid wrote:Spring.SetUnitShadowOnly
Spring.SetUnitVampire
We are very interested in your solutions.
Our team wants to know how it will work with the Save/Load mechanism proposed by Mister Google Frog.
Thank you for your time,
Gajo
:oops:
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by PicassoCT »

The Warden of the Wikki rejects your lua stuff- as mod dependent, and thus something the noobs, shall go questing for, begging and battling until they find it, hidden away in a dungeon.

Thus spoke the Warden of the Wikki


Seriously, though, we should errect higher class barriers- there are getting a awfull lot of noobs in lately.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: FeatureRequest: Spring.SetUnitShadowOnly

Post by smoth »

I still want to see jools alternatives to those 2 calls so I can learn more.
Post Reply

Return to “Engine”