Download

Very easy and simple "Doom like" sprite based character

I managed to fix it. I think i had two flipbooks set as flipbook components and it kept giving me an error and then I got confused because it got late in the moring and my brain stop working haha. so this morning I just set all to just a flipbook and only set the one u labelled flipbook component as a flipbook component. Thankfully all is ok now and works great with the arrays and states. Thanks again :slight_smile:

Yeah mastermeme. This Postprocess tutorial is sooooo great! ha! always nice what you can do with post process. I love it. I also learned to not use EventTick. It will often produce errors in Network games :slight_smile: Thanks for the Info. For the Camera Rotation thing. I found out, if you plug the Pitch (Y) of your camera Rotation into the (X) !! then you get the right up/down rotation with the camera! I use this for my Mines. So flat things on the floor should look orthogonal to camera if i look down on them. And the actual PaperFlipbook (Y)-Rotation is also not connected anymore. I was wondering but it works for me :smiley:

Great that you had it working, thankfully UE4 is very good at telling you what’s going on.

Good stuff, are you starting to have power again? Yes I think you are :smiley:

Hello Masterneme! I kind of did everything like in your tutorial but I failed =( please See the video that shows my problem. Sprite does not focus on the camera, please tell me how to fix it!

Hello Masterneme, thank you so much for posting this,
I’m having problems in placing the flipbooks in the variables. I can only put in one sprite, instead of 8 like in your example.
Is there a workaround?

Without seeing your graph I can’t say for sure, I think something is wrong with the macro and the SetRelativeRotation nodes.

I think you forgot to make them Arrays.

Thanks for the tutorial, I rendered sprites out of my Skyrim follower and made this test: https://youtu.be/APZItEV5CT0
If I want to make a MP game, how to manage the flipbook rotation for all player, now it uses only “player0”.

As long as you don’t make it a server side function it should work because every client is a “player0” on its own machine. But I haven’t tested the multiplayer much so I can’t say for sure.

Ok, thanks.

Can you do a 32 angles billboard with your technique ? I’m eager to test it.

Yes, modify the macro to add the extra angles.

Okay, I’ll try this later on.

Thanks for your tutorial, I’m trying to follow it, but there are steps I can’t get right for now…

At the Arrays part for the Flipbook, you don’t show where to put the Arrays exactly.

For the GetAngleFlipbookFromArray part, you just say “copy the image” and don’t explain how to set the GET nodes. How are we supposed to guess ?

In the Calculate Flipbook Angle function, I can’t link Flipbook Component actor to the “Set Relative Rotation” targets. So I just linked a Paper Flipbook to all of them.

Hello to all. Recently stumbled upon your topics. I am a remaster of Redneck Rampage and about a year ago I created my own sprite system. By a general principle, I came to a completely independent way about the same result as the masterneme. But, just yesterday, I ran into an animation problem when I needed the animation to not start anew when the angle was changed (this is relevant if you have a long flipBook animation). In the end, I redid the Sprite engine to a minimum, it uses the Event Teak minimally and is very compact. A little later, lay out the system itself.

Unfortunately I do not speak English and the description will turn out to be muddled)
Create an arrow (or any other object) that will serve as an anchor (root) for our flipbook and with the help of which we will determine the angle. Create an array of elements defining the behavior of the character.


Each element consists of a structure of corners.

Create the Actor component and attach it to the character (general view of the sprite engine):

Here we calculate the angle between the player and enemy, and also make him always look at the camerа (In this case, I use the player’s camera for calculations, but you can use the player’s position - the result will be slightly different):

The most interesting is the calculation of angles. The input parameter is the angle calculated earlier and the scale (the scale is necessary for flip beech mirroring (i.e. for angles -135, -90, -45), as well as for correct scaling):
FindAngle.JPG

To be honest, I no longer remember all the nuances, but most importantly it works))

The change of animation is a separate event. Here we save to the variable of the current frame in the animation and check if the angle or animation has changed (this is so as not to load the event again):

Well, here is a direct change of animation. Playback position in frames function is not mandatory and, as I said above, it is necessary to not interrupt the animation when changing the angle in long flipbooks:

In the character in the play play we connect a flip beech, an arrow and an array. Change the animation caused by the event:

I am not a master at writing posts, but I tried as briefly and clearly as possible. Most likely I missed a lot and did not tell, but I will be happy to answer any questions))

You’re correct @AlexeyLM As it is now, when you change the angle the flipbook plays from the beginning, I recently fixed that to add footstep sounds, this is my solution:

I created a Macro with a Float variable called PreviousFlipbookPlaybackPosition and another one referencing the Angle Enum called PreviousFlipbookAngle.

So every time the Macro is executed it stores the playback position and the angle, and if there’s a change in angle it makes the new flipbook play from the previous position plus the DeltaTime.

And because I added it to the OnFlipbookAngle event, which is being looped through a Timer, I don’t need to use Tick.

This is the result:

Now everything is synchronized.

Is great seeing other people getting to similar conclusions :D, thanks for your contribution @AlexeyLM, now people can choose different approaches, I’ll check your Blueprints later in more detail to see what can I learn from you.

Edit: I forgot to mention that, as you can see in the second picture, before setting the position it compares it with the length of the flipbook so it doesn’t set a time greater than the total length.

In other words, if a flipbook is 10 seconds and the previous position is for example 9.99, when the angles changes it will play from 0.01X instead of 10.01X.

This is because of the added DeltaTime, but with this quick comparison there’s no problem and you could set a slower Timer that it will still work.

Good afternoon @masterneme. It’s a pleasure to improve and perfect the “doom sprite” feature and achieve great results. To reduce the calculations, I also added a small timer disabling Tick if the flipbook was out of sight.

Unfortunately, not all so smoothly: I was faced with the problem that I described in this question: https://answers.unrealengine.com/que…-flipbook.html
In short: I found that cull occlusion doesn’t work on FlipBook. Those. when the enemy is about a hundred-all of them are visualized in spite of the walls and surface. Have you faced such a problem?

HAHAHA, you know what? It’s funny because I’ve been researching this exactly for the last couple of weeks!

But I haven’t tested it because I watched Rare’s video about Tick Aggregation and I’ve been thinking about doing all the calculations in just one place using a ForLoop and a bunch of Interfaces.

I had the suspicion that only Frustum Culling would work with the WasRecentlyRendered node and that I’d have to do extra visibility checks using Traces.

I’ve been thinking on a system that depending on the distance with the player the Timer calculating the Angle will have different times, because it’s a little bit wasteful doing so 30 times a second if the player is for example 100 meters away.

But I didn’t want to have every actor doing calculations all the time, I wanted something similar to what Unity is doing with ECS/DOTS, just one system doing everything in one place. So I watched a bunch of videos and I’ve been putting on paper some cool ideas to do it.

The problem I have is that I don’t know exactly where to put it.

For now, what I want to do is move the functionality to a modified Camera Blueprint that will be the new Camera Component for the player.
Characters will only have WasRecentlyRendered with a timer and if it checks True they will send a signal with an Interface to this Component.
Then the Camera will put all the actors in an Array and perform the calculations.

Now with your tests I don’t even know if Frustum Culling will work using Flipbooks, I hope so.

I’ve been thinking also about an optimization to get rid of the PawnSensing/AIPerception component. Because we’re already calculating the Dot Product to know where the player is located we can just use this to alert AI when we’re in front of them, but this would mean we’d have a list of every enemy and I don’t know if this could be exploited in a multiplayer environment.

The video I mentioned is this one:

You have very interesting observations and ideas, I certainly need to think about these options. Recently, I am not quite sure of the correctness of my conclusions. The command “r.VisualizeOccludedPrimitives 1” shows that all the same the flipbook is cut off and the occlusion works as it should. In general, there are still many tests ahead)) In the meantime, I solved the problem rather roughly, but effectively. In the character of the opponents in a flipbook, I put “Desered Max Drive Distance” from 5,000 to 10,000.

EnemyCharacterRendering.JPG

I didn’t think about LODs and that would be another interesting thing to make optimizations to. Do Flipbooks change their quality depending on distance? Because if they don’t I’m thinking that using the same system to calculate distances we could tell characters to change their Flipbooks to others with lower resolution sprites and those very far could be just rectangles with one or two colors.

I wonder how far can we go without going deeper and actually do modifications using C++. I want to create my own custom Character class and remove the Skeletal Mesh Component and other stuff, that would be a good time to add all these optimizations too.

Whatever it takes to have maps with thousands of monsters :cool:

I’ve been playing around with this.

I created a custom Camera Component, put a GetAllActors after BeginPlay and add them to an array.

Then a ForEachLoop after Tick and a bunch of PrintStrings.

Actors behind walls return False using WasRecentlyRendered, I don’t know if Flipbooks are still in use while the Actor is occluded but we could just send a signal to tell the component to deactivate if that’s the case.

I experimented calculating distance and dot product and the results are satisfactory so what I talked about could potentially be done, performing the operations in a custom CameraComponent attached to the player.

I also found out that there actually is a character without Skeletal Mesh called PaperCharacter with a Flipbook Component, silly me was using the regular character for 3D.

And I’ll paste 2 links for future reference because they contain relevant information:

https://answers.unrealengine.com/questions/21801/check-if-an-object-is-visible-by-a-camera.html