Creating a medium sized city

Dear all,

We are currently creating our first game with the Babylon JS framework and have little experience with game development in general. Now that we created the basic functionality like the movement and camera behaviour, we wanted to create a basic medium-sized city with models like trees and buildings. These models don’t need anything expect for a physics imposter (currently these objects have their own script).

However, we were wondering what common methods are to place these objects based on preset positions as we don’t use the editor. Instantiating every object individually in the code seemed messy and inefficient to us. We were thinking of adding a JSON file with positions and object type (e.g. tree or building) and then looping through the data. In this case, we were worried instantiating that many objects at a time would cause a huge delay at the start of the game.

We are very curious to hear what methods you guys use, and whether you have some examples that might help us further.

Kind regards,

Ruben

Hey Ruben and welcome!

The approach of using JSON is definitely one of the way to go. In a nutshell you need a database (json file, server database, etc) that will give you the information you need for your models.

The key point is to have a tool to be able to quickly produce that file