Page 1 of 1

Couple of bugs

Posted: 16 Apr 2014, 10:00
by klapmongool
1. Fighters can kill air factories because they aim at an air unit that is being built.

2. The blue graphic for adv generators that are positioned on the very edge of the map wont display properly. The graphic displays completely on the map instead of cutting off at the edge. Check it out ingame, it is easy to see.

Re: Couple of bugs

Posted: 16 Apr 2014, 20:36
by Forboding Angel
1. Spring issue. Not much i can do about it unless spring has some way to tell aircraft that they can't shoot other aircraft that are being built (afaik this doesn't exist atm).

2. Yeah I know. I blame zwzsg :-) That said, the graphic does not exceed the blue circle, it just looks weird. I'll see if I can get z to switch it up. I've already looked and that code is beyond my understanding.

Re: Couple of bugs

Posted: 16 Apr 2014, 21:02
by zwzsg
:o I don't even recall what this is.

Re: Couple of bugs

Posted: 16 Apr 2014, 21:17
by Forboding Angel

Re: Couple of bugs

Posted: 17 Apr 2014, 08:03
by klapmongool
Ok.

About the fighters: It seems they hit the air factory because it is in the way of the air unit being built. If the unit would be 'on top' instead of 'in' the factory it would not kill the lab probably?

Re: Couple of bugs

Posted: 17 Apr 2014, 10:48
by Anarchid
1. Spring issue. Not much i can do about it unless spring has some way to tell aircraft that they can't shoot other aircraft that are being built (afaik this doesn't exist atm).
You're not ZK, you can use armor classes :)

Re: Couple of bugs

Posted: 17 Apr 2014, 11:02
by knorke
1) Spring.SetUnitNeutral = unit does not get targeted by enemies anymore

In case players manualy targeting unfinished aircrafts: Block such orders with AllowCommand()

To make fighters deal less* damage vs factories: armor classes
(*think 1 is minimum)

To make fighters deal zero damage vs factories: UnitPreDamaged

Re: Couple of bugs

Posted: 17 Apr 2014, 11:20
by knorke
2)Maybe coordinates in this gets clamped to mapborder:
gl.DrawGroundQuad(x-xs,z-zs,x+xs,z+zs,false,0,0,1,1)
For example placing a building a left mapedge:
x=near 0
xs=100 (or whatever size the decal is)
So because of the clamping it gets drawn with 0 instead of -100.
Since only one part of the x or z coordinate pairs ever gets clamped, the texture appears stretched?

Re: Couple of bugs

Posted: 17 Apr 2014, 12:44
by Jools
knorke [numbering added] wrote:1) Spring.SetUnitNeutral = unit does not get targeted by enemies anymore

2) In case players manualy targeting unfinished aircrafts: Block such orders with AllowCommand()

3) To make fighters deal less* damage vs factories: armor classes
(*think 1 is minimum)

4) To make fighters deal zero damage vs factories: UnitPreDamaged
I think options 1) and 4) are best. 2) is problematic because then you have the interface say one thing and the resulting action being something else. We need less of this in spring, not more.

3) is reserved for zk it seems ;)

Re: Couple of bugs

Posted: 17 Apr 2014, 21:33
by zwzsg
Right, I coded it for you some times ago.

If it fails on the edge of the map, I suppose it's because gl.DrawGroundQuad doesn't like map edges. So I guess you could replace

Code: Select all

gl.DrawGroundQuad(x-xs,z-zs,x+xs,z+zs,false,0,0,1,1)
by something such as:

Code: Select all

gl.BeginEnd(GL.QUADS,
	function()
		local v=function(x,z,u,v)
			gl.TexCoord(u,v)
			gl.Vertex(x,Spring.GetGroundHeight(math.max(0,math.min(Game.mapSizeX,x)),math.max(0,math.min(Game.mapSizeZ,z))),z)
		end
		v(x-xs,z-zs,0,0)
		v(x-xs,z+zs,0,1)
		v(x+xs,z+zs,1,1)
		v(x+xs,z-zs,1,0)
	end)
Of course it would cause massive tearing as textures fight for the depth buffer, which must be fixed by a judicious use of gl.PolygonOffset.

And if you find textures floating half-way out of map ugly, then you have to limit the x and z to map dimension, and cut exactly as much in the texture coordinate space.