New widget: Enemy Spotter
Moderator: Moderators
Re: New widget: Enemy Spotter
thats too strong color, use opacity of 0.23 for the strongest color there just like in my widget, and change to blue color
then it should look perfect
then it should look perfect
Re: New widget: Enemy Spotter
It doesn't work like that. It's a quad. I can turn down total opacity, just by changing a line of code, tho.
As for blue... no way, you can change that line in your personal version:
But most people, including myself, strongly associate Red with Enemy, because that's the color code in most games. People can make it pink (1,0.9,0.9,0.9) if they want to, but my official version is red.
As for blue... no way, you can change that line in your personal version:
Code: Select all
glColor(0,0,1,0.9)
- very_bad_soldier
- Posts: 1397
- Joined: 20 Feb 2007, 01:10
Re: New widget: Enemy Spotter
Sorry, but I just cant see how using your own secret code nobody has ever seen while using a test environment you dont talk about is a valid test.Niobium wrote: 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.
Just add some facts and post your code already. We will all be happy if it is really three times as fast.
Re: New widget: Enemy Spotter
Uh, I posted my version of TradeMark's, so test that, it's pretty much apples-->apples.
I admit, in the other one I posted, I thought I'd sped it up enough for it to show true TC without adding to cost... wrong-o.
Curious to see how much moving that stupid glTexture helped, though. That was a stupid error, especially after me talking about how much those cost, in other contexts
That about what you wanted, TradeMark? That's that code I posted (the rewrite of yours), 2.6 for the radius, and glColor(0,0,1,0.5). Oh, and here's the modified TGA, it's in the zip.

Oh, and before anybody complains, yes, it clips. Don't want it to? Change glDepthTest(false), just be aware it might cause issues with other graphics.
I admit, in the other one I posted, I thought I'd sped it up enough for it to show true TC without adding to cost... wrong-o.
Curious to see how much moving that stupid glTexture helped, though. That was a stupid error, especially after me talking about how much those cost, in other contexts

That about what you wanted, TradeMark? That's that code I posted (the rewrite of yours), 2.6 for the radius, and glColor(0,0,1,0.5). Oh, and here's the modified TGA, it's in the zip.
Oh, and before anybody complains, yes, it clips. Don't want it to? Change glDepthTest(false), just be aware it might cause issues with other graphics.
- Attachments
-
- StaticCircle.zip
- (34.92 KiB) Downloaded 17 times
-
- screen00075.jpg
- (63.5 KiB) Downloaded 2 times
Last edited by Argh on 17 Dec 2009, 16:01, edited 2 times in total.
Re: New widget: Enemy Spotter
yeah something like that, now benchmark again by using those settings?
Re: New widget: Enemy Spotter
Yeah, should be a good test. I am really doubting there's going to be a 300% difference, though. I am kinda curious whether it'd get faster if I use a shader... surely not, for something this basic. But I may get bored and try it out, I think the one in P.U.R.E. needs some shader magic anyhow.
- very_bad_soldier
- Posts: 1397
- Joined: 20 Feb 2007, 01:10
Re: New widget: Enemy Spotter
Okay gentlemen, here are the results. Same setup as yesterday.
(I will post the profiler screenshots if someone wants to see, but you can just believe it without
)
I tested all three version again to be sure the results are comparable.
Again time in DrawWorldPreUnit:
Argh v2: 2.44 ms
Trademark: 2.79 ms
Argh: 4.24 ms
So, Argh has taken the lead (slightly). He is about 15% faster today.
PS. Argh your units look awesome!
(I will post the profiler screenshots if someone wants to see, but you can just believe it without

I tested all three version again to be sure the results are comparable.
Again time in DrawWorldPreUnit:
Argh v2: 2.44 ms
Trademark: 2.79 ms
Argh: 4.24 ms
So, Argh has taken the lead (slightly). He is about 15% faster today.
PS. Argh your units look awesome!
Re: New widget: Enemy Spotter
15% faster, and a texture. That's acceptable.
I assume that third figure's the fixed one with true TC? If so, then I should look at it again, removing that glTexture should've sped things up more than that, I'd have thought.
And that's not really "my" unit, it's a CA one I did a little repaint and minor fixes on, then applied a basic shader to. It's in WB because I wanted a generic "guardbot" for some maps where I wanted Gaia enemies. Credit where credit's due, that's certainly not my design.
I assume that third figure's the fixed one with true TC? If so, then I should look at it again, removing that glTexture should've sped things up more than that, I'd have thought.
And that's not really "my" unit, it's a CA one I did a little repaint and minor fixes on, then applied a basic shader to. It's in WB because I wanted a generic "guardbot" for some maps where I wanted Gaia enemies. Credit where credit's due, that's certainly not my design.
Last edited by Argh on 17 Dec 2009, 16:13, edited 1 time in total.
- very_bad_soldier
- Posts: 1397
- Joined: 20 Feb 2007, 01:10
Re: New widget: Enemy Spotter
The third one is the same as I tested yesterday. I made the same test again but added your v2 version this time.
Dont ask me why the absolute results for those two differ from yesterday, maybe I had VMWare running in background yesterday or something.
Dont ask me why the absolute results for those two differ from yesterday, maybe I had VMWare running in background yesterday or something.
Re: New widget: Enemy Spotter
Please test the fixed one. Really curious how close that got me to the original's speed. Probably not enough, but I'm hoping it's within 25%.
And meh, absolute results are going to vary with whatever's happening in the gamecode in general anyhow, I don't really take it all that seriously, so long as it's fast enough.
And meh, absolute results are going to vary with whatever's happening in the gamecode in general anyhow, I don't really take it all that seriously, so long as it's fast enough.
- very_bad_soldier
- Posts: 1397
- Joined: 20 Feb 2007, 01:10
Re: New widget: Enemy Spotter
Okay, did a complete set again. Results:
Argh v2: 2.40ms
Argh v1 fixed: 2.70ms
Trademark: 2.78 ms
Argh v1: 4.35 ms
Argh v2: 2.40ms
Argh v1 fixed: 2.70ms
Trademark: 2.78 ms
Argh v1: 4.35 ms
Re: New widget: Enemy Spotter
Well, I'll be darned. That was one really expensive one-line mistake. Guess I need to review all of my code now, that's just plain wasteful, and I'm probably guilty of similar screwups elsewhere. Thanks.
Re: New widget: Enemy Spotter
You are saving a lookup in the global table, followed by a lookup in the Spring table, and replacing it WITH an upvalue, which is faster. How did you manage to get the wrong labels for everything? Did you have the wrong definition of upvalue before this thread or did you make a weird assumption from my post?Argh wrote:My understanding about this was that if we localized like this:
local GetUnitPosition = Spring.GetUnitPosition
...then we're saving an upvalue call on a regular basis, because that memory address was localized within the application at runtime. What you're saying implies that it's being re-localized every pass, and therefore the cost savings are zero.
Doing that as opposed to what? You have to show me the change you mean or I can't tell how performance is altered. But you have some clear nonsense in there. value=value?Argh wrote:And, at least in the case of anywhere where we need to call a value in multiple places, it seems counterintuitive that we'd actually improve speed by doing this:
Code: Select all
subfunction(value) ... do stuff to value return value end function blah() local value ... do stuff to value subfunction(value) value = value end
WHAT initialization?Argh wrote:I mean, if that's actually better, fine, it just seems counterintuitive, I thought variable initialization wasn't something we should waste cycles on, though.
Re: New widget: Enemy Spotter
I might be a bit harsh, but:Argh wrote:Code: Select all
function widget:DrawWorldPreUnit() glDepthTest(true) glTexture(texture) glColor(1.0,0,0,1.0) local teamID, ud local visible = GetVisibleUnits(ALL_UNITS, myTeamID, 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 end
grrr I told you already MULTIPLE times you have to disable the texture after you used it! else the next widget will render everything with your damn texture!
Also the wiki says:
Code: Select all
Spring.GetVisibleUnits
( [number teamID = -1 [, number radius = 30 [, boolean Icons ]]] )
-> nil | unitTable = { [1] = number unitID, ... }
fixed code is:
Code: Select all
function widget:DrawWorldPreUnit()
glDepthTest(true)
glTexture(texture)
glColor(1.0,0,0,1.0)
local visEnemies = GetVisibleUnits(Spring.ENEMY_UNITS, nil, false)
for i=1, #visEnemies do
unitID = visEnemies[i]
ud = spGetUnitDefID(unitID)
radius = radiusDefs[ud]
glDrawListAtUnit(unitID, SimpleCircle, false, radius, 1.0, radius, 0, 0, 0, 0)
end
glColor(1,1,1,1)
glTexture(false)
end
Re: New widget: Enemy Spotter
Awesome. So now there's a widget to spot enemies for you. It's not long now before widgets play the game for you.
Re: New widget: Enemy Spotter
says a guy who has over 9000 widgets in use ^^
i made this widget because i got annoyed of dgunning allies Raiders (also my own raiders xD), since they have almost no teamcolor in their texture, and even if they had, its still fucking hard to distinguish enemies from allies in a big mess of both sides units...
also this is fucking awesome widget for air attacks... you can easily see which one is enemy air unit, many times ive been like "OMFG YOU GET COMNAPPED" but it was ally atlas... -_-
also this helps in finding those units you didnt kill in your base... for example some radar planes or scout planes lying around your base... happens a lot of times, at least for my enemies when i scout, sometimes it takes half a hour until they notice them :D
i made this widget because i got annoyed of dgunning allies Raiders (also my own raiders xD), since they have almost no teamcolor in their texture, and even if they had, its still fucking hard to distinguish enemies from allies in a big mess of both sides units...
also this is fucking awesome widget for air attacks... you can easily see which one is enemy air unit, many times ive been like "OMFG YOU GET COMNAPPED" but it was ally atlas... -_-
also this helps in finding those units you didnt kill in your base... for example some radar planes or scout planes lying around your base... happens a lot of times, at least for my enemies when i scout, sometimes it takes half a hour until they notice them :D
Re: New widget: Enemy Spotter
Fair enough, make a widget for yourself because you can't aim. I'll forgive you.TradeMark wrote: i made this widget because i got annoyed of dgunning allies Raiders (also my own raiders xD)
Re: New widget: Enemy Spotter
lol, its not about aiming, its about knowing which one of them is enemy or ally... not easy with raiders
Re: New widget: Enemy Spotter
Well, maybe I have a little advantage using the Team Platter widget and having the distance units become dots at around 150.TradeMark wrote:lol, its not about aiming, its about knowing which one of them is enemy or ally... not easy with raiders