Skip to content

Procedural Town Generator (Unreal Engine 4)


Seen above is some of the work done in 2 days time after starting a new game project in Unreal Engine 4. The goal being to design, develop, and finish a fully playable game prototype in less than a week. Currently, the game takes an input integer to determine the overall map size to be generated, and then proceeds to decide where roads and empty lots should be placed as cells. Once the roads and empty lot cells are generated (each cell being 1×1), the game then figures out which cells contain a road that goes off of the edge of the map (black markers), and from that list chooses to where to place the player spawn (blue marker) and the enemy AI spawn (red marker).

Once that’s decided, each cell then selects from the corresponding lists of model pieces and individual components that match its previously figured out requirements. As an example, a cell might be defined as containing a straight road. It selects a random road variation from the list of current models. It then creates two sidestreet class actors and joins them so they line up at the sides. One sidestreet class might decide to become a sidewalk class, which contains its own functions that allows the chance to occur of creating 0-4 buildings on top of it. It chooses 3, and selects from different building models that can fit within its space. The other side of the street decides to become a parking lot instead of a sidewalk with an empty lot, and so chooses to become a parking lot which may or may not be filled with a randomized assortment of cars, and each car can be randomized in both rotation of parking, what model it uses, and the color of that model.

Currently the grid generation appears simple, but the variation should exponentially increase as assets of models and classes get added to the library; allowing for sweeping global changes to the entire game with the push of a button or the changing of a float.

Next steps will be to develop a series of functions that allow for a more advanced integration of how the AI is both created, and how it interacts with the map; such as including an option for a certain number of AI to be created inside buildings scattered throughout, as well as a specifically marked location, whether they should automatically patrol through different cells, defend a building, generate hints of where they can hide or take cover, etc..

Also are plans to add a new series of commands that run after the initial map generation to determine how the game plays out for that specific map, such as the simple neutralize all enemies objective, defend a building/item, escort a VIP, prevent robbers from running to the street borders of the map after fleeing a bank generated in the center, etc.

[UPDATE] 7/11/2017

Time has spent working on getting a basic form of the character modeled, with animations working in UE4 as well as basic AI that will react to sound if no enemy is detected, or detect an enemy if it sees it within the degrees of its conal vision. Additional features include among others:

-Characters rotate head bone to face nearest target/enemy, allows them to look up/down if the target is at a different elevation

-Characters now randomly blink using a special material that slides an alpha mask down the UV of the spherical eyes, which were cut in half and flipped to be overlayed. The result is a material instance that powers random blinking to give more life to the character. *Must remember to stop blinking from occurring upon death.

-Characters now play a death animation while transitioning into ragdoll physics, giving the best compromise between having static death animations, and having ragdoll physics that don’t look too much like becoming a flimsy puppet upon death.

-added in bullet decal effect and particle blood effect.

-added in basic reaction hit animations, currently uses one additive animation offset in an animation montage, and scales the blend of the montage randomly between 0.1 and 1 before playing. Playing the montage is called upon taking damage. Will add in more animations from different angles to increase the variation between hits.

-Spring arm camera boom programmed to switch between shoulder-aiming and regular aiming. Character will automatically orient its rotation to movement, or rotate to face the aiming reticle dependent on whether the player has “fired” or shoulder-aimed in the last few seconds.

-added in procedural grass/tree scattering feature, derived from making a custom grid for that actor. Foliage will use the grid to generate an even point distribution of placement, and then depending on the percentage will either fill all, none, or partial of the invisible grid. Allows grass and tree features to be parented to tiles, in order to create grass or trees during runtime that align with the area of a cell.

-added in a volume remover feature, which will destroy any instances of grass or trees, etc. within its invisible box volume. When parented to buildings for instance and scaled to fit a building’s bounding geometry, will destroy any grass or trees that might of been generated where the building is located, preventing any tree or grass from appearing inside the building’s interior.


Rebel One (Personal Game Project)

Prototype Level

Here’s an early video of a personal game project that I’ve worked on for about a month so far in the unity game engine between jobs. The project originally started as an exercise in increasing my knowledge of game programming in order to supplement my primary focus on artwork production and game design.

Some things learned coming from an artist dabbling in some game programming:
-Raycasting is powerful, and you can get a lot of mileage out of simple boolean checks, distance equations, and time.
-Some things that I thought would be complex for me to program turned out to be really simple.

-Somethings I took for granted == not so simple. Save game states, who would of thought.

-Debuglogs and printing out script variables is valuable when I haven’t implemented any visual feedback yet.

-I hate nullreferenceerrors

-And not really programming related, but level design (and flying around the level in the editor for hours…) is still fun!

The following deals with more of what goes on in my mind when I’m focusing on the other side of development.

The overall aesthetics focus on a minimalistic depiction of a war between the blues and the greys, while introducing rather computerized elements such as the strange grid floor animations and the choice of trees showing their “raw” billboard components rather than “actual” alpha masked-leaf textures. Not necessarily pure abstraction-ism because the objects are representative, but as a mixture between both representationalism and basically me playing with elements of abstraction. Plus, a little bit of animation and massFX pre-baked destruction goes a long way!

The color palette is kept to a strict and deliberate choice of complementary blues and oranges when dealing with the main city layout and enemies, with greys being used to ground the player and eventually his AI comrades. Textures will be used in an almost spot color manner in order to keep visual interest going throughout the game.  Three separate directional lights are used to fine tune the control over each surface, especially since most of the environment relies on solid color so a high level of attention must be paid to how each side is lit, with ambient occlusion playing an important role in helping to distinguish the different features of each model from one another.

These choices were made with the goals of both creating a hopefully light and refreshing visual design of the game, and perhaps most importantly, one that is both malleable and manageable for a one-man project.