Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Morgana retro Dungeon Crawler (uses Tilengine)
#41
Hi Jaume!

How are you doing with Morgana? Just a few days ago I was showing your game to a friend that is a professional game developer, he was impressed by the audiovisual presentation and the gameplay mechanics already implemented and working. But we were curious about the lack of recent updates, and the facebook page having gone away. We hoped the project wasn't abandoned, it would be a pity!

So I'm glad to know you're still there working on it Cool

You moved away from C to C++. Haven't you considered using C# or Python? They're more suitable application languages for high level development. I'm the maintainer of both bindings, the C# one is a bit outdated, I could update it quickly and I won't abandon them as they're my preferred application languages. Python one is up to date.

I see your problem was unreleasing sprites after use. I've never tried so much sprites, you're pushing the engine right? There's no memory leak because the sprites are allocated at init, activating them doesn't consume memory, just CPU usage. Actual 2D chipsets in consoles and arcade boards didn't have so much hardware sprites, a good recycle strategy is mandatory, releasing sprites as soon as they aren't used.

Your suggestion about having a function to query number of actual sprites in use is interesting, I take notice for a future update.

Hope to have more frequent updates about your great work!
Reply
#42
Hello! Sorry for the late response.

(10-05-2021, 02:20 AM)megamarc Wrote: How are you doing with Morgana? Just a few days ago I was showing your game to a friend that is a professional game developer, he was impressed by the audiovisual presentation and the gameplay mechanics already implemented and working. But we were curious about the lack of recent updates, and the facebook page having gone away. We hoped the project wasn't abandoned, it would be a pity!

So I'm glad to know you're still there working on it Cool

I had some periods of inactivity and worked on and off on the project, but since this last august I'm working in a more consistent manner.

It is definitely not abandoned Smile But the progress is slow due to several factors, in no particular order:

- Scope of the project (a lot more ambitious than I thought previously).
- Me being a solo programmer/developer (I commission Mrmo Tarius as a freelancer).
- Rebooting the project from C modular to C++ OOP paradigm.
- Switching to TLN_GetAvailableSprite() instead of using fixed sprite id's.
- Covid impact both on me and Mrmo.
- Depression/lack of motivation periods.
- Full time job.
- 2 daughters, aged 1 and 6.
- Serbia government imposing strong restrictions to freelance workers (Mrmo is from Serbia) (https://twitter.com/mrmotarius?lang=ca)
- Managing money to buy/commission assets keeping a balance with the familiar finances.

I feel flattered by the impression it gave to your friend Smile things like this give strength to carry on.

There is a lot of work porting things from C modular to C++ OOP (Object Oriented Programming paradigm), as well from porting the old clunky system of fixed sprites id's that I did in the first place, instead of getting next available sprite. Now I (almost) always use getnextavailable sprite for each sprite drawn when drawing the scene and the clearing those (sprite disable) and drawing new scene.

This is the project of my life, and will carry on whatever it takes to make it happen. It doesn't matter if I need 5, 10, or 20 years. (I'm 39 currently). I'm committed to this.

(10-05-2021, 02:20 AM)megamarc Wrote: You moved away from C to C++. Haven't you considered using C# or Python? They're more suitable application languages for high level development. I'm the maintainer of both bindings, the C# one is a bit outdated, I could update it quickly and I won't abandon them as they're my preferred application languages. Python one is up to date.

No, I have no experience in Python and I'm not fond of interpreted languages/script languages (as I see it, from my ignorance). Regarding C# I (almost) had made nothing with it, too many years ago, and have concerns to it belonging to a private company (Micro$oft, if I'm not wrong).

I have a strong C++ background, studied in college, and read a lot of material, aside of all the books I have in C++. Since C++11 the language is shifting to a much more mature and modern language. The revisions C++13, C++17 and C++20 are important (each corresponding to a year 2011, 2013, 2017, 2020).

Besides I could not reboot development again shifting to a language to another, that definitely would burn me alive, so I'm sticking with C++ for this project.

Thank you for your suggestions, tough. I appreciate them.

(10-05-2021, 02:20 AM)megamarc Wrote: I see your problem was unreleasing sprites after use. I've never tried so much sprites, you're pushing the engine right? There's no memory leak because the sprites are allocated at init, activating them doesn't consume memory, just CPU usage. Actual 2D chipsets in consoles and arcade boards didn't have so much hardware sprites, a good recycle strategy is mandatory, releasing sprites as soon as they aren't used.

Yes, each time you draw a sprite you should make sure you disable it somewhere or this kind of leak/bleeding will ocurr, it was so simple as I forget 1 simple f**cking line: gui_covers.clear(); and this kept me debugging for hours and days worried about where was the leak (at first I tought it was a C++ raw pointer leak, not a Tilengine sprite leak)

Check out cleaning method from Viewport.cpp:

Code:
void Viewport::clean(){

    // Debug
    //cout<<"Cleaning viewport\n";

    if(screen->textbox){
        if(screen->textbox->animation_ended){ screen->textbox.reset(); }
    }

    // https://stackoverflow.com/questions/22709344/does-stdvectortclear-call-destructor-of-the-content
    // "So what your question should be: "Does std::vector<T*>::clear() call delete on its
    // elements?" and here the answer is: No, it does not call delete. You have to do it
    // manually like shown in your example code, or you can (and probably should) use objects
    // like std::string or smart pointers instead of raw pointers. Those do the memory
    // management for you, and their destructors (which get called, see above) call the delete
    // for you."

    // VERY IMPORTANT TO DO THIS HERE in order to clean the Tilengine sprites.
    //cout<<"cells_drawn size: "<<cells_drawn.size()<<"\n";
    for(unsigned int i=0;i<cells_drawn.size();i++){
        cells_drawn[i]->disable(); // NO DELETE HERE!!! DISABLE!
    }
    cells_drawn.clear();
    walls_and_floors.clear(); // The destructors of this sprites aren't
    // called, but since are pointed by shared_ptr's they go out of scope
    // immediately and destructors are called (you can see if you uncomment
    // debug comments in Sprite.cpp
    // Notice that cells_drawn shared_ptr's do not get out of scope since
    // they are STILL pointed by someone. From Level1.cpp or another level.
    // So contents of the Cells in the map are preserved.

    gui_covers.clear(); // VERY IMPORTANT!
}

// Destructor
Viewport::~Viewport(){
    clean();
}

(10-05-2021, 02:20 AM)megamarc Wrote: Your suggestion about having a function to query number of actual sprites in use is interesting, I take notice for a future update.

Thank you! It would be an ok addition, tough I realized that printing each frame the next available sprite (as you see in the video) has the equivalent effect, as lower sprite id's got taken quickly and it tends to scalate until sprite limit that you had initialized here, in my case 1000 sprites (I think that with the old static id for sprites I was initing Tilengine with 10.000 sprites or so, madness).

Now it goes like this:

Code:
#include "Engine.h"
#include "Tilengine.h"
#include "./screens/Screen.h"

// Constructor
Engine::Engine(){
     TLN_Init(Screen::width,Screen::height,10,1000,50);
     TLN_CreateWindow(nullptr,CWF_NEAREST);
     TLN_SetWindowTitle("Morgana");
     TLN_DisableCRTEffect(); // Disable CRT Effect
}

// Destructor
Engine::~Engine(){
     TLN_DeleteWindow();
     TLN_Deinit();
}

(10-05-2021, 02:20 AM)megamarc Wrote: Hope to have more frequent updates about your great work!

I hope it so, but I cannot make promises, I'm working on it (almost) everyday since august, aprox 4h daily, it's the daily goal and almost everyday I make it. I hope I had more time to extend it to 6h or even 8h, but that it's very hard (job and daughters, basically, but that will give me more free time as they grow, and I'm thinking to work half time job when wife works more consistently. I can ask for half time job anytime until my 1 year old daughter makes it to 6 years old, keeping 60% of the money, when she hits 6 it would be 50% of the money. Another option is 2/3 time job, keeping 80% of the money, until 6 years old. This is a very good deal. I think I should pick it soon. I hope to remember this).

Thank you very much for your kind words and your time Smile
I will keep working on summiting my particular Everest. Check out Everest movie please. Rob Hall & Scott Fischer give me strength to carry on with their constance, obstination, obsession, effort and focus.



Facebook page problems fixed:

I fixed the links, it had a blank space at the beginning of the first post before http so it was " http://..." and was broken. I fixed as well the link to the video switching from Facebook to Youtube since Facebook video link stopped to work.

I examined all the thread again and corrected the promo images.

Please check it out if it works from your end and report any non working link, thank you for checking that.

I want to link this other forum, where Morgana was discovered (I must write or update something there too), there you can see some hidden link old youtube videos: https://rpgcodex.net/forums/threads/morg...er.126753/

I hope to post something cool soon, but right now there's a lot of job to be done before that.

Ah, thank you for the latest Tilengine update! I got notified on itch.io and updated to it.

I hope they update Code::blocks soon as I'm willing to use the CLANG static code analyzer. CppCheck is cool, but that would be cooler.

Do you have some experience with Valgrind? It's only usable with Codeblocks if you are in Linux:

[Image: codeblocks-plugins.png]

Best regards
Reply
#43
Hi, and what a long post!

You don't have to justify the pace of work on your project. I understand that it is a personal initiative that must find space between job, family, emotional state and other things. I maintain Tilengine as a personal project in my free time too, so I understand the situation. But I see you're putting your heart into it, cheer up and I hope you can push it until the end whatever the time it takes! It looks polished and promising, really. That friend of mine quiclky recognised influences from A500 Elvira game and Lovecraft theme. I'm glad to tell him you're still working on it.

Regarding language selection, often the best tool to do something is the one you're more expert at. I'm good at C, but not at C++, especially to the newer iterations. I understand that you choose it having such strong background, and historycally it has been used a lot in videogame development. I wouldn't consider "ignorance" not being fond of interpreted languages. I'm a systems C developer at heart, however in recent years I've started adopting managed languages for more application-oriented tasks. But at work I developed a web application with users, sessions, database, front-end templating, IoT integration... in plain C! Just to say.

I'd like you don't get stuck with development. Sometimes there are bugs in Tilengine too. If you find something that doesn't work as expected, let me know, as for me is easy to release builds with enhanced tracing and debugging information. Even if the cause is outside Tilengine -as in this case-, those extra traces can help to pinpoint the source. So plase ask for advice when you find something strange.

I don't have a facebook account so I can't check the link, but at least it asks me to login now so I guess it's working again -it complained that it couldn't find thre resource before-.

For static analysis I use built-in Visual Studio 2017 analysis, and cppcheck. Each one gives different results so I regularly check with both. I haven't used clang one. I used Valgrind once some time ago for a linux build that was leaking memory, so I have little experience with it. What I remember is that it generated a sluggish slow build but helped find the leak at runtime. It's quite low-level tool.

I haven't seen Everest but I'll check, thanks for the recommendation :-)

Keep the good work, go at your own pace without compromising your personal life, and let me know any progress or help you may need!
Reply
#44
Hi again megamarc and everyone, I'm happy to report finally some progress  Biggrin



I made the Swords Tarot Wall as a placeholder but I'm liking it so much that I would like to keep it, what do you think on this?
I made the Tarot Wall itself from here: https://theteaguns.itch.io/flat-shaded-low-poly-swords
The Tarot Slot FX is a modified pixel effect bought from here: https://henrysoftware.itch.io/pixel-effects
Some more credits inside the youtube hidden link. The upscailing and detailing of the Tarot Cards is made by me from this source: https://pixeljoint.com/forum/forum_posts.asp?TID=26827. But of course Mrmo Tarius is the main artist. Check the detailed credits inside the youtube hidden link video description.

Quote:You don't have to justify the pace of work on your project. I understand that it is a personal initiative that must find space between job, family, emotional state and other things. I maintain Tilengine as a personal project in my free time too, so I understand the situation. But I see you're putting your heart into it, cheer up and I hope you can push it until the end whatever the time it takes! It looks polished and promising, really. That friend of mine quiclky recognised influences from A500 Elvira game and Lovecraft theme. I'm glad to tell him you're still working on it.

Thank you very much megamarc  Wink I'm glad you understand the situation.

Quote:Regarding language selection, often the best tool to do something is the one you're more expert at. I'm good at C, but not at C++, especially to the newer iterations. I understand that you choose it having such strong background, and historycally it has been used a lot in videogame development.

I'm feel a bit embarrassed now about citing "strong background" haha I regret this compared with Scott Meyers Effective C++ and his Effective C++, I'm a speck of dust to his side! I felt like reading chinese when reading his book... (https://www.aristeia.com/ https://www.amazon.es/Effective-Specific...0321334876)

[Image: a.jpg]

He even has an option dedicated to him and his book on G++!!!

[Image: esborrar-till.png]

Quote:I'd like you don't get stuck with development. Sometimes there are bugs in Tilengine too. If you find something that doesn't work as expected, let me know, as for me is easy to release builds with enhanced tracing and debugging information. Even if the cause is outside Tilengine -as in this case-, those extra traces can help to pinpoint the source. So plase ask for advice when you find something strange.

Thanks, I have a feature request for Tilengine that would help me greatly. Context: You know that with C++ I switched to TLN_GetAvailableSprite() for getting sprite id's on the fly instead of having fixed sprite id's with C modular version of the project, thanks to your advice.

Well, I suggest adding TLN_GetLastAvailableSprite() and TLN_GetNextAvailableSprite(int sprite) and TLN_GetPreviousAvailableSprite(int sprite).

When dropping an item on to the floor I used to redraw the entire viewport. This works well, but when dropping items next to a Tarot Wall it resets the Tarot Wall animation, causing a minor annoyance.

I tried to draw_with_priority:

Code:
void Sprite::draw(){
    this->get_id(); // VERY IMPORTANT!!!
}

void Sprite::draw_with_priority(){
    this->get_id(); // VERY IMPORTANT!!!

    // Draw over everything else:
    TLN_EnableSpriteFlag(sprite,FLAG_PRIORITY,true);
}

But the Sprite keeps getting a lower sprite id (5) and it's hidden beneath other elements, despite the FLAG_PRIORITY. It would be better to get a high id.

The first method would check the last declared sprite in the engine, for instance:

Code:
TLN_Init(Screen::width,Screen::height,10,1000,50);

Last available sprite is 1000, or 999 (I don't know how you implemented it) and then return that value. 

I still use fixed sprite for mouse, I use sprite 999:

Code:
class Mouse{

    public:

    // Fields
    TLN_Spriteset spriteset;
    int sprite=999; // DON'T TOUCH!
    int x=0;
    int y=0;
    bool mouse_up=false;
    bool mouse_down=false;
    shared_ptr<Item> item_on_mouse;
    shared_ptr<Tarot_Card> stored_tarot_card;
    ...

To draw over everything else always. And I as well double check it with FLAG_PRIORITY:

Code:
void Mouse::set_cursor(){
     TLN_SetLoadPath("./assets/gui");
     spriteset=TLN_LoadSpriteset("cursor");
     TLN_SetSpriteSet(sprite,spriteset);
     x=y=0;
     TLN_SetSpritePosition(sprite,x,y);
     SDL_ShowCursor(0);

     // Draw over everything else:
     TLN_EnableSpriteFlag(sprite,FLAG_PRIORITY,true);
}

I would like to GetPreviousAvailableSprite from (int mouse_sprite) (999) so it would return 998. Hmm... But I see the problem now, dropping another object would get 997 sprite id and would draw UNDER the first item Sad

So maybe I should give fresh dropped items fixed id's again from 900 to up, just for dropping. When player walks or rotates sprites would get normal sane id's again.

What do you think of this solution? Having dropped (almost all) fixed id's seems like a regression and a "chapuza" to me :p Please give me your opinion on this.


Quote:I don't have a facebook account so I can't check the link, but at least it asks me to login now so I guess it's working again -it complained that it couldn't find thre resource before-.

For static analysis I use built-in Visual Studio 2017 analysis, and cppcheck. Each one gives different results so I regularly check with both. I haven't used clang one. I used Valgrind once some time ago for a linux build that was leaking memory, so I have little experience with it. What I remember is that it generated a sluggish slow build but helped find the leak at runtime. It's quite low-level tool.

I haven't seen Everest but I'll check, thanks for the recommendation :-)

Keep the good work, go at your own pace without compromising your personal life, and let me know any progress or help you may need!

Thanks again megamarc. Check out the discussion on RPGCodex, there are some design concerns that have been made visible to me and the concerns about that dawned on me. I'm struggling thinking with the direction of the design concerns made public there.

It's impossible to please everyone, and I must think carefully what to do.

Combat in particular seems to be of particular interest of every RPG player. I'm not fond of it, but of course I'll will implement it as it is an expected feature by everyone.
Reply
#45
Another question, when looking at the paintings, do you think it would be nice to add a distorstion watery effect to the painting insides (not the frame) to reflect low sanity on Morgana?

It may be a nice touch. I remember the Wobble effect that charmed me so much and still haven't managed to implement well, and less in a OOP environment.

How would you do that to a single Sprite? Without layers. Similar to the Wobble effect. Do you want to check out Sprite.h and Sprite.cpp? I would like your opinion after seeing those files in particular. I sent them to your hotmail.

[Image: painting2.png]
Reply
#46
Hi!

Regarding the wobble effect, I'm glad you liked it :-) unfortunately it cannot be applied to a sprite, it only works on tiled layers, because it's a combination of two effects applied at once:
  • Per-line horizontal offseting, with a raster effect. This one can be applied to sprites
  • Per-tile vertical column offset. This one only exists in tile-based layers, as sprites don't have "columns"
So you can implement some horizontal distortion on sprites, but not the full "wobble" effect
Reply
#47
Another topic, the flipping card effect:

First, gameplay video looks cool! The "selected card FX" animated rainbow effect fom pixel effects is a sequence of frames, or a realtime palette animation? Tilengine allows you to create color cycle animations using just one frame and animating the palette, old-school (but very effective).

For the flipping effect of the big card, I guess you're using pre-drawn sprites for each frame. You can use sprite scaling with just one frame for the back, and another for the front. Using realtime scaling instead of pre-drawn frames will give you a much smoother animation, and the ability to use any front picture -not just a generic one that gets replaced at the end-. Using darkened palettes as animation goes helps to enhance the depth effect.

I can mockup a quick sample to show what I mean, if you want.
Reply
#48
Next topic, sprite index and drawing order:

Don't rely on sprite indexes to get them drawn in specific order, instead use "TLN_SetNextSprite()" to fit to your needs.

The implementation of TLN_GetAvailableSprite() is really simple, it just returns the sprite with lower id available. You don't have to choose it, and it doesn't get selected just by calling it. Think of it as just a "hint", a helper function that will return a free sprite whatever it is. There's no "available sprites list", so there aren't such things as "previous" or "next".

If you want sprite A (whatever index it has) to get drawn after sprite B -so A gets drawn on top of B-:

Code:
TLN_SetNextSprite(B, A);

On the contrary, if you want sprite A to get drawn before sprite B -so B gets drawn on top of A-, switch arguments:

Code:
TLN_SetNextSprite(A, B);
Reply
#49
I've done a mockup of the spinning card in realtime,

Here attached is the source file with the effect spinner.c

Here you can see the effect running in realtime inside the browser, thanks to the HTML5 support I've added to Tilengine and that I'll release soon:
http://www.tilengine.org/emcc/spinner.html

NOTE: you must use Chrome or Edge, because Firefox has problems with WebAssembly. I don't know about Safari because I don't have a Mac.

I've used your graphics to build the effect, hope you don't mind...


Attached Files
.c   spinner.c (Size: 2.25 KB / Downloads: 2)
Reply
#50
OMG! That looks so cool! Smile Thanks!

I'll read thoroughly and answer with more time. Just let you know that it looks very nice.

The fade in that I done (in violet and in color) looked nice as well, but I didn't know this 3d effect could be achieved.

Hmm..

Maybe I could use both, and let the user choose in Settings?

Thank you, I'll experiment with this. Of course I don't mind. We keep in touch, thanks, I'll answer properly in the future Smile
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)