huge feature's collision goin wrong

huge feature's collision goin wrong

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

huge feature's collision goin wrong

Post 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
Last edited by wolas on 10 Sep 2011, 14:40, edited 2 times in total.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: huge feature's collision goin wrong

Post by PicassoCT »

dds skybox.

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

Nice work by the way.
wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

Re: huge feature's collision goin wrong

Post by wolas »

I used existing dds. they dont work... Will create thread in maps for map problems.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: huge feature's collision goin wrong

Post by PicassoCT »

dds of a existing map, or from a outside source? Because there are quite differences on how a engien swallows a skycube..
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: huge feature's collision goin wrong

Post 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.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: huge feature's collision goin wrong

Post by KDR_11k »

AOE calculations use the unit's radius, not its collision volume.
wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

Re: huge feature's collision goin wrong

Post 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.
wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

Re: huge feature's collision goin wrong

Post 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
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: huge feature's collision goin wrong

Post 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.
wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

Re: huge feature's collision goin wrong

Post 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.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: huge feature's collision goin wrong

Post by Beherith »

IIRC lasers shoot through it if you use the 'blocking' tag set to false.
wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

Re: huge feature's collision goin wrong

Post by wolas »

But then you can walk through which looks even weirder.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: huge feature's collision goin wrong

Post by Beherith »

maybe try hitdensity=0?
hope you dont mind me throwing this stuff at you :)
wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

Re: huge feature's collision goin wrong

Post 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.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: huge feature's collision goin wrong

Post by jK »

Beherith wrote:maybe try hitdensity=0?
hope you dont mind me throwing this stuff at you :)
hitdensity isn't implemented yet
wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

Re: huge feature's collision goin wrong

Post by wolas »

I know features name I need to know all instances "alive" in map how to do so correctly?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: huge feature's collision goin wrong

Post by smoth »

Keep table of features, remove from table on destroyed
wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

Re: huge feature's collision goin wrong

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: huge feature's collision goin wrong

Post 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.
wolas
Posts: 112
Joined: 30 Jul 2010, 20:40

Re: huge feature's collision goin wrong

Post 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		
Post Reply

Return to “Game Development”