Hi everyone, this is WilsonC and I'd like to say thank you for following Trepang2 and playing the demo. If you haven't yet, please download it and play it here! Not sure if the twitter part of the contest is over yet, so maybe you can still enter to win a radeon 480 by tweeting #spreadthesystem.
I took a couple weeks to rest (I think I earned it after a couple intense all-nighters fixing nasty bugs) after the #MakeItSuperHot contest. After gathering feedback from testers and doing some planning, I'm back to making this game! It's not a lot of progress, mostly fixing up issues and learning how to make the most of Unreal 4 and other modern tech.
As I've mentioned a few times, basically everything you saw in the demo and the screenshots were quick placeholders for testing gameplay. To be honest, the demo level was actually the first "level" I made for this game. There were only a few meshes used over and over again for walls, ceilings etc and I think only 5 or 6 materials quickly hacked together from the Unreal starter content. And before that, there were only arenas made out of untextured boxes to test AI, movement and simple combat scenarios.
I'm experimenting with more open environments to give the AI more options. I made this one with some kind of warehouse in mind.
This one is a bit claustrophobic. It's named "Campus" for now. It has a lobby area and a small courtyard.
I still haven't settled for an art style yet, but I believe I've gotten the combat, movement and superpowers to a reasonably fun level and I think they won't go through any more major revisions at this stage, so I had the confidence to experiment a little in environment art by adding simple meshes and materials. It's still very blocky at this stage because of course, gameplay and readability come first, but the visuals are getting there.
No, not that PBR.
PBR (Physically Based Rendering) is used by default on Unreal 4's materials and is now standard for most modern game engines. To be honest, I didn't really know much about it (I was more familiar with the old diffuse, specular format used in older engines like Source) and improper use of it resulted in the plasticy look of everything in the demo. Since I'm doing environments now, I took some time to learn about PBR and its workflow.
From Unreal 4's documentation: "Example measured Materials. Top: Charcoal, fresh concrete, worn asphalt. Bottom: Copper, iron, gold, aluminum, silver, nickel, titanium". Notice how distinct each material looks, without needing any details "painted on". It would be very hard to achieve this with traditional shading.
Basically what it means is that lighting, shading and reflectivity are simulated in a closer fashion to real life, as opposed to the traditional way where a lot of the shading was painted onto the diffuse texture, and shineyness was conveyed with arbitrary specular values. This also means we don't need as much texture information to convey different surfaces, because the lighting and shading is more accurate - so we can make cleaner surfaces that still look realistic (remember how most fps games pre 2012 were super dark, grungy and plasticy).
Not so fair comparison: HL2 vs some quick PBR materials I made in Trepang2. Notice how the darker edges of the floor tiles are correctly lit in Trepang2, whereas in HL2, the indents on the wooden boards are totally black even under a bright flashlight. It's also very easy to discern what materials are in the Trepang2 scene from their glossiness/roughness. This is just one of the benefits of using PBR.
It's also much faster to work with and more consistent looking because texturing is now about trying to make an accurate material, instead of "painting" shadows and highlights which look good only under one lighting condition. It's also a lot faster to tweak so overall it results in better graphics produced in less time.
You might have noticed that in the demo, the lighting was a bit odd and shadows didn't blend properly. That's because I didn't have time to do a lighting pass. I put a directional light (a giant light for the sun), made the ceilings cast no shadows, added in a few spotlights in dark areas and that was it. This was a huge waste because Unreal 4's lighting actually looks really good! In future maps I plan on doing a proper lighting pass, so lights should work correctly.
Picture 1: Good lighting done properly. Picture 2 + 3: Crappy incorrect lighting in the demo level
The AI was probably the most time consuming part of development so far (and still so far from complete!) but it was definitely an enjoyable process.
I started by looking over papers on AI by the developers of FEAR and Halo. The goal was to make AI that could react to the player autonomously, but also blend it's basic combat behavior with scripts.
This was done by writing very general combat behavior. There's basically only two behaviors: attack, or take cover. Attacking basically means finding a good attack position (line of sight to enemy, prefer higher ground), move there and shoot at enemies on your way there. Taking cover has two modes: regular and urgent. In regular mode (this is triggered by needing to reload soon or taking light fire), the AI walks to cover while "suppressing" its target(s) with spaced out shots. Urgent mode(triggered by heavy fire or damage) makes the AI sprint to the nearest cover. That's basically it! There's some special behavior for say, if I'm reloading and I get flanked, pull out your pistol, or if I'm in cover and get repeatedly flanked, run away.
An "arena" box map for testing AI. Zero scripts used, the AI are just spawned and fight each other. Notice how each individual takes cover when under fire, and attacks when not. It's easier to see in HD. Sorry about the weird attenuation, I was testing sounds.
A lot of games use a lot of very specific special case behavior: like if i'm this close to the enemy, run away, if I'm low on health take cover, or just random behavior like x% chance of randomly throwing grenades in combat. I try to avoid this as much as I can because it's hard to debug, easy to exploit and it's easy for players to start recognizing patterns - for example, if I charge an enemy, he will always run away.
You might have noticed very little scripting in the demo. If you replay it and try all kinds of crazy tactics, the AI will still find ways to surround you/flank you.
However I still wanted some control over their movement and tactics without having to micromanage them with scripts. In some encounters, I wanted the AI to act like they had a plan, or to charge a position or hide even if it didn't totally agree with their tactics.
Scripts, like specific case behavior are easily exploited - for example if you script a bad guy to crouch behind a crate, but the player is already on the other side of the crate, it's going to look pretty dumb.
For a solution to this, I actually looked at some real life infantry after action reports and papers on battle drills. I'm not aiming for realism, but in real life some ideas still apply to video games. For example in both real life and video games you want to "dominate" important positions and avoid getting stuck in killzones. Basically maximize your opportunities to attack the enemy while making it difficult for them to attack you.
AI Goal System
I eventually settled on simple goal system for AI, mainly based on Halo's goal system and a little bit of HL2's assault system.
It's very, very simple and not noticeable at all, which is great because it just looks like the AI is doing its thing. With or without goals, the AI will always prioritize killing enemies and keeping themselves alive. When they're not doing that, they'll work towards goals.
I created 4 goals: assault, defend, patrol and wait. A squad can be assigned a "goal", or multiple goals. They have priorities, so higher priority goals are worked on first, but once completed they move onto the next goal. Goals have one or multiple "Goal Positions" which have a timer value assigned. When all "Goal Positions" are timed out, the goal is "completed".
This battle in the "server room" in the demo heavily utilizes the goal system. The AI can effectively take cover and flank their enemies, but those are just small scale tactics. To make them spread out and attack/defend important positions in the huge room it needed to use the goal system. The end result: it really feels like these two factions are trying to fight for control of this room!
When it's safe (not under fire or have line of sight to an enemy), the squad entity assigns each squad member to move to goal positions. Upon arrival at the goal position, the goal position counts down. Assaults count down when no enemies are seen at the location - therefore it times out when the location is "clear". Defend positions count down when an enemy is seen - when we've been engaged in combat at that position long enough, we need to get out of there (fall back). Patrol and wait never time out. After a position "times out", everyone there moves to the next one.
Highlighted are the blue reinforcing squad's (they are the blue squad that comes out of the left area during this battle in the demo) assault goal positions. Notice how the positions are placed in elevated areas (and the small "hut" on the right). When the squad spawns, they "assault" these positions, gaining control of the room and closing in the red team into the killzone in the centre. It's also very easy to interrupt and foil this manouvre by shooting and suppressing the blue squad.
"Assault" type goals select squad members to random goal positions - this is interesting because it looks like the AI is trying to cover as many positions as possible, and with clever goal position placement it usually results in flanking/surrounding maneouvres. "Defend" type goals move squad members to the nearest valid goal. This makes it look like when a position times out, the AI "falls back" to a nearby, uncleared position.
In the "warehouse" area of the demo, the player starts fighting his way in from the right to the left. The AI slowly falls back from one position to the next, and finally makes a "last stand" at the area on the left. This was done by giving the squad a "defend" goal, and lots of defend positions. Most of the defend positions have a short timer, so when they see the player, they shoot at him a bit and then fall back to the next one. The final position on the left has an infinite timer, so eventually all the AI will fall back to that position to make a "last stand". I noticed this was really satisfying for testers to slowly watch the AI lose control of the room.
The AI is still far from complete however. I've got a pretty big to do list on the AI.
I want to add squad tactics so they can attack and move as a team (currently the squads only share information about enemies and cover). And of course I want to try different enemy archetypes. It's actually quite easy because I made a lot of adjustable parameters in the AI (accuracy, burst length, suppression threshold etc). Before that, I want to add correct sensing (sight and sound) in combat. Currently they just have omniscient knowledge of enemy positions. And after that, searching behavior for when an enemy/the player runs away. Perhaps some of this will be in the next update, look out for that soon!
Expect grenades in the next build!
I plan on spending this month and most of April just studying about the engine and content creation workflows (I'm using a lot of software that I'm new to: Maya, Quixel, Xnormal. Learning pays off because these programs save me a lot of time. If time permits I also want to learn how to use Substance and Unreal's new cinematic tool, Sequencer). I unfortunately didn't have much time before the demo to learn all these things :( Once I'm ready around late April, I'll be picking up the pace.
I also want to create an AI dialogue system - currently the AI can only "bark" when a certain action has been triggered (you probably heard "Cover Me!" 100x in the demo) - this was pretty quickly hacked together. I've spent some time going over papers and videos about dynamic NPC dialogue from Naughty Dog and Valve, and of course in my time modding HL2 I worked with Source's dialogue system. I think I have a pretty good idea of an interesting dialogue system for the NPCs to "talk" to each other while they coordinate tactics against you - more on this soon! I'm also working with a very talented and motivated voice actor and writer on this :)
In late April/early May I'll start work on concept art to narrow down a visual style for this game, as well as testing character models with different silhouettes and colours. And maybe some simple environmental interaction, like vaulting or climbing. And possibly a design document, as much as I hate those... Anyways, I feel like the game is starting to be fun, and it's only going to get better from here! :D
Until next time,