Idea: an invisible map

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Idea: an invisible map

Post by Helmet »

I have an idea concerning an invisible map. There is a [map_1] and a [map_2].

The initial map and all sprites appear on [map_1], as this map is visible=yes by default. Map 2 is visible=no by default.

While the game is played on map 1, a different map with different sprites can be assembled on map 2.

Only one map can be visible at a time. When map 2 is made visible, map 1 becomes invisible. When this happens, the player is suddenly on a new map. It's a lot like [replace_map] and [scroll_to], but the change is instantaneous instead of taking a second or two.

This feature could also be handy if a player was fighting in two distinct, unconnected areas. All the combat on map 1 would be resolved, then combat on map 2 would be resolved. The maps would keep changing, [map_1] then [map_2], every turn. This could allow for some interesting scenarios. For example, while the main army attacks the tower of unspeakable evil, providing a distraction, a small squad could infiltrate a nearby volcano to destroy something important, such as a magic ring or whatever.

EDIT: Also, I wish [replace_map] had an x,y= parameter so the map could be centered anywhere as it appeared.

Thanks.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Heindal
Posts: 1344
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: Idea: an invisible map

Post by Heindal »

You can use "terrain mask", which is quite fast. You can combine it with any event you like and set map1 or map2 to 0/1 or visible / notvisible. You could even define starting variables. So if the player moves to a new room or area, set the other area back "black" and create the new one in front of him. So far I've used it to create a random infinite exploration modus. I don't think you need lua for that.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: Idea: an invisible map

Post by Helmet »

Heindal wrote: October 31st, 2020, 10:37 am You can use "terrain mask", which is quite fast...
Thanks for the tip, Heindal. I read the Wiki, but it didn't help me understand how to use terrain masks for fast transitions between maps. After reading your post, I created a thread in WML Workshop called "transitioning between maps within a scenario." Here is a link:

https://forums.wesnoth.org/viewtopic.ph ... 95#p659595

I would appreciate it if you would post an example in that thread for me to study. My depth of WML knowledge is not very deep, so I might benefit from a simpler example that makes sense over a complex example that I may not understand.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Heindal
Posts: 1344
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: Idea: an invisible map

Post by Heindal »

Sure, here you go:

Code: Select all

[terrain_mask]
x,y=1,1
mask="border_size=1
usage=map

Xoc, Xoc, Xoc, Xoc, Xoc, Xoc, Xoc, Xoc, Wwr, Wwr, Wwr, Wwr, Wwr, Ur^Edt, Ur^Edt, Ur^Edt, Wo, Wo, Wwf, Wwf, Wwf, Ur
Xoc, Xoc, Wwr, Xoc, Wwr, Wwr, Wwr, Wwr, Wwr, Wwr, Ur, Wwr, Ur^Edt, Ur^Edt, Wo, Wo, Wwf, Wwf, Wwf, Wwf, Wo, Wo
Xoc, Xoc, Xoc, Wwr, Xoc, Wwr, Xoc, Xoc, Ur^Ys53, Ur^Ys51, Ur, Ur^Edt, Wot^Edt, Wot, Wwf^Edt, Wwf^Edt, Wwf^Edb, Wwf^Edb, Wo^Edb, Wwg, Wwg, Ur
Xoc, Xoc, Xoc, Xoc, Xoc, Xoc, Ur^Edt, Ur^Ys51, Ur, Ur^Ys51, Wwrg^Edt, Wot^Edt, Wwf, Wwf^Edt, Wwf^Edt, Wot, Wot^Edb, Wot^Edb, Wot, Wwg, Wwr^Ys53, Ur^Edt
Xoc, Xoc, Xoc, Xoc, Ur, Ur^Edt, Ur, Ur, Wot, Wot^Edt, Wot, Wwrg, Wwrg, Wwf^Edt, Wot, Wot^Ys51, Wot, Wot, Wwr, Wwr, Wot, Ur^Edt
Xoc, Xoc, Ur^Edt, Ur, Ur^Edt, Ur^Edt, Wot^Edt, Wot^Edt, Wot, Wwf^Edt, Wwf, Wwf, Wwrg, Wot, Ur^Edt, Ur^Edb, Ur^Edb, Wwr, Wot, Wwr, Wwr, Wwr
Ur, Ur^Edt, Ur^Edt, Ur^Edt, Wot, Wot, Wwf, Wwf^Edt, Wwf^Edt, Wwf^Edt, Wot^Edt, Wot, Ur^Edt, Ur^Edt, Ur^Ys53, Ur^Edb, Ur, Ur^Edb, Wwr, Wwr, Wwr, Wwr
Ur, Ur^Edt, Wot, Wot, Wwf^Edb, Wwf^Ys52, Wwf, Wwf^Edt, Wot^Edt, Wot^Edt, Ur^Edt, Ur^Ys53, Ur^Edt, Ur^Edt, Ur, Ur^Edt, Wwr, Wwr, Wwr, Wwr, Wwr, Wwr
Wot, Wot, Wwf, Wwf, Wwf, Wwf, Wot, Wot, Ur^Edt, Ur^Edt, Ur^Edt, Ur^Edt, Ur, Ur^Ys53, Xoc, Xoc, Xoc, Xoc, Wwr, Wwr, Wwr, Wwr
Wwf, Wwf, Wwf, Wwf, Wot, Wot, Ur^Edt, Ur, Ur^Edt, Ur^Edt, Ur, Ur, Xoc, Xoc, Xoc, Xoc, Wwr, Wwr, Xoc, Wwr, Wwr, Xoc
Wwf, Wwf, Wot, Wot, Ur^Edt, Ur^Edt, Ur^Edt, Ur^Edt, Ur, Ur, Xoc, Xoc, Xoc, Xoc, Xoc, Wwr, Wwr, Xoc, Xoc, Xoc, Wwr, Xoc
Wot, Wot, Ur, Ur, Ur, Ur, Ur, Ur, Xoc, Xoc, Xoc, Xoc, Xoc, Xoc, Xoc, Wwr, Xoc, Xoc, Xoc, Xoc, Wwr, Xoc" 
[/terrain_mask]
As you see x,y=1,1 is the starting variable, where the replacement takes place. You can just design, save and open a map file in an editor and than copy it right under the usage=map.

You can of course nest this code inside a if then or switch. I use this in the scenario "Sewerage3" in Strange Legacy if you like a bigger example (see attachment). Note that I used the variables $dungeonx,$dungeony in that scenario.

It's based on an idea which was discussed by papasmurfreloaded, I think it was in the multiplayer forum, but I haven't found the original thread.
Hopefully this will help you. Good luck.
Attachments
sewer3.map
added this one, you can use this to test the scenario.
(1.5 KiB) Downloaded 261 times
Sewerage3.cfg
(54.15 KiB) Downloaded 254 times
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: Idea: an invisible map

Post by Helmet »

Heindal wrote: October 31st, 2020, 7:08 pm Sure, here you go:
Thank you! Wow, this method works fast. This is exactly what I wanted.

Why x,y=1,1 and not x,y=0,0? Just curious.

I couldn't get it to work at first, but then I removed border_size=1 and usage=map and it worked.

Maybe those keys are being phased out? The Wiki says they will be ignored, but they weren't; they stopped the game from loading. I'm using BfW 1.15.6.

From the Wiki:
  • usage, this should be 'map' for a map and 'mask' for an overlay mask
  • border_size, the size of the border, should be 1 for map and 0 for mask. When the border_size is 1 the map border is part of the map data, this means the user can define the border instead of the game taking a guess.
(Version 1.13.12 and later only) These keys are now deprecated and will be ignored if present.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Heindal
Posts: 1344
Joined: August 11th, 2011, 9:25 pm
Location: Germany, Karlsruhe
Contact:

Re: Idea: an invisible map

Post by Heindal »

Ah I admit I don't use 1.15. I can't tell you why it won't work. 0,0 is outside of the map, the first adress-able variable is 1,1.
The future belongs to those, who believe in the beauty of their dreams.
Developer of: Trapped, Five Fates, Strange Legacy, Epical, UR Epic Era
Dungeonmasters of Wesnoth, Wild Peasants vs Devouring Corpses, Dwarf Dwarfson Dwarvenminer
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: Idea: an invisible map

Post by Helmet »

Heindal wrote: November 2nd, 2020, 11:31 pm Ah I admit I don't use 1.15. I can't tell you why it won't work. 0,0 is outside of the map, the first adress-able variable is 1,1.
Oh, okay. 0,0 makes sense now. Thanks.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Post Reply