February Update

Published March 07, 2020
Advertisement

Recap

I had a few goals for February: Objectives, a new mission script and a custom K2 node for map iteration.

Results

I would rate the month as mixed.

The map for-each node went together pretty smoothly. Started by working on a native version of the array for each loop macro Epic provides as part of UE4. Partly to work a little with the wildcard type and partly because having it would make writing the map version easier. I'm glad that I have it now, but it also makes me wonder why Epic would have just included one when they exposed the map container type to blueprint. Thumbs up.

Here's an updated view of tactical. It hasn't drastically changed since the last time I posted a tactical picture.

So this is the “Investigate Signal” mission type I described in my previous post. One of the things that went in pretty quickly and smoothly was the objectives. You can see them now in the upper left under the team logo/name. I skipped doing any fancy rich text stuff, so for now I'm just tinting the objective icons different colors based on the state. Here you can see the initial objective “Investigate Signal” has been marked as complete and a new objective was added “Defend from Asteroids” when hasn't been completed yet. This objective (and the Rogue Asteroid on the left side of the map) were both added when the Yorktown moved next to the station in the middle of the map. So thumbs up here too.

This also demonstrates my new gameplay script for the new mission type. It's not actually finished though. There's still no victory condition or map specific failure condition (if the asteroid reaches the station). I also didn't manage to do any work on a new non-combat weapon that could be used on this mission as an alternative to just destroying the asteroid (which at the moment is pretty easy to do). Double thumbs down.

The main thing that happened to not get that done was getting bogged down trying to implement a clever solution for spawning starships (both from native and from blueprint, but mostly blueprint). Obviously I've got a solution that works for the start of the map, the player and enemy ships spawn just fine but it wasn't going to work very well for dynamic spawns.

The Problem

Combinatorics. Currently I have 3 different ways that you might specify the ship that you want to spawn in tactical: a reference to a ship from the strategy layer (great for player ships), a reference to an asset that bundles class information and a weapons loadout (great for AI ships), and just directly specifying a class and weapons loadout (ideal for a lot of scripting cases where making bundle assets is overkill). I also have 2 (or 3 depending on how you look at it) was to specify the location that the starship should be created: a direct transform (a tile coordinate + edge facing), a random selection from predefined spawn points or a specifically selected choice from the predefined spawn points. What I wanted to avoid was having to write (mainly) blueprint functions that became all the possible combinations of starship + position definitions, it could easily become unmanageable. And blueprint don't really do function overrides very well.

Attempted Solution

I decided I'd combine two fairly common patterns. First was bundling function parameters into a structure. Second is the classic Strategy Pattern. This way there's only one function that needs to be written that can take strategies for “how to make a ship” and “how to choose a position”. Also so that it was the most reusable between blueprint and native, I wanted those strategies to be structures. I wanted them to be easy to make which means structures in UE4. I also thought I would be able to leverage my K2 node experience to write a node that got around the limitations with structure pins (blueprint doesn't really like structure inheritance). Ultimately I did get a blueprint node that worked the way I wanted to and compiled successfully! However once I ran it, the blueprint virtual machine (or whatever) crash pretty hard. Turns out it really doesn't like polymorphic structures (which in hindsight isn't as surprising as it should be).

Solution

Maybe that solution was trying to be a little too clever. I would have liked that solution in a pure C++ project but sometimes you've got make some compromises when working in an engine. Anyway, my ultimate solution is a function for each of the ways you can define a starship. Instead of trying to mix and match the ship and position strategies, each function will only take the direct transform option. Any place that wanted to do something fancier would have to do that (calling some function that returns a transform) and pass the result to the ship spawning function.

Lesson

Sometimes simpler is better. As well as I've been able to do with custom K2 nodes, doing it with just function markup is way easier. No code is the easiest to maintain.

March Goals

March is going to be tough due to a work milestone that is due at the end of March. Still I should be able to find a bit of time for my project.

First I need to finish up the “Investigate Signal” script. This shouldn't take too much longer, it should just be hooking up a few event handlers.

Second I'd like to upgrade to 4.24. I'm still on 4.22 and there are a couple features I'd like to get access to.

Lastly, it's time to get started on my View. I've got a pretty classic Model/View/Controller setup and at the moment the View portion is basically static. I'm capable of updating the View based on the Model changes, but only instantaneously. When I move the ships around they pop to the new location, when I fire the weapons they just queue up some debug renders that just time out. So I need to add to my View a way to transition between two view states. On the upside, I've got a pretty good idea of how it should work (because of what we've tried and gotten working at work). On the downside, it's a large project that could easily take up all my time until it was done. I'm going to do my best to portion out the work so that at least a portion of each month is some sort of gameplay addition as well.

Games I'm Playing (other than Fate Grand/Order)

Legends of Runterra - Riot's new online card game. Less complicated than M:TG, more complicated than Hearthstone (I'm told). As someone with a lot of M:TG experience, it took a little getting used to but I've got a few decks that I have a lot of fun playing.

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement