Rookie Awards 2024 - Open for Entries!
Making Things Work | Day Traitors (video game)
Share  

Making Things Work | Day Traitors (video game)

by jmacfarlane on 2 Jun 2023 for Rookie Awards 2023

My first ever video game is a digital homage to a decades old board game I love, but with added quality of life features that I always wanted it to have, in the form of a third person battle area with an unnecessary combat system. I love to make things function in the background, and this project pleases me.

2 288 0
Round of applause for our sponsors

Overview

Day Traitors set out to be my best implementation of a very old board game called Stock Ticker. In that game, players take turns rolling three dice that manipulate six generic stocks in totally random ways. It's a game I recreate in every programming language I learn: Object Oriented Turing, C++, Visual Basic, even a PHP/MySQL browser version. Unreal Engine allowed me to make the version of it I've always wanted, with features I've never known how to implement before, and I'm very proud of what I've made.

I'm not great at making things look nice, but I love to make things function. It does make it hard to show off the inner-workings I implemented.

The Challenge to Be Different

The original game was three dice rolled by each player two or three times followed by a pause for everyone to buy or sell shares as needed. There's also a 1/3 chance of gaining dividend payouts. It's random and there's zero predictability, although we always go all-in on our favourites and try to point out trends that aren't really there.

In Day Traitors, all six stocks are updated every 10 seconds, a 1/3 chance of up/down/dividend. Stocks that go up or down consecutively will continue on that trend for a period of time, which is something I really wanted. There's no pause for transactions, the market never stops. Players no longer sit at a table rolling dice and looking at numbers on paper, they run around a city park as a businessman avatar, buying and selling shares from computer terminals that are inconveniently located, and throw rocks to hinder other players.

From Humble Beginnings

Before I bothered with anything looking like it would, I made some of ugliest functional elements just to get it working, and it's crazy to me to look back and see where it started. I'd forgotten that my computer terminals were once one-sided with glass privacy walls. Originally, they were just those coloured squares on the ground and all they did was detect collision. No matter what happens with this contest, it has been very rewarding to look back at what I had compared to where I am now, and see what an incredible journey it's been making a video game.

Dev Log (sort of)

Mostly for my own use, I did my best to record all my progress, which can be located here:

https://www.youtube.com/playlist?list=PLHYYtey75LYPaMWDODDzEIVQDLCnxIVt1

Level Design

I used Binary Space Partitioning to layout a nice square park with a gazebo in the middle and tall buildings all around, eventually replacing my structures with simple 3d models. And when I realized that a square map with twelve computer terminals was obnoxious to arrange evenly, I scrapped it and made a hexagonal map instead. Trees, foliage painting, a little landscaping, and a pond.

The six stocks are represented by buildings in their colour, which also house the terminals for buying that stock, while all the terminals for selling are in the central gazebo. The coloured buildings also have what I called billboards that show the current value, which isn't needed or really visible, and also feature a border that turns yellow when that stock is over $1.00 and eligible for dividends. There's no reason to look up at them, but it's another element I felt needed to be there.

I added a bank to house my loan system to prevent player elimination, set a timer for 10 minutes so the game ends eventually (we would play the board game for hours if we had nothing else to do), and crucially, the dream feature I knew UE could deliver, projectile-based combat.

Combat

I decided early on that what this stock market game was missing was arena-based combat. I knew UE could get me there, and I knew exactly what it would look like when I achieved it. Throw rocks at each other to make players lose their hard-bought shares of various stocks so you (or whoever gets there first) can steal them for free. It's a fun dumb thing I thought I'd add if I could figure it out, and I finally did.

Choose a colour for your rock and the first player hit by it will lose 100 shares matching that colour by spawning a box pick-up that contains those 100 shares. You can't lose shares if you have less than 500 already, or if you've been hit already in the last 2 seconds, and you can't lose shares of a colour you are currently selected on for your own projectile, so it's also a situational shield.

The projectile itself is a small rock from some asset pack, and it changes colour dynamically based on which stock you select. It flies slow enough that it's avoidable, but fast enough to not feel ineffective. And even though it moves too fast to notice, it does rotate about itself as it flies. The shortcomings of the throw is that it can't be aimed up or down. I mean, it certainly could, but because I'm not a rigger, I didn't know how to modify the throw animation (found on Mixamo) to look like the character was aiming up or down, and the projectile would go wherever the camera aimed irrespective of the character throwing it.

Modeling as Needed

Whenever possible, I used existing assets, because that is not my strong suit. I just need things to add functions to. Mixamo, Epic Marketplace, game-icons.net, and freesound.org all helped a lot.

The lost shares fly out of a character's body in the form of these cute banker boxes I modeled in SketchUp, texture-painted them in Blender, and created material instances masking out the white parts to come up with six lovely boxes of shares. I was so pleased with the simple design, I created a closed-box version and added the chance for the dropped shares to be this closed box, which had a further chance of being either 50 of all shares or a punishment in the form of a fine based on the amount of the shares owned.

I had to model the gazebo, as well. And you can tell by looking at it that I did it wrong, because the materials look very wonky. But I made it with BSP, exported it to Blender, and exported it from there as a 3d object to import back into UE. I'd love to have made it in Blender, or SketchUp, but it got the job done anyway. I always wanted a sort of central location for players to have to cross paths, and spawn into the level together there, although now they spawn at the entry gate which just feels more realistic.

I also learned a lot about material instances for this project, albeit so late into development that it caused a lot of backtracking to streamline things. I started out with six of almost everything, and realized much later that I could have one thing be six colours. I used the same process to mask out the player character's suit to apply a tint based on owned shares. It's not perfect because the base texture is a blue suit (and not even the same blue on each model). The models and textures came from Mixamo, and while I did have to remap the skeleton to the UE skeleton (twice), it was much preferred to making my own from nothing.

At one point, I thought my character select screen should be the two characters, and buttons that set the colour and updated the preview image, but it just felt unnecessary and slowed down getting into the game every time. Even the whole selection screen was ultimately scrapped.

User Interface

I wanted the UI to be as user-friendly as possible, again without being overwhelming. Buttons on the screen tell you how to do things like view the score overlay, or manipulate your phone HUD. For a time, when you walked up to a computer terminal, it would display "Press E to Interact" when you were close enough, but I changed it to instantly open the transaction overlay when you approach a terminal, and close it when you move away, because the game is theoretically so fast-paced, there's just no time to press E. The vendor screens also have hotkeys to buy and sell without moving the mouse, again to save time.

The vendor terminals always know how much their stock is worth, and the overlay, which is a widget, instantly detects how many shares you are capable of buying or selling, and only highlights the relevant buttons. When you click a button, the widget originally requested the player's information again and recalculated if they could still buy or sell. I realized later that because there's now way to lose and not significantly gain money while at a terminal, the widget could just keep track locally of how much money and shares you are likely to still have, and cuts down on calculations and requests.

The only thing it should do that it doesn't is update the stock value dynamically. The terminal itself, the actor, always has the right price, but the widget only gets that price when created by the terminal. In theory, you could sell shares at a terminal for more than they're currently worth if you stand there long enough, but you could also sell them for a lot less than if you'd exited the terminal and re-entered.

Scoreboard

As a throwback to my PHP/MySQL version, which was designed to be a newspaper called The Grainhouse, I made the Day Traitors score overlay vaguely resemble a newspaper as well. I tried to include as much information as I could, because I feel like I would want all this information available to me. I love the details screen at the end of Mario Party, for example - tell me every space I stopped on how many times. But I wanted to avoid it being overwhelming for people who don't care, and for a time there was even a second page to spread out the info. At the end of the game, the majority of the overlay changes.

Things shown on The Grainhouse: the real date (for no reason), the Market (including icons showing up and down trends), a top 3 scoreboard using each player's current funds and includes their most- and least-owned stock type, and an "advertisement" for the Bank which acts as a explanation for the Loan system. The #### in the top-right was originally the room ID for joining the server, but I moved that to the pause menu.

Because you're invulnerable to attacks when reading the overlay (you also can't move), I needed a way to let other players know you were occupied, so I initially made a small icon that would attach to the player nametag. When you hold shift, it would append a $ to the player name, which other players would detect, remove from being displayed and enable the icon. To make it feel more realistic, I later made a simple 3d newspaper object to float in front of the player. I initially wanted to have the score overlay actually on this newspaper object, but it just didn't seem feasible, so it's just blank on one side and generic on the other.

For a HUD, I created a mobile phone that shows at-a-glance your current owned shares, which projectile type you're throwing, and how much you've spent on the shares you own. This latter one isn't as helpful as it was meant to be, it only takes a running total of the money you spent per share and divides it by the amount of shares owned. It's truly useless information.

The phone originally had a fourth panel, which was meant to track a running average of the costs of each share, so the player would be able to tell when selling would break even or profit, but I felt like the added overhead to track it wasn't worthwhile and the expenses panel did enough of the same thing to make it redundant. An artifact of this fourth panel is the mobile phone still having four pips to tell you what panel you're looking at, which is because the whole phone is four images with four different pip arrangements. Really, the phone should be a single image with dynamic elements overtop, I know that now.

Multiplayer & Replication

Obviously the game needed multiplayer support, which may have been a poor choice for my first ever game. Advanced Sessions did a lot of the work. I used a room ID system, where originally the ID could be anything the host wanted, and it was like a password for the server. I changed it later to generate a 4-letter string every time the host panel is opened at the main menu. Players who join are passed along all the server settings, like combat and CEO Mode. Getting into the same room was the easy part.

Replication was a real hurdle. I still don't think I fully understand when or how something should be replicated. But I wanted to get as familiar with replication as I could, which is why the player names are customizable, the headings over the stock vendors update every ten seconds, and why I fought to get the banker boxes to spawn properly for all players (for a while, they spawned huge for the host and small for the client, and if they were same size they had no collision with the ground, but it was a spawn actor issue).

I always wanted at least two characters to play as, and while I ended up on adding character selection to the main menu as you can see, originally there was a whole other overlay when you joined the lobby which presented you with the two options. But my character selection was just a picture of my characters with two buttons and the park in the background, and two buttons, and I made so many constant changes to the park and the characters, it was just easier to add their faces to the menu instead.

I wanted to give the players optional settings, which is why the Host panel has that extra bit for CEO Mode and enabling combat. There are actually many other settings that are hidden for now, like game length, amount of shares dropped when hit, invulnerability after being hit, and so on. I believe they all function properly, I just didn't settle on whether or not players would really care about all of them. However, CEO Mode is an option I feel very strongly about. Completely untested for balance, it randomly assigns a unique stock type to each player, sets their suit to be that colour permanently, and spawns them in their respective building with a portfolio of 5000 shares of their CEO stock and 1000 shares of all others. They get instant payouts when their CEO stock splits instead of doubled shares, and those shares are instantly pre-sold before crashing in the event it hits $0.00, basically insider trading.

CEO options are something I originally had planned as something you could just purchase temporarily with your in-game money if you had the most shares of a stock among all players, and one person at a time could be the CEO. But this final system feels more in-line with my vision.

Thanks for Reading


Comments (0)

This project doesn't have any comments yet.