Well, I think this is a well-investigated area already, and you can surely find a lot of open-source engines and algorithms decomposed step-by-step on the Internet.
So all I will do is outline the essentials of tiled world-generation.
First, don't concern yourself with speed. Put more effort into how you put your generator together, make it modular -- then you can optimize each part at a later date. Don't make it perfect, make some crappy parts at first which gets the job done, and then replace them later on.
So why do you want to have a world-generator to begin with? What inspired you about it?
You will learn a great deal more if you are inspired! You will have a lot more fun and be able to progress, if you see interesting challenges instead of problems (slow map-generation, dealing with complex and confusing code, and so on).
So to break things down: ask yourself at what granularity you want your generator to work at. Granularity applied to 2D pattern generation would mean: what size of blocks that the generator works with. What size of blocks it manipulates; like taking a certain pre-made 8*8 block and turning it and adding noise to it.
You may decide to create different generators for the different granularities, like having a generator which only produces 8*8 blocks, which are all unique (like eigenfaces (Google it!)), and then having another generator for placing and combining these indexed blocks in the array.
If you think hard about the high-level design of the system, you will save a lot of time down the road.
If you get stuck: get back to the basics! Always remember that it's about 2D pattern generation, and there are a thousand different ways to go about it!
I suggest you keep the world small to begin with, and expand it when you've experimented for a while.
Get a small notebook, which you keep with you, like one with just blank drawing paper, and write down algorithms that comes to you, and make drawings to clarify how you want it to work.
You can have a lot of fun with this! I promise!
Well, it's not so much the algorithm as speed of file writing. Fact of the matter is, if it takes X nanoseconds to write a byte to a file, it's not going to improve no matter what you do, save switching languages
And don't worry, I am heavily inspired and hardly view this as an insurmountable problem.
Edit: Hmm.. oh you're saying I should design the "tiles" as numbered premade blocks and save them that way. Yeah doing that would certainly cut down time a lot. I'd mean crazy amounts of work, though since I have zillions of tile combinations. Thankfully, I can worry about this later, then, just so long as there's options. Also, then I would have to worry about what happens when the tiles change. Would I do world gen files one way, and then room save/load another when I need specific tile info?
Edit: Heh eigenfaces. As entertaining as using stuff from linear algebra is, I think that's a little too complicated for me.
What I'm doing currently for each world is sort of like dwarf fortress: Each world tile has a forest grade, a boolean for each present grass type, and other grades like rockiness. This makes for a realistic looking world, since I start at a dense grade and spread them out. If I go with pre-made blocks, this is going to be a difficult task, since I want the tiles in the room to be represented by their grade (i.e. a 9/9 forest 2/4 rockiness room should have lots of tress and some boulders). The only way I could think of to do it is to literally have like 20 blocks for each grade combination ("9 forest 1 grass A 1 Grass B 4 rocky", "9 forest 1 grass A 1 grass B 3 rocky", "9 forest 1 grass A 1 grass B 2 rocky" etc) which wouldn't really work because there's billions of combinations.
Edit: heh, okay this is a lot of reflection, but I think it's better brainstorming here than on a paper since I can get feedback. I'm not worried about people stealing ideas since World Gen is hardly going to be the most original part of the game. It may even be a non-issue if GM Studio improves the speed of basic things like file writing. So, anyways, I suppose I could save the rockiness/dirt/grass parts as separate grid pieces. Maybe do the rockiness as 10x10 patterns, and he grass and dirt as sort of "splashes" saved as a coordinate and a radius. But here's another problem: there's basically two tiles for every tile, and the second tile (the "top tile" like trees and plants) is based on the bottom tile, so it gets even more complicated saving the top tiles if the bottom tiles aren't saved as individual tiles.
I think for now I'll just do my normal map design and worry about this later lol
Edit: Shoot, not sure if there's some NDA I missed with gm studio (I doubt an open beta would have one), so I'll be vague. But GM studio is fast enough for me not to worry at all about this anymore.
Edited by greep, 12 March 2012 - 09:27 AM.