How can I have enemies displayed as 2D sprites like in old-school shooters?

Hi,

A couple of days ago there was a new release of the Brutal Doom mod.

I’ve been playing with it during the weekend to… ahem… “test” :wink: the gore system.

And I’ve been wondering how could I put 2D enemies using sprites within UE4.

Well, the real question would be how can the game change the sprite when I rotate around the enemy so I see different angles?

Can this be made with some animation blueprint?

Thanks in advance.

Hey!

Since sprites in Unreal are nothing more (sort of) than a square with a texture on top of it you could rotate it relative to your player position in 3D space. The problem with creating sprites for 3D space is that for every angle you want, you would have to draw and animate everything from scratch!! Unless your middle name is ‘Walt Disney’ i don’t think that this is a realistic approach. :stuck_out_tongue:

So technically it is possible to change the flipbook regarding player world space vs enemy world space but due to the time consuming nature of drawing and animating stuff i wouldn’t recommend it.

I have a couple of sprite sheets from other games to test it, but if I wanted to do it by myself I could create sprites using Blender and a 3D character.

With the process you said animation blueprints are not the right choice, correct?

If you mean to render 3d models as image sprites from blender, that does make things easier. But, consider how many angles you want, get that number, and the multiply it by the all the actions you want in the game, then multiply it again by how many frames each action is. This exercise is to get a ball park of how many images you need to render, and have stored for the game to access.

That’s a LOT of sprites. The quantity aside, UE4 has systems for working with sprites so this is possible, you really need to manage your resources in the planing stage more so than games with 3D graphics in this regard because of this exponential inflate that can happen when designing 2D games.

I don’t really know anything about UE4 2D graphics games, so this was all I can contribute. I wish I could have been more help.

Correct. If you have a 3d model is easy to create a lot of angles because you only have to rotate it and press export. Otherwise you would have to draw every animation from scratch .But i am not so sure about the aesthetics result since it is a 3d model but this is your decision to make.

Don’t worry I’m not that crazy :slight_smile: I already have some sprite sheets.

I want to do it for learning purposes.

So in theory I need to figure out a way to detect where are the characters looking at, calculate their relative space locations and make the system adapt flipbooks on the fly based on that information.

Something like that?

I think you got the right idea.
You could use a 3D pawn just to get reference information to help UE select the correct sprite sheet.

The third person character for example. You can reference them and get their rotation, and compare the rotation to a value that you want to trigger the corresponding sprite sheet. (but this method would only work for a static camera, if you intend the camera to rotate, then IDK what to do from there)

I’m sure you’ve already looked through these; but in case you haven’t I’ll link them anyway.

Yes I’ve watched those videos but I’ll do it again, thanks.

I found 2 articles providing useful information related to this topic:

http://zdoom.org/wiki/Sprite#Angles

I got some like that but is unfinished, this will be better in the Blueprints or C++ forums, the main idea is use a 3D model of a plane and set the direction all time to the local player, then convert the rotation to 0-360 rotation and you make a switch with the number of faces you got and change the sprite using the rotation where you are looking.

We have Imposters for stuff like this

https://docs.unrealengine.com/latest/images/Engine/Content/Tools/RenderToTextureTools/3/13.jpg

Oh thank you very much, I guess I can start from the “Import the Imposters” step because I already have some sprites to test.

Edit: I found a great guide How to Create 3D Imposter Sprites in Unreal Engine 4 - Part 1