Page 1 of 1

[ugold227i] Making a sprite sheet out of fonts, maybe?

Posted: Sun Mar 04, 2018 3:48 pm
by ANUBITEK
So I have more important things to pound out right now, but I just thought of a way to store my sprites for my animations better: make fonts. So let's say I use 0-9 for animations, each number would return a sprite frame of my character instead of a number as ASCII text. I haven't tested this at all yet, just a thought I had yesterday. But this would reduce my overall textures loaded from 22 down to 4 per rotation angle, 8 rotation angles, so from 176 textures down to 32 font textures.

I got this idea from seeing damage text being spawned and bouncing off of pawns in UnrealSP2D. An actor spawned, was assigned a string, then launched in a small arc off of the targetted actor with falling physics, so that means that text can be drawn for an actor's draw type and either texture or sprite. From there, just use Higor's anim manager and an array of sprite references ( f= font(texturename), frame1= f.0?)

For now I have to rewrite optimize previous code.

Re: [ugold227i] Making a sprite sheet out of fonts, maybe?

Posted: Sun Mar 04, 2018 4:49 pm
by papercoffee
You mean sprite-sheets? I thought that's how you've done it in the first place.

Re: [ugold227i] Making a sprite sheet out of fonts, maybe?

Posted: Sun Mar 04, 2018 5:42 pm
by ANUBITEK
No, what I have now is an .INT-parsing system that searches for the owner of the actor that will display the animated texture (Pawn is the owner of SpriteActor). If the actor's name is found in an .INT, the individual frames of the animation are stored in an array, so it is like:
object=name=RPG_Puppet[...]description=dir=8

anim[0].walk[0] = sprite_Puppet.walk0_0 -> anim[0].walk[7] = sprite_Puppet.walk0_7

This is my array of sprite frames for walking forward. The idea now is something like anim[0].walk[0] = 0 -> anim[0].walk[7] = 7, then converting that number into a name or string and doing some sort of setting of text while appending this number to a font name. Let's say the font is called 'walk0', so appened '_'+spriteframenumber or something like that. I haven't written any code yet, just an idea. The idea is to use a texture atlas instead of multiple textures.

Re: [ugold227i] Making a sprite sheet out of fonts, maybe?

Posted: Mon Mar 05, 2018 1:47 pm
by Feralidragon
In UT99 at least, you cannot draw text in a an actor, unless the actor is set with a scripted texture, since it works almost like a canvas, therefore in such a case you don't even need to make it into a font, you can use a scripted texture to render it like you want, including rendering only a specific part of a bigger texture.
The only downside of this is that scripted textures are global, in the sense that if you spawn 2 actors sharing the same scripted texture, what you draw in one will also appear in the other, given that they both share the same texture reference, so you would need to create multiple scripted textures and manage those, even if you used a font for this.

Other than that, given that this is such an Unreal-centric question, potentially using their specific features, this is probably a better question to make at OldUnreal instead.

But what problem exactly are you trying to solve by using a single texture instead of multiple (I can imagine why, but I didn't understand your own specific reasoning very well thus far, which could help in contextualizing what you really want).

Re: [ugold227i] Making a sprite sheet out of fonts, maybe?

Posted: Mon Mar 05, 2018 2:14 pm
by papercoffee
Feralidragon wrote: But what problem exactly are you trying to solve by using a single texture instead of multiple (I can imagine why, but I didn't understand your own specific reasoning very well thus far, which could help in contextualizing what you really want).
As far as I have understood, LannFyre wants to reduce the amount of textures used for each character (pawn).