Page 1 of 2

huge feature's collision goin wrong

Posted: 05 Sep 2011, 00:29
by wolas
I created huge feature -> "rope" and as you see collision box is set right, but it still colides(receives damage, blocking is ok ) far outside the box why there is such behavior? (to see features collision box I changed .s3o of nest unit + copy pasted collision boundaries. Is here normal way to see features collision box without changing feature to unit?)

Also my map WWF_raw is almost finished just those ropes left and maybe some jappanese announcer(since nobody understands japanese(i hope)) :D but for that I would need to learn lua... And scoreboard maybe :)

Image

forgot to use spring internal screenshoter... thats why it looks weird ^

Image
FIXED ropes via gadget thnx for idea Beherith, needs code inspection (2nd my script).
FIXED Forgot to mention zero dds skyboxes work... why could be so?
Map's thread and map istelf can be found at http://springrts.com/phpbb/viewtopic.php?f=13&t=26736

Re: huge feature's collision goin wrong

Posted: 05 Sep 2011, 01:03
by PicassoCT
dds skybox.

8:8:8:8 ARGB Cubemap.. use nvidias photoshop tool.

Nice work by the way.

Re: huge feature's collision goin wrong

Posted: 05 Sep 2011, 01:26
by wolas
I used existing dds. they dont work... Will create thread in maps for map problems.

Re: huge feature's collision goin wrong

Posted: 05 Sep 2011, 01:31
by PicassoCT
dds of a existing map, or from a outside source? Because there are quite differences on how a engien swallows a skycube..

Re: huge feature's collision goin wrong

Posted: 05 Sep 2011, 05:53
by knorke
Is here normal way to see features collision box without changing feature to unit?
try a 0.83 engine test version, iirc it shows features hit boxes.

also is that a sphere as collision volume?
try a box or horinzontal zylinder.

Re: huge feature's collision goin wrong

Posted: 05 Sep 2011, 08:45
by KDR_11k
AOE calculations use the unit's radius, not its collision volume.

Re: huge feature's collision goin wrong

Posted: 06 Sep 2011, 13:00
by wolas
Ok I tried to change radius which results in invulnerable (almost, only middle is vulnerable) ropes... Also hitbox is sphere not box even when I did specify it. So is there way to make it "normal"? Now you can dgun ropes from mile away.

Re: huge feature's collision goin wrong

Posted: 06 Sep 2011, 22:51
by wolas
Rope collision now is set right before vertical ropes was wrong(horizontal collision sphere instead of vertical (compiled spring 0.83 for that) )... by swaping x and y parameters fixed it. And this swaping coused some weird things with radius. When it was not swaped radius works good, but with swaped x and y parameters radius somehow becomes 1 or something (in .s3o radius is correct) and ropes becomes undestroyable by dgun. only wide area weapons at center do that, changing these values back fixes radius and make's collision wrong again.

Well now 2 things dont work collision and radius probably will make ropes collsion near 0 and fix radius if we can call it fix since it is wrong

Re: huge feature's collision goin wrong

Posted: 07 Sep 2011, 11:09
by Beherith
I know this sounds like a dirty workaround, but I dont see a flaw in it:
make segments of rope, and add a lua gadget that watches for the rope segment being destroyed; if so, destroy the whole length of rope.

Re: huge feature's collision goin wrong

Posted: 07 Sep 2011, 18:28
by wolas
Yes it sounds like dirty workaround specially when I have 0 xp with lua and I m not programmer either. What I dont like about feature's that lasers dont shot them. Probably will make this rope destroyable by walking with com that will solve "lasers dont shot because of feature" problem and this too. Yes it is cheap solve, or maybe I should make it as GAIA unit or how it is called then lasers would work.

Re: huge feature's collision goin wrong

Posted: 07 Sep 2011, 23:07
by Beherith
IIRC lasers shoot through it if you use the 'blocking' tag set to false.

Re: huge feature's collision goin wrong

Posted: 08 Sep 2011, 10:31
by wolas
But then you can walk through which looks even weirder.

Re: huge feature's collision goin wrong

Posted: 08 Sep 2011, 10:48
by Beherith
maybe try hitdensity=0?
hope you dont mind me throwing this stuff at you :)

Re: huge feature's collision goin wrong

Posted: 08 Sep 2011, 11:11
by wolas
It is already 20 so some shots pass through something like from stardust which uses aoe. Tried 0 and 100 again affects only aoe weapons kinda sad. Will try to make GAIA unit (like zero-k planetwars structure) when will figure it out how to do so that might be best option.

I dont mind reading advices at all :) Correct they or not that might still generate some idea.

Re: huge feature's collision goin wrong

Posted: 08 Sep 2011, 11:17
by jK
Beherith wrote:maybe try hitdensity=0?
hope you dont mind me throwing this stuff at you :)
hitdensity isn't implemented yet

Re: huge feature's collision goin wrong

Posted: 09 Sep 2011, 20:59
by wolas
I know features name I need to know all instances "alive" in map how to do so correctly?

Re: huge feature's collision goin wrong

Posted: 09 Sep 2011, 21:09
by smoth
Keep table of features, remove from table on destroyed

Re: huge feature's collision goin wrong

Posted: 09 Sep 2011, 22:23
by wolas
I m writing gadget.
How to know what each global do? Now I know here exists global "featureDef" but it isint in gadgets.lua also didint found in wiki. Maybe missed it somewhere? sorry then.

EDIT: Probably ^ is nonsense.

Re: huge feature's collision goin wrong

Posted: 10 Sep 2011, 02:30
by knorke
How to know what each global do?
no docu on that :/
have to look at other peoples code to figure out what global tables exist or what they are good for.
I m writing gadget.
You will probally want something like this but for features:
http://springrts.com/phpbb/viewtopic.php?f=23&t=25435
maybe looking at tp_featureexploder.lua in Spring Tanks is helpfull too.

Re: huge feature's collision goin wrong

Posted: 10 Sep 2011, 14:38
by wolas
Ok here is my gadget. I hope I didint made any major mistakes? now there is 5 pieces of rope destroy one you will destroy whole rope. If everything is ok will release map very very soon.

Code: Select all

function gadget:GetInfo()
  return {
    name      = "Fix ropes",
    desc      = "Destroys ropes",
    author    = "wolas",
    date      = "2011",
    license   = "GPL with exception, you must first watch http://www.youtube.com/watch?v=uMs031Eauw8 and click like :P",
    layer     = 0,
    enabled   = true,
  }
end

if (not gadgetHandler:IsSyncedCode()) then
  return false  --  silent removal
end

local DestroyF = Spring.DestroyFeature
local GetDefID	=Spring.GetFeatureDefID
local defID
local hor_b={}
local hor_b_i = 0
local hor_b_d = true --dead? to prevent recursion, but still could be better prevention?
local hor_r={}	    	
local hor_r_i =0	
local hor_r_d = true
local vert_b={}
local vert_b_i =0	
local vert_b_d = true
local vert_r={}
local vert_r_i =0	
local vert_r_d = true
--local allFtres={}

function gadget:GamePreload()

	allFtres = Spring.GetAllFeatures()
	for name, value in pairs(allFtres) do 
		if GetDefID(value) ~= nil then
			if FeatureDefs[GetDefID(value)].name == "rope_horiz_blue" then
				hor_b_i=hor_b_i+1
				hor_b[hor_b_i]=value
			elseif FeatureDefs[GetDefID(value)].name == "rope_horiz_red" then
				hor_r_i=hor_r_i+1
				hor_r[hor_r_i]=value
			elseif FeatureDefs[GetDefID(value)].name == "rope_vert_blue" then
				vert_b_i=vert_b_i+1
				vert_b[vert_b_i]=value
			elseif FeatureDefs[GetDefID(value)].name == "rope_vert_red" then
				vert_r_i=vert_r_i+1
				vert_r[vert_r_i]=value
			end
		end
	end
end	

function gadget:FeatureDestroyed(featureID, allyTeam)
	defID = GetDefID(featureID)
	if FeatureDefs[GetDefID(featureID)].name == "rope_horiz_blue" and hor_b_d  then
		hor_b_d = false
		for i=1,hor_b_i do
				DestroyF(hor_b[i])
		end
	elseif FeatureDefs[GetDefID(featureID)].name == "rope_horiz_red" and hor_r_d  then
		hor_r_d = false
		for i=1,hor_r_i do
				DestroyF(hor_r[i])
		end
	elseif FeatureDefs[GetDefID(featureID)].name == "rope_vert_blue" and vert_b_d  then
		vert_b_d = false
		for i=1,vert_b_i do
				DestroyF(vert_b[i])
		end
	elseif FeatureDefs[GetDefID(featureID)].name == "rope_vert_red" and vert_r_d  then
		vert_r_d = false
		for i=1,vert_r_i do
				DestroyF(vert_r[i])
		end
	end
end