Idea popped into my head regarding type maps.

Idea popped into my head regarding type maps.

Discuss maps & map creation - from concept to execution to the ever elusive release.

Moderator: Moderators

Post Reply
User avatar
enetheru
Posts: 627
Joined: 11 Jun 2010, 07:32

Idea popped into my head regarding type maps.

Post by enetheru »

I know they are generally discouraged.. but I was working on documentation when I thought of this and better to put it down somewhere than to forget about it.

Purely for hardness values.

Is it possible to programatically define the type maps in the mapinfo.lua such that you set a min and a max hardness, and the 256 possible types get their hardness value scaled from the min and max.

that way hardness values of the terrain can be artistically drawn on an image without having to worry about aliasing or gradients too much.

I could do it manually.. but that's a lot of crud at the end of the mapinfo.lua file

I hope that made sense...
User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: Idea popped into my head regarding type maps.

Post by Funkencool »

I'm sure you could use a for statement to bypass having to manually enter 256 types. Is the limit even 256? I only ask because I thought the type map was more than 8bit.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Idea popped into my head regarding type maps.

Post by Beherith »

Code: Select all

hmin=0.5
hmax=1.5
print ''.join(['[TERRAINTYPE%i]{\nhardness=%f;}\n'%(i,hmin+((hmax-hmin)*i/256.0)) for i in range(256)])
Python code to generate it.
Should work, 256 max terrain types (red channel of 8bit bmp)

Relevant info from mapinfo.cpp:

Code: Select all

void CMapInfo::ReadTerrainTypes()
{
	const LuaTable& terrTypeTable = parser->GetRoot().SubTable("terrainTypes");

	for (int tt = 0; tt < NUM_TERRAIN_TYPES; tt++) {
		TerrainType& terrType = terrainTypes[tt];
		const LuaTable& terrain = terrTypeTable.SubTable(tt);
		const LuaTable& moveTable = terrain.SubTable("moveSpeeds");

		terrType.name          = terrain.GetString("name", "Default");
		terrType.hardness      = terrain.GetFloat("hardness",   1.0f);
		terrType.receiveTracks = terrain.GetBool("receiveTracks", true);
		terrType.tankSpeed  = moveTable.GetFloat("tank",  1.0f);
		terrType.kbotSpeed  = moveTable.GetFloat("kbot",  1.0f);
		terrType.hoverSpeed = moveTable.GetFloat("hover", 1.0f);
		terrType.shipSpeed  = moveTable.GetFloat("ship",  1.0f);

		// clamps
		terrType.hardness   = max(0.001f, terrType.hardness);
		terrType.tankSpeed  = max(0.000f, terrType.tankSpeed);
		terrType.kbotSpeed  = max(0.000f, terrType.kbotSpeed);
		terrType.hoverSpeed = max(0.000f, terrType.hoverSpeed);
		terrType.shipSpeed  = max(0.000f, terrType.shipSpeed);
	}
}
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Idea popped into my head regarding type maps.

Post by zwzsg »

I programmatically defined 256 startpos in a mapinfo.lua, so sure you can programmatically defined 256 terrain type. I doubt anyone would see much difference between that many hardness, though.

Beherith: Why write a python script to write a TDF, when you can directly write the algo in the Lua of mapinfo.lua ?
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Idea popped into my head regarding type maps.

Post by Beherith »

Cause I love python :)
Off topic: can I select from a set of random start points on game starts each time? I want ffa mode to choose from not only the first N start points.
User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: Idea popped into my head regarding type maps.

Post by Funkencool »

That seems very plausible, If I was a little more confident in my luaing I could probably even make it happen.
User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: Idea popped into my head regarding type maps.

Post by Funkencool »

Sorry to double post and go even more off topic, but has anyone ever made a slightly randomized map?
I'm thinking stuff like random metal amount, weather/fog, features (including reclaim), sun angle/time of day. And by slightly random, I mean random under certain parameters, e.g. the metal can only vary so much. I think it would be cool if the map wasn't the exact same every time.

Also, I mean besides zwzsg's awesome but very random map.
User avatar
enetheru
Posts: 627
Joined: 11 Jun 2010, 07:32

Re: Idea popped into my head regarding type maps.

Post by enetheru »

Funkencool wrote:Sorry to double post and go even more off topic, but has anyone ever made a slightly randomized map?
I'm thinking stuff like random metal amount, weather/fog, features (including reclaim), sun angle/time of day. And by slightly random, I mean random under certain parameters, e.g. the metal can only vary so much. I think it would be cool if the map wasn't the exact same every time.

Also, I mean besides zwzsg's awesome but very random map.
Hrm, interesting, I will see about adding this into my next map, I think slight randomisation would make the map more interesting.. not enough to cause a big difference, but just enough to tingle the senses that its not a static environment that never changes.

While were off topic, one of my end game goals with map making is to make a single map with map options for a full set of daytime, seasonal, environmental options and a button to randomise so you never know.. I know it can be done.. its just slowly building the skillz to make it a realisation..
User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: Idea popped into my head regarding type maps.

Post by Funkencool »

I'm about half way - actually probably more than that - there with my blueprint map. I got quite a bit done with it but it was getting messy so I've been on a break from it until I hone my programming/lua skills a little more.

About the randomizing, I was planning on putting it in my maps too. Then I thought about it a little more, and it would probably be handier as a widget. It would liven up old maps (lua maps anyway). Like you said, variety would add some more depth to each map, like making you have to change you style. I might even build a nice informative chilli window to let players know what they're dealing with.
I know they added a feature to detect and inform players of inferior gpus. I wonder if that could be used to decide if some features should stay off, e.g. weather, when randomizing?
Post Reply

Return to “Map Creation”