Infinite World Generation (Alpha)

lightwriter
07 Oct 2015, 06:46
It's quit buggy at the moment but the proof of concept is there :)
Alternative to this (and less buggy) is Jaynabonne's dungeon generator:
viewtopic.php?f=18&t=3546

Here is the link to try out the infinite world generator yourself! Wasn't that hard to code but it's buggy at the moment:

Pertex
07 Oct 2015, 20:55
OK, it's working but it's ugly coding e.g. you could replace the 4 generation functions gen_south, gen_north... by four lines of code if you would rename your clone rooms like west_1 instead of west_A

  
<function name="gen" parameters="direction" type="object">
variable = GetRandomInt(1,14)
return (GetObject(direction + "_" + variable))
</function>


Then you only have to call gen("west") to clone one room. The going_xxx functions have nearly the same code so I think you could replace them by one function, too.
And instead of using rooms for cloning it should be possible to create them by script

lightwriter
07 Oct 2015, 21:03
Thanks for the advice but I'm having trouble with the create command. I don't know if I'm mixing up the parameters or what but I always get errors when trying to use create and I have trouble creating exits.
Can you think of a way that the rooms get defined as well so they don't get replaced when backtracking or going in a different direction?

Pertex
08 Oct 2015, 06:21
First of all, how/when do you want to create new rooms? All rooms at gamestart or on the fly when the player leaves a room and the target room does not exist?

lightwriter
08 Oct 2015, 16:08
When a player leaves a room, I got it to create the room but get an error when trying to create exits.
UPDATE: It seems to work if I use the 'before enter room for first time' script.

Pertex
09 Oct 2015, 11:02
Here is an example to create exits by script: