Metal spots v2

Metal spots v2

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Cheesecan
Posts: 1571
Joined: 07 Feb 2005, 21:30

Metal spots v2

Post by Cheesecan »

Can be included in *A mods that wish to use it.

Image

How to use in a map:
Step 1. Create a mapname.lmf file in mapname.sd7/maps/.
Example lmf

Step 2. Create a folder in the map archive and place metal spot textures there. They should be named "metal_high.png", "metal_medhigh.png", "metal_med.png", "metal_low.png" (different textures for different sized patches).

Download widget

Changes:
v2
- added display lists
- added loading metal maps from file

--------------------------------------------------------------------------------------
New: Alternative version for mappers who want to be able to toggle the widget via the F11 menu. I offer this as an alternative since some people are going to want it like this, and I figured I'll make things easier for those people. We will just have to see which approach proves the most popular.

This is a newer/improved version that uses Niobium's metal finding routine, that fixes placements when spots are very close to each other. It still saves and loads metal spot files, but since the output is incompatible with both areamex and metal spots v2, I've changed the suffix to avoid conflicts.

One issue with this version is that it lost support for drawing textures based on metal spot worth, but I'll add that back when I can be bothered to.
http://www.springfiles.com/show_file.php?id=2875
Last edited by Cheesecan on 30 Nov 2010, 01:12, edited 5 times in total.
User avatar
SirArtturi
Posts: 1164
Joined: 23 Jan 2008, 18:29

Re: Metal spots

Post by SirArtturi »

Thank you very much...
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Metal spots

Post by Niobium »

I can't quite figure out what this does. It draws textures onto metal spots based on worth? What are the textures intended to look like?
User avatar
Cheesecan
Posts: 1571
Joined: 07 Feb 2005, 21:30

Re: Metal spots

Post by Cheesecan »

Different textures are drawn depending on worth yes. Textures are just transparent images of metal patches such as those seen here:
http://i53.tinypic.com/103ivyg.jpg
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Metal spots

Post by Niobium »

Cheesecan wrote:Different textures are drawn depending on worth yes. Textures are just transparent images of metal patches such as those seen here:
http://i53.tinypic.com/103ivyg.jpg
Ah, then its a very handy which to keep around for when maps don't have obvious metal spots, nice idea.
User avatar
Cheesecan
Posts: 1571
Joined: 07 Feb 2005, 21:30

Re: Metal spots

Post by Cheesecan »

Yes granted the map itself has support for the widget.
User avatar
SirArtturi
Posts: 1164
Joined: 23 Jan 2008, 18:29

Re: Metal spots

Post by SirArtturi »

yes, and enforcing metal spots modside with this would be problematic as I cant see any way mod detecting the maps that dont have metal patches on texture :)

Yet however, I want to use this as map option, where player has freedom to choose whether having map with or without the patches. It gives more flexibility for all games. How is this possible cheesecan?
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Metal spots

Post by Google_Frog »

If you're going to build this into a map why not skip the entire mex detection step and hardcode the draw positions yourself?

Also I see you are using the same mex spot detector as area mex. Area mex has a feature that saves the metalmap into your luaUI folder on your first play of the map. Subsequent uses of the map do not require the metalmap parsing step as the saved mex file can be loaded. Would you look into copying the save/load functionality so that users that use both this widgets and area mex only have to parse the metalmap once and only on the first play? If this is done it would be a good idea to make sure the configuration of the mex finder is the same for both widgets.

Maybe there should be a bit more standardisation in metal spot finder formats. For example a metal parser widget could be included in the engine and many widgets could just load the output.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Metal spots

Post by knorke »

having to put files in the map is bad in this case.
imo include a set of metalspot textures into the widget and then maybe try to guess which textures fit best, like on filename or terrain type name.
ie mapname contains "desert", "canyon", "sand" -> use "desert style" textures
mapname contains "river", "forest", "green" -> use "gras style" textures
User avatar
SirArtturi
Posts: 1164
Joined: 23 Jan 2008, 18:29

Re: Metal spots

Post by SirArtturi »

knorke wrote:having to put files in the map is bad in this case.
imo include a set of metalspot textures into the widget and then maybe try to guess which textures fit best, like on filename or terrain type name.
ie mapname contains "desert", "canyon", "sand" -> use "desert style" textures
mapname contains "river", "forest", "green" -> use "gras style" textures
That's impossible, though you can always make a metal patch that you can fit easily anywhere, you dont need to add any grass or desert into it - as long as the format supports alpha channel... The problem however is however, that most of the maps already have metal patches and adding new ones onto them may lead bad results.

Anyway, whats wrong with including this in map?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Metal spots

Post by knorke »

That's impossible
No. What part exactly do you thing is impossible?
Anyway, whats wrong with including this in map?
I thought the idea was to make metalspots visible on maps that do not have them for whatever reason. Like you play a really nice map but it has no visible metalspots: You enable the widget and Tada! - metalspots.
Whats the use if you have to alter the map for the widget to work...
The problem however is however, that most of the maps already have metal patches and adding new ones onto them may lead bad results.
Then the player just disables the widget.
User avatar
SirArtturi
Posts: 1164
Joined: 23 Jan 2008, 18:29

Re: Metal spots

Post by SirArtturi »

knorke wrote:
That's impossible
No. What part exactly do you thing is impossible?
You can't parse it according map names. It's obvious: First, all map names do not contain desert or green. Second, most of the maps are not purely just a desert or green.

But as I said, metal patch dont need to be one with any colors, just the patch/stamp with alpha channel... The one used in example is stupid example in that sense...
knorke wrote:
Anyway, whats wrong with including this in map?
I thought the idea was to make metalspots visible on maps that do not have them for whatever reason. Like you play a really nice map but it has no visible metalspots: You enable the widget and Tada! - metalspots.
Whats the use if you have to alter the map for the widget to work...
The problem however is however, that most of the maps already have metal patches and adding new ones onto them may lead bad results.
Then the player just disables the widget.
I see, you want it just to be a clientside widget. I was thinking about more it as a mod or mapoption...
User avatar
Cheesecan
Posts: 1571
Joined: 07 Feb 2005, 21:30

Re: Metal spots

Post by Cheesecan »

knorke: It is possible to put the metal spot textures anywhere inside the spring directory. For instance you could put them in /LuaUI/Widgets/MetalSpot/ :-) it's a nice feature.

If your map is a desert map, you just write /LuaUI/Widgets/MetalSpot/desert_ on the first line of the .lmf file. That way it will search for desert_metal_high.png ... desert_metal_low.png in that location(in other words it supports filename prefixes too). This means you can have generalized textures. With the RGB tint feature, the mapper can also tint the texture to fit his/her map better. :-)

The reason I didn't write about this feature is because I don't know how to deliver it to the users. Users would have to download an archive of general metal textures. The lobby clients only support downloading of the widget .lua file. Maybe it would be possible to release a 2nd version which comes in an archive that has general textures in it, and can be downloaded 1-click through lobbies. Do lobbies support downloading .7zip files in their widget downloaders?

Also that means the mappers need to endorse the widget and suggest some general textures for each terrain type that they want included.

GoogleFrog: I actually forgot about the save/load feature. :oops: I had it in my mind to add it. It saves a lot of computation. As you say it would be great to have compatibility between different widgets using those metal maps. A simple routine to check if the file already exists, if not, then generate it, added to every widget, would assure compatibility. I'll be sure to include it in the next version.

knorke: This widget is not a manual-use kind of widget, it's just a passive widget that detects if lua metal spots should be drawn or not. As you say it's a big drawback to have to modify maps, there is no backward-compatibility. But do you have any proposal for how it is supposed to reliably determine if patches are to be drawn on older unsupported maps? And when it has done that, which textures is it supposed to use? A community metal patch texture set? If that is something desired then I can certainly try my best to create a guessing function, if I make it complex enough it can have decent results, it's just a question of if we want to go there or not. In my whole list of maps, I only could find one map that doesn't have metal spots: XantheTerra.

SirArtturi: I'm not an artistic type so can you please explain the alpha layer idea? Will it give patches can mend better into all maps? Proof of concept? Because to me it goes beyond just color, the shape of the patch could mean it fits into one map but not others. And then we also have the whole general texture delivery-issue again.

Does Spring lua include LuaSockets? If so then textures could actually be downloaded from a central server, solving the delivery-issue. Heck it could even automatically update textures that turn out to be unpopular.

Anyway it's good that everyone has thoughts and feedback. I want to take all your feedback and improve the widget, to make it as good as possible and meet everyone's needs.
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Metal spots

Post by oksnoop2 »

Your metal patches would look out of place on my maps, can i submit to you a metal patch for ct maps?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Metal spots

Post by knorke »

Cheesecan:
I would use this as a widget I can enable if playing a map with non-visible metal spots. Sometimes I have been playing such maps and thought "meh would be nice to have a widget to draw spots instead of using F4."
There is probally is a use for including this in mods/maps too but this is the most obvious way I personally would use this right now.
But do you have any proposal for how it is supposed to reliably determine if patches are to be drawn on older unsupported maps? And when it has done that, which textures is it supposed to use?
I wouldnt really mind if the spots do not fit the map 100% as long they serve as indicator. Would not mind having to switch it on at gamestart either.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Metal spots

Post by Forboding Angel »

Here are some good replacements. I've used these on many maps that I've made in the past. They have the advantage of looking good on just about any kind of map.
Attachments
metal_med.png
metal_med.png (19.74 KiB) Viewed 3770 times
metal_low.png
metal_low.png (19.24 KiB) Viewed 3770 times
metal_high.png
metal_high.png (19.95 KiB) Viewed 3770 times
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Metal spots

Post by Forboding Angel »

forum will only allow 3 attachments at a time.
Attachments
metal_medhigh.png
metal_medhigh.png (19.62 KiB) Viewed 3770 times
User avatar
Cheesecan
Posts: 1571
Joined: 07 Feb 2005, 21:30

Re: Metal spots

Post by Cheesecan »

See updated screenshot above.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Metal spots

Post by AF »

How does this fare on metal heck? I'd like to see forbs spots with specular shinyness!
User avatar
Cheesecan
Posts: 1571
Joined: 07 Feb 2005, 21:30

Re: Metal spots

Post by Cheesecan »

Strange nobody replied to my barrage of questions. Has all interest in lua metal disappeared already? :|

edit:
New release(v2)
I added display lists(should make it a bit faster) and loading of metal maps. GoogleFrog: Unfortunately no compatibility with other widgets that load metal maps from files, because I need a third line per mex entry for metal weight which you had commented out.
Post Reply

Return to “Lua Scripts”