DEV Community

Cover image for A terrain and actor simulator on Ruby
Artur Martsinkovskyi
Artur Martsinkovskyi

Posted on

A terrain and actor simulator on Ruby

I wrote a procedural world generator on Ruby and is dope. I couldn't even imagine how dope it can be until I started.
Alt Text
From the first glance it is just a field of colored squares that looks like terrain. But the cool thing that is not visible is that the terrain is generated randomly and represents a seed value that can generate the same terrain every time you launch the generation or something else if you use another seed. It is generated with a few layers of noise and some secret sauce. The trees are also a noice, but a different kind. People may wander everywhere, but they still die in the end. You control the steps, also you can go around the map and see what is happening on it. Each point is accessible on click or keys movement.

Here you can see the whole world. The world that can be traversed and settled with life.

Alt Text

Pretty cool for a thing created on a language mostly used for web, huh?

It is a social simulation project with desktop representation via 2d game gem Gosu and plain Ruby. Most of the initial world objects are generated with PCG methods(noises, FoN algorithms, random distributions, e.t.c). It has a stepping engine with ability to go back and replay various steps. For now, people just eat and die, but I hope to add diseases that can spread between them, murder and sex someday in the future.

If you are interested, you can look at the project and clone it to run yourself here.

Would it be interesting if I wrote more on that topic, describing how procedural generation can be done with Ruby, why Gosu is a great choice to start writing games for fun and pleasure and how to glue together Ruby ecosystem to have a fabulous experience so far from Rails?

Top comments (0)