Can games include a prebuilt map?

Post Reply
isaiah658
Member
Posts: 171
Joined: Sun Jan 24, 2016 14:58
Contact:

Can games include a prebuilt map?

by isaiah658 » Post

I've tried researching this and couldn't find anything. For some games, a custom map might be vital for the gameplay, like an RPG, but the map would be too big to load in as a schematic or something in a void world. Distributing a map separately is possible, but it's a bit cumbersome. Is there some way to distribute/enforce a large custom map with a Minetest game?

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: Can games include a prebuilt map?

by ShadMOrdre » Post

There are a couple of lua mapgen mods that might facilitate this idea.

Real Terrain

Gale de Sailly made a mod that allowed you to use .dem file.

mg_earth, my own project, allows custom voronoi point sets that can be applied to noise, giving you control over continents, while allowing the randomness of noise.

Shad

isaiah658
Member
Posts: 171
Joined: Sun Jan 24, 2016 14:58
Contact:

Re: Can games include a prebuilt map?

by isaiah658 » Post

Thanks for the suggestions. It does seem a bit weird to me that there isn't a more official way to do this. I was thinking more along the lines of making a map entirely from scratch rather than just enforcing a mapgen. I would want entities, such as NPCs, to already be in their places. Trying to keep track of that and spawning them in after loading the map seems like a mess. Might be easiest to just distribute a world separately.

User avatar
v-rob
Developer
Posts: 971
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Can games include a prebuilt map?

by v-rob » Post

If you want the map to be absolutely identical every time, there are world games where you distribute a world with a game directory inside it: https://github.com/minetest/minetest/bl ... #L139-L148. I don't know if those can be uploaded to ContentDB, however. Not sure if that is what you're looking for.
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Can games include a prebuilt map?

by orwell » Post

Another idea that comes to my mind is delivering a "template world" with the game.

The game can have a subfolder "world". This needs to contain a full-featured world folder (including map_meta.txt, world.mt, map.sqlite and other auxiliary files). Then via a game.conf option this behavior is enabled.

When a new world is created via the main menu, instead of creating a new folder, the "template" world folder is copied. The template world can then include fixed mapgen settings, so that the terrain around the predefined "spawn" area can be naturally generated without problems.

(setting up servers, with potentially different database backends, would still be a manual task, but I trust that server owners will know what to do)
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

isaiah658
Member
Posts: 171
Joined: Sun Jan 24, 2016 14:58
Contact:

Re: Can games include a prebuilt map?

by isaiah658 » Post

orwell wrote:
Wed Jan 12, 2022 20:22
Another idea that comes to my mind is delivering a "template world" with the game.

The game can have a subfolder "world". This needs to contain a full-featured world folder (including map_meta.txt, world.mt, map.sqlite and other auxiliary files). Then via a game.conf option this behavior is enabled.

When a new world is created via the main menu, instead of creating a new folder, the "template" world folder is copied. The template world can then include fixed mapgen settings, so that the terrain around the predefined "spawn" area can be naturally generated without problems.

(setting up servers, with potentially different database backends, would still be a manual task, but I trust that server owners will know what to do)
Is this possible? I didn't know lua allows copying files like this. This sounds a lot like what I want.

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Can games include a prebuilt map?

by Linuxdirk » Post

You could limit the mapgen to singlenode and then write your own world generator that creates exactly the world you want. With this you don't need to provide a world (that will be different from upstream the second the player opens it which makes it impossible to easily update it).

User avatar
Blockhead
Member
Posts: 1685
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Can games include a prebuilt map?

by Blockhead » Post

For small maps it's trivial, and you can use the kind of approach that Wuzzy's tutorial game or Grand Theft Box use, where I'm fairly sure all the schematics are placed at world creation.

In case of an expansive world, you probably still want to use schematics, however you need a smart lua implementation that will only place them as each chunk is emerged. You need to use a lua mapgen and as Linuxdirk said, use the singlenode mapgen. Slice your world into a schematic for each mapblock and use register_on_generated to check the coordinates and place the appropriate schematics. In that function, additional to how you place the terrain with a schematic, you would include other custom setup like placing entities (mobs, NPCs, what-have-you), which you could also put in separate files that are mapblock-based like your schematics.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
BuckarooBanzay
Member
Posts: 437
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

Re: Can games include a prebuilt map?

by BuckarooBanzay » Post

I've created a mod that does fit your use-case: https://github.com/Buckaroobanzay/modgen
It supports updating the map afterwards and it even scales very well :)

An example game that uses it: https://github.com/mesecons-lab/mesecons_lab
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Can games include a prebuilt map?

by orwell » Post

isaiah658 wrote:
Thu Jan 13, 2022 00:41
orwell wrote:
Wed Jan 12, 2022 20:22
Another idea that comes to my mind is delivering a "template world" with the game.
Is this possible? I didn't know lua allows copying files like this. This sounds a lot like what I want.
It's not possible with the current implementation. I meant this as an engine feature - the template would be copied when you confirm the "new world" dialog, not when you first start the world. At this point mods do not run yet, so it has to be integrated into the engine.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests