top of page
  • Holly

Launch Title (Week 2) - 2.5D Sprite System


This week, the team got stuck into proper development. Since our game was going to be using 2D art for the player, NPCs and enemies, I decided the first thing to prioritize was getting a more reusable, robust system set up to allow for this 2.5D style.


I started by looking more into Unreal’s “Paper2D” feature-set for anything that would help with this, but unfortunately found that this area of the engine is quite limited. In particular there were very few features to help with 2D animation, such as the state-machines and animation notifications that were usable with 3D animations. These would be very important not just for the art style, but also for the “hack-&-slash” combat we were aiming for (Anim notifications would be especially important for managing different aspects of attack timings, combos etc).


On top of this, there needed to be a way of neatly organizing and storing the multiple sprites for each angle of an animation, and I wanted to make sure the code for swapping in each sprite was implemented entirely as a Component for easy reuse between the player character and any enemies.


To meet these various needs, I decided to look into developing a custom system in C++.



Developing a custom system

There were 3 main things I set out to develop for this system:


  1. An Actor Component that would handle displaying, rotating and updating the current animation’s sprite based on viewing angle

  2. A custom Anim Notify class that triggers at a set time in an animation

  3. A custom asset type for storing the different angles of each sprite as well as the Anim Notifies for each animation


There were a few reasons why I ended up using C++ for this system. Initially, I was mainly interested in using this as an opportunity to get some practice with the language and further develop my own technical design skills. However, after some research I also found that the language would be a requirement for creating a custom asset type in Unreal, as it was unavailable through Blueprints or the editor itself.


To prepare for this I had already started progressing through one of Epic’s own tutorial series on converting Blueprints to C++, so I finished that first.



Rather than spend a large amount of time figuring out how to handle rendering the sprites myself, I decided to just extend the existing PaperFlipbookComponent class and make the necessary changes and additions to that. I named the new component “DirectionalFlipbookComponent”.


For the custom asset type, I spent a lot of time researching and looking for any documentation I could find on how to achieve this. The few resources I did find however, weren’t up to date, and there was almost no clear documentation on the current method of implementing a custom asset. After many attempts resulting in compilation errors, I decided to look for alternatives.


Luckily I discovered the “Data Asset” type in Unreal, which while more limited, would be simpler to use and still cover the needs of the project decently enough. By creating a class that inherits from the base Data Asset class, I created the “DirectionalFlipbookAsset”, which can be created in the editor and stores all the required data for 2.5D animations.



To test the system, I set up some basic footstep particles to spawn with each step in the player’s walking animation.



After getting this working, everything seemed to be working correctly. However, later in the week I discovered a strange bug. The game would work fine while running for around ~50 seconds, but would then abruptly crash Unreal.

The process of finding the source of the issue was quite difficult, since the only information I had was that some part of the code was attempting to access a denied memory location.


I spent some time narrowing down exactly where this was happening in the code by outputting to the console at various points to see which lines were executing successfully. Eventually I narrowed the problem down to being related to Unreal's garbage collection.

I had to spend a bit of time looking at Epic's documentation on this, and luckily I figured out that the issue was with the Anim Notify classes becoming de-referenced. The fix was very simple too, I just had to make sure the array that stored them was considered a UProperty.



Weekly Meeting


Ahead of the team’s second weekly meeting, I decided it would be helpful if we could compile a list of topics that needed addressing, to make sure nothing important would be forgotten and also to help keep meetings on track.


I put together a basic table format for this, with one column listing each topic, and another for filling out during the meeting with the conclusions we came to.



There were a lot of topics to cover this week, mostly revolving around settling on ideas that had been discussed in the previous week’s meeting. Some of the bigger ones were figuring out how the “Night World” aspect of the game would work / look visually, and different ways we could achieve that.


Finally, we started putting together a list of sounds we would need to request from the sound team, with the plan being to have a mostly complete list by the end of the week.


I was pretty happy with the amount we were able to cover in this week’s meeting, and almost all of the team was able to make it too.


1 view0 comments

Recent Posts

See All
bottom of page