Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Programmatically Generated Map?

khmp

Sponsor

Is it extremely difficult to generate a map via script? These maps wouldn't be extremely detailed. Just need to use autotiles and maybe something on a secondary layer. Or if that is impossible. Is it possible to join separate maps together like lego blocks?
 

poccil

Sponsor

It certainly is possible, though difficult, to create dynamic maps -- all maps are essentially RPG::Map objects. That structure doesn't even preclude making maps that are smaller than 20x15 in size. It appears to be less difficult to join two maps, but there is the dual problem of managing two maps at once and also that the maps can be so small that there can be performance costs.
 

khmp

Sponsor

Thanks poccil for the quick reply. To clarify that second part, the joining two or more maps. What I mean is lets say I have a blank tile map that's 200x200. But I have 10, 20x20 pieces that are supposedly interchangeable. I then overwrite the larger 200x200 map with 20x20 sections until it is completely replaced. Then present this map to the player. I imagine if this is done during run time it will cause a little bit of lag, but that's small potatoes. It seems easy and feasible in my mind but then again so do most things. Maybe I should just try to figure it myself sorry to bug ya. :)
 
There was a map generation script that was a work in progress, but the scripter said it WAS only a work in progress....

Who... AH... I think it was by Wachunga, using Near Fantastica's Dynamic Map script...

You were able to specify start and stop locations, widths of maps or paths, and a couple other things I can't remember.

It was Random Map Generator if you can find it... hope for a demo as it was in parts?
 

khmp

Sponsor

Awesome, thanks a bunch DerVVulfman! I never thought it was done before. And if I can find it, it will definitely be a valuable reference. However the more I think about it the more I'm convinced that having detailed smaller maps(lego blocks) joined together would be the way to go. At least, again in my mind, deciding where a tree could be placed programmatically seems more time consuming than creating a tiny map with a few trees. Especially when I want to do this during runtime. Plus I have to worry about whether the player can still walk through an area among other things.
 
I started on one, that you could even plan out multiple-map systems too. I was working on having it generate a random maze like dungeon, where you would create a dummy map with "rooms" or just segments of random rooms that could be added to any map. It would randomly place these rooms on a map, generate mazes between them, and work from there.

I stopped when I was working on the map systems, where you could create complete dungeons like in the game Ehnegize or however it was spelled, where map 1 could lead to 2 3 or 4, map 2 could lead to 4 or 5, 3 to 5 or 6, 4 to 7, etc. You tell it which maps to generate, and it would create the rxdata files. The only problem was encrypted games, so I stopped between getting maps to generate proportionally in size, so they actually linked in a sense able mannner, but creating and saving a cache and dumping that cache into a savefile as opposed to a rxdata file. Then I was working on making the size of everything smaller, so create extra room.

The pass ability planning on this is tremendously challenging. I might try to finish this over my Christmas break. It was a lot of fun considering the challenge level. And you all know me, throwing more feature in it that ever needed.
 

Zeriab

Sponsor

The most difficult part when creating a map generator is preventing the maps from looking ugly.
How difficult it is to create a random map generator depends on the style of the map. Mazes are for example far easier to generate than forests.

Then there is the question of whether the generated maps are used as templates for mappers or maps generated at runtime.
It doesn't really matter if it takes a minute to generate a map if it is going to be used as a template. Having a player waiting a minute is something quite different.

You say you want this at runtime, so the algorithm must be fast.

You could have that only the visible part of the map is generated. I.e. the map is generated on the fly. There is lots of caching stuff to do and it could easily be a bother to save. This approach does however allow the algorithm to be slower since not the entire map is generated at once.
Actually it could either be generated 'on-demand' or in the background until it is finished. The latter is a good deal harder than the 'on-demand' approach, but it is still a possibility.

Another possibility could be to have maps where only some are being generated. There will surely be loads of subtle issues with attaching the generated part with the hand-made part.

I believe the best result would be to start with a script which generates a specific type of map. Afterwards we can worry about building a framework and generating different styles of maps.
Would you want to save the generated maps?


It is definitely possible to stitch together maps.
I guess the hardest part will be managing traveling events and deciding when to run autostart and parallel events on the various maps.
The ability to restrict some events to a specific area while allowing others to travel among maps would be nice, though could easily become bothersome.


@Seph:
Would you consider making a joint project about this?
I am certain the end product will be great and the development of it be fun and challenging :thumb:

*hugs*
- Zeriab
 
-looks side to side-...Eh..You wanna know something Seph >> this script is for me xD I did it with events but i couldnt get it to teleport back to the last map, and i just requested a script because i wanted to get it done by thanksgiving >> Rub it in my face..Eventers are still better!
 

Zeriab

Sponsor

Silly iCheeze.

Map generation is far better suited to be scripted than evented.
The same is map stitching if you want traveling events.

From what you say I guess you have an amount of maps and then randomly choose where to teleport.
You really should create a global variable containing an array and then manipulate this. It will be far easier than maintaining a tail with events and more dynamic since the length of the trip is theoretically infinite.
If you were using RM2K(3) you would have been able to simulate the list of where to teleport rather nicely ^^

Practically speaking generating maps with events is downright insane and far too slow. Making a map generator in Ruby is slow enough as it is.

There are certain structures you should avoid when eventing.
As an eventer you should try to analyze which parts should be scripted and which parts could just as easily be evented. You should try not to put too much work on the scripter, but you should not try to deal with stuff that is far easier were it scripted. :thumb:

@seph:
You sound like an scientist wanting to do experiments on my mind >_>
I'll be waiting to see what you have already ^_^

*hugs*
- Zeriab
 
@khmp: I love you. I have some new signature material now.

I don't know how one could really generate random maps with events, especially systems of generated maps running together.

I don't want to do experiments on your mind, I just wish I knew all the technical stuff you know, that I have yet to teach myself. Saves me time. ^_^
 

Zeriab

Sponsor

If you did then you would be an excellent eventer, wouldn't that be horrible :p

I wish I have as much experience with RGSS as you have. Luckily I know the remedy for that ^_^

@khmp: Don't expect this script any time soon. It sounds as if Seph don't have much time before his Christmas break, so it most likely won't be finished before.
 
O.o why does everyone say that events lag. everything that I event never lags...Am i just smarter than everyone else..I will put up my ERMG(evented Random Map Generation) sometime this week.
 

Zeriab

Sponsor

If the maps are generated at runtime for the player then the burden of making the maps pretty lies on the scripter.
If you generate maps for developers then I agree that it is not the scripter who should make the maps pretty.

It really depends under which circumstances you want to generate the map.
 

khmp

Sponsor

Generating maps .hack// style for example would be accomplished at runtime. Putting the responsibility of the map creation solely on the scripter. That was the answer I was seeking.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top