Our Scripts Vault contains many game scripts that you can use to create your own game!
If I understand you, you're asking about creating new areas on the fly, and then storing them. And not just generating new random areas every time the player enters them.There is probably an optimal point of generation time vs lookup time. But if your map is going to be slow once it's all generated, then that's going to be a problem eventually anyway. I think a better question to ask is how to make a scalable, performant map lookup system (which doesn't have an easy answer, either). The question about how to approach generation is just delaying the actual potential performance problem.As an aside, the 3d exploration game "Noctis" has an interesting approach. Its universe is a galaxy with billions of stars and planets, each one being unique with an explorable surface. The game itself is only a few megabyte, so how can it contain billions of stars? The galaxy is procedurally generated using a preset seed. The game is singleplayer, but it could just as well be multiplayer and not require storing any data about the universe itself, because every player's client has the same seed and can generate the same world from scratch. All billion stars. There's a whole community centered around this game, where players explore stars and put their findings into an online database. And yet the universe is never downloaded or "saved". It just exists, inside a sort of a priori aether.
If I had ALL stars in a database and I would "SELECT * FROM table WHERE id=f(x,y)" to find if there is a star at this point from a table containing roughly 4billions (65536*65536) stars, wouldnt that take much more time ?
So, the only question is events and planet destruction. Since most planets will be never visited even once, make the default values non database. Once the planet is changed or destroyed then create DB entry. Sort of opposite to natural way of thinking, if something exists you do not have it in DB, but if something does not exist then you have it recorded Events can be generated only upon visiting the planet.If planet has not been visited for X days then remove the event fro DB unless permanent event). The counter when planet was visited last time is stored with event (default: never visited).
The first problem is one of generating coherent random ... you want planets and stuff on it to be different but not completly hazardous.
If say I have 1000k planets possibles, 10% of them have events so 100k needs events logging, they could only have an average of 10 events each before surpassing the planets indexing.
Couldn't the planet regenerate ( say if we delete the destruction event ) ?
You have basicly a choice. You can either go for small but complex universe or infinite but very simple one. Trying to go for infinite and complex will probably result only in yours (and your server's) misery.
If we have small generation of an infinite world and simple complexity then we build a line from small and simple to infinite and complex.
Quote from: stpinker on February 12, 2010, 07:22:08 AMIf we have small generation of an infinite world and simple complexity then we build a line from small and simple to infinite and complex. Amusing... You praised "KISS" just a few lines above and then posted that "thing". And you probably do not see anything strange in these two statements coexisting in one post. Split personality to its fullest
Oh, I love this stuff! Only have the feeling that I haven't had enough math yet to really get into building something very sweet...
Quote from: jannesiera on February 12, 2010, 10:20:24 AMOh, I love this stuff! Only have the feeling that I haven't had enough math yet to really get into building something very sweet...Funny, I did not too ... failed many calculus classes. But most of this when you put the time in it is simple. For example Perlin noise is simply reverse thinking the way we construct waves signals. You just look around for the nearest random point and curve a bit. Its all about coherency ... bringing order from predeterminated chaos.I don't think you really need math more than philosophy or at the least logics.