Create a new level / world for building

Hey, I have a question, how do I make it to where you can create a new level / world for my sandbox game, blockade 2d? You have a [+New] Button, when clicked, it will prompt you to enter the name of your world. Once this is done, the new level / world is newly created and added to the list of worlds you have. How do I do this?

Also, if you click on the newly created world / level, it will load up the world, and you will be playing in that world. Im also wondering how I can Save and Quit the world, so I can make it to where the current world your in is saved.

Hello,

What you are asking is perfectly possible to do in GD, but is a huge question.

One question that to be answered could take an entire book on how to design random worlds.

The most summarized answer to

How to generate random worlds?

is

Creating trees of logical structures capable of making random decisions within certain ranges

This does not mean that creating 2D random worlds is an incomprehensible science or something impossible to do, but it does require at least some knowledge and experience in game logic… and this in turn implies understanding logical blocks and progammatic components, for example :

  • Conditionals
  • Loops
  • Variables

I don’t know what your skills are, but my advice is to give a good and deep read to the GD WIKI, follow the game creation tutorials, take a look at the examples included in your GD installation, and start with simpler things.


SPAM:

I’m just working on a video game in which there are going to be completely random levels.

For now, I have worked on generating trees with random shapes and random ground decoration. Something very basic.

This links takes to the post where I maintain a devlog of the game and comment on some of those topics: [WIP] FORESTFUL [Updated JULY 13] Finished ground merging algorithm (downloable example)

I’ll give you a basic idea of how to generate random elements in a level:

At the beginning of a scene iterate (with a for each object… loop) through each instance of the ground sprite and randomly place (evaluating a random result through the RandomInRange expression) some element (flowers or rocks or trees) on top of each piece of ground.


Regarding how to save a random world, you will need to catalog each random element of the level (its position and characteristics) in a structure of nested variables that you will later have to save in a file. You will also need to create the events capable of recreating the elements from the data stored in that file.

3 Likes

Hey, yes, I know how to generate random worlds, if you didn’t know, and plus, that info was helpful as well.

1 Like