[TECH DEMO] Infinite randomly generated terrain

View demo here (don’t let you fool yourself by the place thumbnail!!)

Heya guys! I’m currently using the CreatePlace API - and later on the SavePlace API - to create an infinite randomly generated world where players save the creations they make.

The currenlty only thing that’s on there is the random map generator, which still needs a lot of improvement. Nevertheless, it’s cool to see what you can do with perlin noise and fractals to create some random terrain.

I would like to point out why this is a tech demo.

CreatePlace and SavePlace bring a lot of issues. For instance, if you have two servers of the same Place online at once, they can overwrite eachother, so you have to prevent that. That’s currently in-game. I haven’t handled any way to ‘fix’ this yet, you just get kicked if a server is full. The handle is there though. I have issues with just-closed server which will be adressed shortly.

Also, CreatePlace and SavePlace bring the issue that you cannot ‘update’ the code in them. If you have a building game, and want to create a new building asset, you need to create a Model or something which you can update. The issue pops in when you let players save (for instance) tiny models so they can easily create a tower, wall, or whatever. If this uses a new model in an already online server, this part will not be available. Yes, there are fixes for this (just replace it with a default brick), but that’s not really elegant. When it comes to bigger game mechanics, like crafts, weapons, or whatever, you may see that you run into issues.

The fix for this is to download the new model every time it is updated. Sadly, roblox has no native API for this. The API function I need is :GetLatestAssetVersionAsync() but this is currently disabled. A fix is to download the assetversionid via roproxy (as seen in a plugin made by Seranok). I did it a little bit else and store an asset pointer on github. This hook allows me to run preconfigured scripts on my model. Think of autogenerating documentation or something. I haven’t checked if it’s saved as XML though because if it’s not i’m screwed.

I set up a very simple API which consists of the following terms;

Hub Root place of the universe. Used to teleport players to certain Worlds.
WorldA world is the container of sectors.
SectorA place inside the world.

A master script controls this and setups a variable _G.LocationContext which holds the interesting values _G.World and _G.Sector. Using these variables, you can write scripts which act differently on different places. For instance, I could create a world called “PVP” where you spawn with weapons on start. I also can create a world called Tutorial - where I can show a tutorial using the LATEST UIS. This is a really handy tool as your tutorials will get outdated if you change a feature or something. Using some smart scripting you can circument that!

So, TL;DR

  • Use CreatePlace API to generate an infinite random world
  • Setup API to deploy to multiple places at once using one ‘model’
  • Updating a certain model will update the all server. (this works by faking a shutdown). It is synced using os.time
  • SavePlace API is setup so that no overwrites will be made

Pictures!

I will open source this API soon. Post some images if you find something cool :D.
I would also like that the currently disabled API is made active soon, or that we get nocache options on various services (MarketplaceServce, InsertService).

2 Likes

I wish to play this tech demo, I am trying something similar too, but I just need inspiration.