Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Morgana retro Dungeon Crawler (uses Tilengine)
#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


Messages In This Thread
WOW!!! - by PerspexSphinx - 11-19-2019, 07:39 AM
Morgana game (uses Tilengine) - by JaumeAlcazo - 01-02-2020, 04:23 AM
RE: Morgana retro Dungeon Crawler (uses Tilengine) - by JaumeAlcazo - 10-08-2021, 06:07 AM

Forum Jump:


Users browsing this thread: 4 Guest(s)