Random generation and Procedural generation

Hi all,

Interested in making a game with a completely unrealistic and likely infeasible amount of randomly generated things from characters, their portraits, the world, the way hordes move around a world, the way people grow up in this world and a ton more. Could unity handle a metric ton of events like this? If these happened server side, and clients ‘simply’ rendered the results, could this type of model work?

This is very vague, but any ideas or references would be great and appreciated. Thanks.

You haven’t given any details or specifics. The only possible answer you can receive, is “maybe”. You could ask this same question about any engine, and the answer would be “maybe”.

Can Unity handle random objects? Yes. A lot of random objects? Yes. A metric TON of random objects? …what does that even mean?

As Khanstruct said, maybe. It’s impossible to know without specifics.

Khanstruct, a metric ton of gameobjects is 1000kg of gameobects.

Yeh, sorry for vague. I just thought I didn’t want to really get into learning and using it and then find out it’s slowing down and there’s no way to get around it. This kind of stuff apparently does actually happen, I’ve heard of it with more basic engines. I’m a noob, and I suppose when I asked for references, I was just wondering if people could give me ideas about programs that existed that used unity and handled loads of events continuously. That might give me an idea… maybe ? Perhaps this question just can’t be answered. But thanks anyway =)

Have a look.

Ok thanks Khanstruct. Pretty things.

The simple answer is No, you are limited by your hardware and/or the players hardware, check out my Cube Mark Demo, just simple cubes but you are limited to a few thousand depending on your machines CPU/GPU limitations.

But that is just the visualization of what is near to the player, e.g. Minecraft has a potentially infinite world but the player can only see a limited amount at any one time so only that piece of it is drawn.

This involves chunking the world into blocks and only displaying the chunks that are visible to the player.

With this kind of approach you can have a larger procedural world with decent performance.

And if you could use a Level of Detail modelling approach to all of the features in your game, e.g. wars, famine, politics, ect then you could have a very dynamic and interesting world to play in.

So the complex answer is yes but it’s not going to be easy, if it were a game company would have done it by now.

Look at the way modern games are made a group get together and tailor an environment to provide the player with an immersive engaging and fun experience that works within the technology and hardware constraints of their target platforms.

Actually, procedural content was originally used because older computers couldn’t handle enough information to make games. So, you ended up with games like X-Com, with procedurally generated levels. It allowed for what appeared to be endless gameplay while actually maintaining a very small file size.

Even in modern games, like Spore, the creatures were incredibly tiny. (A few kilobytes.)

Its not really about file size. Its a matter of whether or not you can make a game in this way and keep it balanced. (Which is incredibly difficult.)

There are ways with level of detail methods to better performance in large environments, but I think after you get so huge the server needs to stream data to the clients while playing. Like google earth.

With procedural content as long as the client is fast enough to generate the initial area around the player, there is no need for a server unless you go multiplayer and then only the changes need to be streamed.

Basically, you want to use the output of some pseudorandom algorithm, of which you control and know the seed (so you can save and re-create the world later or on another client by replicating the same initial process). Then you save/load any changes, which you apply when necessary. This is a tried and true process, pretty much how Minecraft, Dwarf Fortress, Spore and many, many more do it and it works very well.

At this point, multiplayer or not, the key informations are the level’s initial seed as well as the saved changes.
What makes a difference is what data you process and how. This will depend on your game design.

Thanks again all. Arowx, I think you understood what I was aiming at, although I had articulated it terribly.

I woke up and thought of what I wanted to ask more specifically though; If the world exists (on a server) as a ton of environment variables that are changing at certain periodic ranges, complex unit structures (for example: civilians grow older, move around the map, eat/drink use resources, interact with players, and so forth ) that change over time and according to rules and other variables changes, and all kinds of other structures which govern how groups of units move, weather and it’s movements, and content that is generated (for example, quests are generated when a certain amount of enemies ‘breed’ and become a problem), then could all that exist on a server, while parts of it be rendered individually by a player’s client? As you’ve said with Minecraft and others?

The potential problem, seems to be to me, that the server would essentially need to have a huge number of structures and it’s variables in it’s memory at all times, while others could be loaded and changed as necessary according to their periodical timers. Perhaps this server code wouldn’t be made with Unity, and I’d have to experiment to see just how much memory would have to be used at any given time, to begin to judge just how big the world can actually be.

The “assets” should be client side, you can generate the orientation of available assets for world, buildings, npcs, etc on the server and communicate it to each client who puts it together…not actually sending models over the internet to each client, just instantiating the ones required and positioning/rotating them in 3d space.

The number of things with physics would matter, but worlds and stuff can be “models/chunks” positioned in various orientations which you can “cull” to stop drawing when not in view.

Yeh, if the world is constantly changing, you wouldn’t be able to download any large part of it (say in patch form, for instance, like WoW), but rather just render the objects that the server tells you are in your character’s ‘radius’ right? is that kind of streaming heavy?

You can’t render the entire world at once, but if you’re smart about optimization, you could probably run simulations of the rest of the world while only rendering the player’s current region.

Depends what you mean by constantly changing…if you’re talking about resources growing, npcs using them, etc that’s not heavy. What’s heavy is if you constantly generate every single thing from the ground to the objects on top of it.

Rendering is done client side, I think you’re imagining rendering as taking place on the server which is sent out to each client…which would suck no matter what engine you use…lol

Um sorry for a blunt answer, but it just depends on how smart you can organise and program it.
You can make everything procedurally generated if you like, but you don’t have to make everything procedurally generated
‘In Real Time’. You should just work out what you need at what point and generate the content either at the request, or in a previous generation stage. I’m generating 5 largish islands, including 100s of lootable inventories, 1000s of loot items, 100s of scenery items and dozens of npcs (per island). But I dont do it simultaneously! I do it a step at a time and then save and recall anything that is static, The initial generation time might even be a few minutes on a slower machine, but after that the results are stored on disk. For a game that might take hours and hours to play thats not too much to ask. In addition you can pre-generate sets for players who might want to jsut use a previously made world.
In short the best way is to just start doing it, you will soon find out what is too much to ask for realtime PCG and at why. Then you can re-write the way you are doing it. Unfortunately there is no specific advice that will be right for everyone, since your project will be different and require different content than mine or anyone elses. Just go for it and see how it works out!

Nah, I’m imagining that the server holds all the data and sends object id’s and other things to the client which will then know what to render and where. I was imagining that all this data on the server should be changing constantly (well not all of it, but for example a weather patch moving over a region, and villagers getting resources which removes trees from the landscape) and that this might be difficult for the average server to do. If streaming every thing in a player’s radius isn’t too heavy, that’d be fine :smile: