Tilengine - The 2D retro graphics engine forum

Full Version: Interest on retro and future game projects
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello. I'm Uneven Prankster, writer of a few C/C++ games made with only SDL2, and some other interesting games made with engines. Currently I am working on Lone World, a platformer made with Godot Engine focused on being surreal and odd. Whilst we are indeed facing loneliness at the time I write this post, the game was not made about that topic, but about the oddity of what surrounds us.

You can check these games out on here, some of them have their source code available for preservation and poking around. Generally I like poking too with software and ever since one of my previous Math teachers had encouraged me to move forward with exploring programming, I have managed to climb up the steep yet rewarding road so I can make games for people to play. It's my dream and even in the harshest of times it brings me joy!

And old consoles also bring tons of joy. Old games which turned the constraints of hardware into creative solutions. From turning clouds to bushes to making 3D out of affine transformations! And this is why I have taken interest in Tilengine: I hope to use it in upcoming C/C++ projects and even contribute to it. The docs are lacking and that saddens me, so I'd like a ton to add info there so I don't see no more blank spaces.

Currently, I have written a beefy program testing out most of the things I want: sprites going into places, animating, wobbling, stretching and zapping at the sight of scanlines, I love it! And I am going to make a RPG using this stuff. While I may have come into a few misconceptions of mine about what some things do, reading the source code along with the samples helped a ton. Here is a photo of it!

[Image: unknown.png] 
Hello Uneven_Prankster, welcome!

Thank you for sharing your projects and interests. I am glad that you are interested in Tilengine's proposal and that you consider it as an option for future developments. You've done some tests already!

You are absolutely right about the documentation: it is incomplete. It is true that the reference is updated (http://www.tilengine.org/doc/modules.html) and that there are examples in source code that illustrate more or less all the features, but the part corresponding to the manual by chapters needs work. Without that complete section, it can be difficult to get an overview of everything that can be done.

If you need help or suggestions on how to get something, I will be happy to give support
(03-26-2020, 02:36 AM)megamarc Wrote: [ -> ]If you need help or suggestions on how to get something, I will be happy to give support

I would like to know a way to "take a screenshot" in game. It has been tricky capturing the screen so therefore just having to press a button to get a PNG of the current frame would be pretty great.

EDIT: A feature I liked from the SNES is Color Math. It helps do a lot of cool color stuff like allowing things like mixing and doing some transparency effects. Layers seem to do this with blending? I'd like to know! This video from Retro Game Mechanics Explained explains it well!
Taking screenshots is not natively implemented, but can be done without much effort directly from your application if you add FreeImage library:
http://freeimage.sourceforge.net/

If you're interested, I can write a small snippet that you can include in your application to take screenshots.

Yes, blending is based on SNES color math. Is not a 1:1 translation ot its specific combinations, but uses the same concept: several predefined arithmetic combinations to get different levels of blending, addition and modulation between layers and/or sprites. In tilengine you can also provide your custom-defined mapping table in case you want to implement some specific mode.

Tilengine blending modes
I have a question on animation. I'm trying to make my character have an idle and walking animations but the samples don't show much of having more than 1 animation.

I tried doing something akin to the Simon.c sample but it ended up with the character walk animation being limited to the first frame :/

Declaration
[Image: unknown.png]

"Movement"/anim code
[Image: unknown.png]

Only first frame of walk when moving
[Image: unknown.png]

Character txt file
[Image: unknown.png]
Overall seems right. I assume that your load_sheet() function loads the spriteset correctly. But we know, when something doesn't work, the cause can be subtle and from unexpected source.

Please share a zipfile with the whole working project (sources and assets) so I can run it and pinpoint why youre not getting the expected result.
Here it is! Be warned you may need to adjust a few things if you're not using a Linux system.
Solved,

You restart the animation each frame the character is moving, that's why you don't see animation at all. Instead you must only enable/disable the animation on state transition -when the character starts or stops walking. Here I use a bool variable called walking used to track state changes, and update accordingly:

Code:
bool walking = false;
while (TLN_ProcessWindow()) {
    float fx = 0;
    float fy = 0;

    if (TLN_GetInput(INPUT_RIGHT))
        fx = 1.0f;
    if (TLN_GetInput(INPUT_LEFT))
        fx = -1.0f;
    if (TLN_GetInput(INPUT_DOWN))
        fy = 1.0f;
    if (TLN_GetInput(INPUT_UP))
        fy = -1.0f;

    if (!walking && (fx != 0 || fy != 0))  {
        TLN_SetSpriteAnimation(0, 0, beeb_walk, 0);
        walking = true;
    }
    else if (walking && (fx == 0 && fy == 0))  {
        TLN_DisableAnimation(0);
        TLN_SetSpritePicture(0, 0);
        walking = false;
    }

    layer_x += fx;
    layer_y += fy;
    TLN_SetLayerPosition(0, layer_x, layer_y);
    TLN_DrawFrame(frame++);
}
Thank you so much! Biggrin
EDIT: Maybe I should make a state machine or use coroutines! It would be annoying having to keep track of these variables.
EDIT2: I added more animations to the game but when I switch from a key to another the direction does not seem to affect things Sad Only when I let go for a split second to a new key the animation correspondent to the direction. You know why this happens?

[Image: unknown.png]
Welcome! Glad to help :-)

Traditional approach is to encapsulate state variables inside a game entity or actor, an abstraction of everything that exists inside a game.

I don't know what's going wrong with multiple animations, but I suspect that you only check the walk state variable, whereas now you should check that when dir changes state, you must update animation too. If not, direction change is ignored until walk transitions to another state.