Home 3D Art Showcase & Critiques

Procedural Map/Game Generation - UE4

polycounter lvl 7
Offline / Send Message
Deathstick polycounter lvl 7
Hello all,

Figured I'd share this mini project of mine even though it's not necessarily a classic art asset/model critique/all things are prototyped/subject to huge changes. Since being laid off, I figured it would be a nice thing to work on my own little game projects in UE4 to keep busy along with the whole job search crap.  

Anywho, the end goal/initial idea is to create a relatively simple map generator that first constructs a grid, assigns where the roads/paths should be, assigns where the player starts (currently must be on road going off edge of map), selects from a few random points on the grid filtered out to meet certain requirements such as how far its from the players starting point, assigns those cells on the map to be the game play objective such as should it force create a building with an interior, force certain picked cells to have enabled enemy spawns, should a cell require a specific class object required for the selected objective, etc.

Hoping to make it so the end result is a game creator class, where I can simply add new art assets/classes/gameplay elements/etc. to a literal set of named arrays that the map creator uses as its building block library. Currently I'm framing the design around the idea of quick maps where the player plays a police officer or swat team leader/member, the map generator serves as a "callout," and they'll have objectives like neutralize all suspects, find and defuse the bombs, raid the RV meth lab, etc. though who the freak knows, it could change to army vs aliens/military/whatever the point is to have fun in making it, while possibly dipping my toes into the world of C++ since I feel like I'm reaching the extent of blueprints/am comfortable using them/might open more doors outside of the small field of games.

Initial Map generator 2 days after starting development:


link to prototype test showing map generation: https://youtu.be/D4HrPkGosqM

Last night's work on making a class that will generate a grid array of points across its assigned cell, and having TotalAmountOfPossibleTrees and float chance of spawning a tree per point from the map's seed. The game currently takes all the points marked as containing a tree, and adds an index to a hierarchical static mesh instance component, ensuring draw calls are kept low/game doesn't lag with a ton of trees visible.   The fun part was the math in making it so it'll evenly spread the grid across the whole area depending on the total-amount of possible tree locations I assign it to contain. Size/rotation is random float in range, though I have an idea to expand it so it selects one point to be the "center" of the forest, so the trees will be tallest near the center, and gradually filter down to smaller max random size in range the further a tree point is away from it. Same idea might apply for buildings in making the center of a district have skyscrapers or 5-floor buildings, with the edges having 1-2. 


Image showing how the cells currently are divided. The big cells are composed of which road type/direction it has, so if it's a 4-way intersection it makes a 4-way actor. the 4-way actor has the 4way staticmesh road, and has 4 of its own cell "zones," with the zone class determining whether its a sidewalk, parking lot, forest, empty space, building, etc. Then each of these zones can have their own subzones, such as if its empty pick a forest, if its  a parking lot how full is it with cars, if map is at night and its in a commercial/industrial zone have it be mostly empty, if it's afternoon mostly full, etc.



The current plan for buildings is a premodeled library of buildings, with the actual class for each possible building adding random details such as tree placement, color/texture of building, random sign/wall/roof prop variations, etc.  So the smallest classes while procedurally generated, will always include a bit of hand crafting such as general aesthetics, specific game-play elements such as possible locations where one time it might be a suitcase, another time a bomb, etc. I was a bit inspired from reading about the development of X-Com 2 in regards to the idea of finding a happy medium between random, procedural, and hand-crafted.

And because scripting makes me more and more lazy, the building walls/terrain textures/roofs and such are all using a special world-space material, with a projected subtle gradient ramp to help ground each floor, cause the heck with fuckin' around with UV's when I'm technically supposed to be making whiteboxes at this point, buut I'd like to have a sense of where the art direction might head when dealing with procedural elements.


/end text


   

Replies

  • Deathstick
    Options
    Offline / Send Message
    Deathstick polycounter lvl 7

    Well I added in some basic state AI, so AI can be assigned multiple teams and will attack opposing teams from an array. Currently has three states of AI, Safe -> Caution -> Engaged. Implemented personal "sound system" so if a gunshot is fired nearby, AI will move towards the shot location if not currently already engaging an enemy. Only engages/"knows" about enemies if it had seen it within a conal degree from its eyes, selects enemytarget dependent a scoring system determining whose the closest, did recent damage, can currently see, etc. 

    Procedurally, switched up how the whole zone system is divided a bit, it's now a bit more of a hand-crafted zone, then I'll make quick childclass variations of that zone by moving around trees/props/streetlamps and such, so if the game selects a specific building it would only select it once if building list isn't exhausted, and then pick from a list of variations of that building.

    Spent the last couple of days making the character have arms and legs while still keeping it simple, added in head turning/facing target and blinking (eyes blink by panning a mask/eyelid up and down in the UV space, eyes UVs are cut in half and rotated to overlap.) figured out how to do skeletal animation retargeting so I can use some of Epic's animations as a starting point for my little guy, and figured out how to override specific bone chains to separate out weapon holding vs walking.

    Also made some grass, a uniformly lit grass material that will still receive shadows as tangent normals is off and normals are set to up (no ugly darker side of grass billboard), and added in a new blueprint class for grass that will generate instances of grass in a grid/box volume as well as another class to go along with it that destroys any instances of grass within its scaled box volume. (So grass class is placed/parented to a tile zone, and a grassremover box will be placed around a building to prevent grass from being placed inside a building/no floor clipping) I might rewrite how grass is created later, so it'll only create clusters near the player on the fly instead of generating the instances all at once at the beginning, though for now it gets the job done.

    Time to focus on how actual buildings will be made/modeled. I'm thinking about starting off with a snap-kit of pieces with interior/exterior sides so I can make a bunch of quick variations and adjust accordingly within UE4. Still aiming for the game being a basic third person-shooter where the player plays as the police/swat on callouts but we'll see when I get there.
  • Deathstick
    Options
    Offline / Send Message
    Deathstick polycounter lvl 7
    added in bullet decals, ragdoll function, hit reaction, automatic switching between player oriented towards camera and player oriented towards movement depending on whether the player recently fired or shoulder aimed, blood effect, among other things. Still am debating between a few different ideas of what the "wrapper" will be for the game; I like the idea of a police game but I also like explosions.. hmmm. Well bright side is I can always think about the wrapper after I find out what game mechanics/ map objectives turn out to be the most fun/engaging. 

    video of latest test:
    https://youtu.be/Q7xgLIW2fYI
Sign In or Register to comment.