I copied & renamed my modified teamplatters widget. And replaced the 1 display list call for polygons with 1 display list call for texture quad. Which I believe is more of a valid test of texture vs polygon than comparing two DIFFERENT widgets, as VBS did. But feel free to use his result to declare yourself the winner if you want to look stupid.TradeMark wrote:rofl, he just keeps posting his results with no evidence at all. gj man
New widget: Enemy Spotter
Moderator: Moderators
Re: New widget: Enemy Spotter
Re: New widget: Enemy Spotter
Again, I want to emphasize that my version isn't just apples-to-apples: people said they wanted to see the real TC, so I put that in.
And I screwed up with the placement of that darn glTexture callout. Bad coder! Bad!
It would probably be wisest to release your modified version of this, or I'll just do a cleanup of TradeMark's when I get a chance.
And I screwed up with the placement of that darn glTexture callout. Bad coder! Bad!
It would probably be wisest to release your modified version of this, or I'll just do a cleanup of TradeMark's when I get a chance.
Re: New widget: Enemy Spotter
Your texture quad code + global visible units table + radius table + basic optimization = my widget. Basically. It's nothing fancy.Argh wrote:It would probably be wisest to release your modified version of this, or I'll just do a cleanup of TradeMark's when I get a chance.
Re: New widget: Enemy Spotter
Here ya go: apples vs. apples. Except I use RED, not BLUE, as the stock color. Hehe.
With fixes from jK.
Code: Select all
function widget:GetInfo()
return {
name = "Enemy Spotter v.2",
desc = "Draws smoothed octagon under enemy units",
author = "Argh,TradeMark,Trepan",
date = "December 17th, 2009",
license = "(C) WolfeGames, released under GNU GPL, v2 or later",
layer = 5,
enabled = false -- loaded by default?
}
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Automatically generated local definitions
local glBeginEnd = gl.BeginEnd
local glTexCoord = gl.TexCoord
local glTexture = gl.Texture
local GL_QUADS = GL.QUADS
local glColor = gl.Color
local glCreateList = gl.CreateList
local glDeleteList = gl.DeleteList
local glDepthTest = gl.DepthTest
local glDrawListAtUnit = gl.DrawListAtUnit
local glVertex = gl.Vertex
local GetVisibleUnits = Spring.GetVisibleUnits
local spGetUnitDefID = Spring.GetUnitDefID
local spGetUnitTeam = Spring.GetUnitTeam
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local LocalTeam = Spring.GetLocalTeamID()
local ENEMY_UNITS = Spring.ENEMY_UNITS
local texture = "bitmaps/StaticCircle.tga"
local radiusDefs = {}
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function widget:Initialize()
for uDefID, uDef in pairs(UnitDefs) do
radiusDefs[uDefID] = uDef.radius * 1.25
end
SimpleCircle = glCreateList(function()
glBeginEnd(GL_QUADS, function()
glTexCoord(0.04,0.04)
glVertex(-1,10,-1)
glTexCoord(0.96,0.04)
glVertex(1,10,-1)
glTexCoord(0.96,0.96)
glVertex(1,10,1)
glTexCoord(0.04,0.96)
glVertex(-1,10,1)
end)
end)
end
function widget:Shutdown()
glDeleteList(SimpleCircle)
end
function widget:DrawWorldPreUnit()
glDepthTest(true)
glTexture(texture)
glColor(1.0,0,0,1.0)
local teamID, ud
local visible = GetVisibleUnits(ENEMY_UNITS, nil, false)
for i = 1,#visible do
unitID = visible[i]
teamID = spGetUnitTeam(unitID)
if teamID ~= LocalTeam then
ud = spGetUnitDefID(unitID)
radius = radiusDefs[ud]
glDrawListAtUnit(unitID, SimpleCircle, false, radius, 1.0, radius, 0, 0, 0, 0)
end
end
glTexture(false)
end
Last edited by Argh on 18 Dec 2009, 15:29, edited 1 time in total.
Re: New widget: Enemy Spotter
cmon please stop this beef and open a new thread about how to optimize widgets
Re: New widget: Enemy Spotter
yeah i said exactly same to you few pages agoArgh wrote:In testing over here, mine runs fast enough that I really just don't see much of a difference in total load while it's operating, so I think it's fair to say it's "fast".

tho, i still dont prefer any texture, since its not needed really
try to make same smoothed circle with textures... you need like 512x512 image for it
Re: New widget: Enemy Spotter
No, you can use a pretty small circle- 128, 256 at max. If it's just supposed to be a blurry glow like that, it'll be fine at normal distances. The main reason to use textures is to have some flexibility, though- the one in P.U.R.E. uses quite a few more of them, so that if it's a plain circle, it's a building, glow without facing, it's a soldier or mech, and so forth.
If you aren't a doofus, like I was, and reloading that texture constantly, it's pretty cheap.
If you aren't a doofus, like I was, and reloading that texture constantly, it's pretty cheap.
Last edited by Argh on 17 Dec 2009, 14:06, edited 1 time in total.
Re: New widget: Enemy Spotter
yeah try to make a krogoth... or juggernaut, they have pretty big circles
you could do all those simple geometric shapes without textures too
as a game designed, you probably know that it looks fugly when you see pixels (or blurred pixels) on something like that when you zoom in...
you could do all those simple geometric shapes without textures too
as a game designed, you probably know that it looks fugly when you see pixels (or blurred pixels) on something like that when you zoom in...
Last edited by TradeMark on 17 Dec 2009, 14:07, edited 1 time in total.
Re: New widget: Enemy Spotter
Nah, it's actually fine, up until HUGE stuff. Like, IDK, maybe 12X12 on a side, then it's obviously pixelated.
And making those shapes with polygons... meh, to keep it smooth, that's expensive, once it's not small. It's better to cheat, up until you need a 512 texture, imo. But I've never had to use one that big, on anything in P.U.R.E.- 256s were fine.
And sure, it's ugly, if you get to screenshot range. Heck, then it's obvious that it's a quad slicing right through stuff. So I just turn it off. But from overhead, typical distances? It's fine.
Meh, here's a screenshot. This is pretty zoomed-in- these guys are filling most of the screen (the original shot was 860 pixels wide):

And making those shapes with polygons... meh, to keep it smooth, that's expensive, once it's not small. It's better to cheat, up until you need a 512 texture, imo. But I've never had to use one that big, on anything in P.U.R.E.- 256s were fine.
And sure, it's ugly, if you get to screenshot range. Heck, then it's obvious that it's a quad slicing right through stuff. So I just turn it off. But from overhead, typical distances? It's fine.
Meh, here's a screenshot. This is pretty zoomed-in- these guys are filling most of the screen (the original shot was 860 pixels wide):
- Attachments
-
- screen00068.jpg
- (89.72 KiB) Downloaded 2 times
Last edited by Argh on 17 Dec 2009, 14:19, edited 1 time in total.
Re: New widget: Enemy Spotter
my octagon shape is enough, i cant even see its octagon, looks like circle to me (because i faded the edges so much), unless i really try to look at the shape... but who the fuck cares is it perfect circle or almost circle?
Edit: isnt that like 256x256 texture there? try to fill it with same way as i do, and look how your FPS goes down...
Edit: isnt that like 256x256 texture there? try to fill it with same way as i do, and look how your FPS goes down...
Re: New widget: Enemy Spotter
Well, sure, for the fade it's OK- I think that works just fine.
But for a circle like that? It'll look really faceted. Whether people care or not... meh, IDK, some people find it crude, some don't care.
And yeah... that's why I'm using a texture for that. I'm cheating. It just has to look like a circle, and be cheap. Not be a circle. Just saying, it works, up until really fricking huge stuff. And that could be a triangle with tiny dots, multiple colors, whatever. I am thinking that I need to rewrite the one for P.U.R.E. now, use a shader, make it dynamically alter over time, hehe.
But for a circle like that? It'll look really faceted. Whether people care or not... meh, IDK, some people find it crude, some don't care.
And yeah... that's why I'm using a texture for that. I'm cheating. It just has to look like a circle, and be cheap. Not be a circle. Just saying, it works, up until really fricking huge stuff. And that could be a triangle with tiny dots, multiple colors, whatever. I am thinking that I need to rewrite the one for P.U.R.E. now, use a shader, make it dynamically alter over time, hehe.
Last edited by Argh on 17 Dec 2009, 14:26, edited 1 time in total.
Re: New widget: Enemy Spotter
i know, i didnt want ring like that
Re: New widget: Enemy Spotter
Well, here's a glow, using a 64X64- it's just a simple circular gradient, nothing special. Looks all right. Would want to use 128 for really big stuff (this robot's 5X5 in World Builder, not as small as in CA):

- Attachments
-
- screen00069.jpg
- (95.06 KiB) Downloaded 2 times
Re: New widget: Enemy Spotter
why those circles are so small? if that was BA those circles would be 2x bigger in diameter...
try to make it look like my smooth shape
edit: made texture for you:

color = alpha and color
try to make it look like my smooth shape
edit: made texture for you:

color = alpha and color
Re: New widget: Enemy Spotter
I can make them bigger, if you want. In that source I posted, that's controlled here, btw:
Utterly non-fancy, could be made a lot fancier. That's probably fine for most 3DOs. Personally, I'd rather define it per unit with a customParam.

And sure, I'll be happy to test with the donut.
Code: Select all
radiusDefs[uDefID] = uDef.radius * 1.25
And sure, I'll be happy to test with the donut.
- Attachments
-
- screen00070.jpg
- (78.77 KiB) Downloaded 2 times
Re: New widget: Enemy Spotter
oh yeah i forgot, so my total "texture" size would be 1.5*1.75 = 2.625 compared to unit radiusArgh wrote:I can make them bigger, if you want. In that source I posted, that's controlled here, btw:
Code: Select all
radiusDefs[uDefID] = uDef.radius * 1.25
Re: New widget: Enemy Spotter
Hmm. Needs a narrower donut, wider pure white, with less glow, imo. I did a quick-fix with curves, but this isn't quite right. And yeah, I'll use 2.6, used 2.25 here but the circle shrank a lot when I used Curves.

- Attachments
-
- screen00071.jpg (41.72 KiB) Viewed 2154 times
Re: New widget: Enemy Spotter
hmm... looks really weird... :D not at all like my version 
dont edit the pic i sent you
actually my pic is totally wrong, outer fade should be larger etc...

dont edit the pic i sent you
actually my pic is totally wrong, outer fade should be larger etc...
Re: New widget: Enemy Spotter
Yeah, yours was just kind've a blurry glow, not a whole lot different than that first one I did. You couldn't see any ring around the units at all. Then I fixed that with Curves, but it was like half the size it needed to be.
Here, made the ring narrower, so that it's clearly a ring. 2.6 looks too big to me, tho. That can get fixed at the end, though.

Here, made the ring narrower, so that it's clearly a ring. 2.6 looks too big to me, tho. That can get fixed at the end, though.
- Attachments
-
- screen00072.jpg
- (84.29 KiB) Downloaded 2 times
Last edited by Argh on 17 Dec 2009, 15:06, edited 1 time in total.
Re: New widget: Enemy Spotter
try this

Edit: updated the image slightly longer outer fade >_>
also use blue this time, since its much more easier to see the color near the edges...

Edit: updated the image slightly longer outer fade >_>
also use blue this time, since its much more easier to see the color near the edges...
Last edited by TradeMark on 17 Dec 2009, 15:11, edited 1 time in total.