Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
First video of Morgana game (uses Tilengine)
#1
Video 
Hello, the first video of Morgana Dungeon Crawler, which uses pure C and Tilengine, is published! Smile Check it out, please!

Thank you megamarc for the modifications on Tilengine you did for this game on my request, specially the mouse addition! Obviously without the mouse it would not be possible to navigate around in this game:





Facebook page of the game: https://www.facebook.com/morganadungeoncrawler/
Reply
#2
Great work Jaume, impressive! Congratulations! I'm glad to see that the modifications you suggested about the mouse support have been useful :-)

Could you share some insights about your Morgana project? Is it entirely built with tilengine, or do you use another framework and combine them? I'm really curious about it
Reply
#3
(03-17-2019, 07:09 AM)megamarc Wrote: Great work Jaume, impressive! Congratulations! I'm glad to see that the modifications you suggested about the mouse support have been useful :-)

Could you share some insights about your Morgana project? Is it entirely built with tilengine, or do you use another framework and combine them? I'm really curious about it

Thank you very much Smile

Well, it's programmed in pure C and Tilengine. I miss the Object Orientation from C++ but now it's too late to port it all to C++ so I would recommend to use C++ instead of C for all of you if you want to start a medium/big sized project.

I "emulate" the object orientation with structs (for the attributes of the objects) and .h files (for the functions of the objects), altough this is a primitive and rudimentary way to do it and defenitely it would be better to use C++, C#, or maybe even Object Oriented C.

The only another libraries that I use are some SDL complements, namely:

- SDL2 mixer for sound and FX.
- SDL2 ttf for text.
- SDL2 image, I don't remember what for, I think it's for the conversion of text to images for Tilengine to use.

My compiler is MinGW and the platform is Windows.

Another insight maybe would be the difficult managing/tracking of sprite ids in the engine. Now I'm doing it manually/semi-automatically but this has to be improved to avoid confusion and depleting of Sprite ids.

As you stated to me in private message the ids for the sprites refer to a maximum number of sprites inscreen at a given time, not the TOTAL number of sprites in your game. Keep in mind this if you are starting a new project with Tilengine. I will fix this with time, hopefully.

Thanks for your time reading/watching this.
Reply
#4
Thanks for sharing those insights about your game development!

I'm curious about how you integrated text rendering in SDL_ttf and tilengine. Maybe yoy create/modify spritesets in realtime? The engine allows it, but it's a somewhat advanced topic and there isn't any example available about this, you did a great job.

Regarding language selection, C doesn't provide object oriented, but it allows for good data encapsulation using incomplete types (opaque pointers) and crude hieracy can be implemented with structs sharing a common header for the "base class". Tilengine itself uses this technique, every loadable asset (tileset, tilemap, spriteset, palette, animation...) inherit from a common "Object" type with basic common functionality. However, to develop an object-oriented application, i'd skip C++ and use C#, because at's an application language with native suport for lists, memory safety, etc. C is a pure systems language, and C++ is lost in the middle ground: wants to be more than C, but falls short to be a modern language. But that's just my opinion, not a fact.

About sprite allocation, Tilengine is designed like a 2D graphics chip. In those chips, a sprite is a preallocated hardware entity, indexed by a number. Sprites cannot be created nor destroyed, they're fixed and can just be enabled/disabled and configured. On the other hand, a game doesn't manage sprites but entities, or actors. They're part of a dynamic list, they get created and destroyed as the gameplay runs and when they're alive, the're temporarily assigned one (or many) available hardware sprites. When they're destroyed, their sprites are disabled and get available for reuse. To facilitate this task, tilengine provides the TLN_GetAvailableSprite() function, that returns the number of first available (not used) sprite. When you call the TLN_ConfigSprite() function it's marked as used (not available), and when you call TLN_DisableSprite(), it's returned to the available list.
Reply
#5
Oops, sorry for the delay, I did not get notified by mail of the response in the thread Sad I think the mail sending is very delayed, as we talked some time ago.

Thanks for your comments Smile

About the text, I did some unsuccessful experiments with Cairo (https://www.cairographics.org/) before settling with SDL_ttf (https://www.libsdl.org/projects/SDL_ttf/).

Now, when a text is asked to be drawn (yes, in realtime) I draw it with SDL_ttf to a SDL_Surface, then I save the surface it to a .png with IMG_SavePNG (I think this is in SDL image), then write a .txt on the fly with the correct width and then read back from Tilengine with TLN_SetLoadPath, TLN_LoadSpriteset, TLN_ConfigSprite and TLN_SetSpritePosition. So, many things happen each time the player hovers over a item or object and the text is drawn in-screen.

I thought it might be too much to do in realtime, but it turns out that is very fast and with no noticeable delay Smile

Another point of interest are the ghosts. I tried to make them appear with the 25%, 50%, 75%, 100% opacity but the effect was not cool enough for this particular case (by the way I used this type of opacity with the text that pops up when you click something that makes you gain experience and lose sanity).

So I ended up doing the transparence I think with increments of 10% and combining the layers in Photoshop to a new flat image to be used in the animation. Of course this has the disadvantage that it must be done on every type of possible wall in your wallsets, for instance, when we go down in the dungeons I will do it again to make appear a different type of ghost (a big creepy mouth) there in the dungeons.
Reply
#6
Thanks for your explanations! I don't know why, but this forum platform delays email notifications for days -or even weeks-. I guess it's a combination of my ISP and the forum system...

I know the SDL ecosystem, I use it a lot in my work, good choice. Your approach about text is correct, maybe a bit long trip, but it works. There's a function to modify the pixels of an existing spriteset in realtime, without need to load a new one, but that function requires that the region inside the spriteset atlas is always the same, and that's not your case. Classic systems were limited to fixed-size sprites composed of tiles, and that restriction made easy to modify them. But the use of arbitrary-sized sprites inside a sprite atlas isn't very well suited to do modifications in realtime, although not impossible as you demonstrated.

Regarding transparency, I noticed how the text appears in discrete jumps, corresponding to defferent BLEND_MIXnn blending modes, and it looks cool! Smooth fading can be achieved with addition/multiply blending modes combined with a palette transition. This is how the SNES did those effects. As a personal opinion, I think that smooth blending doesn't fit well with pixel art graphics. Pixel art is about carefully selected and matched colors. Blending destroys this equilibrium, introducing intermediate colors that don't match the original palette.

If you still want to do fading, try this: create a palette that is pure black, clone the palette of the sprite you want to fade, and set blending BLEND_ADD mode with TLN_SetSpriteBlendMode(). For each frame of the fading, call TLN_MixPalettes() passing the black palette and the original sprite palette as sources, and the cloned palette as destination, with a factor going from 0 to 255. Assign the cloned palette to the sprite. When the fade effect ends and reachs factor 255, disable blending, assign the original palette again and delete the cloned palette.
Reply
#7
Photo 
We posted a promotional screenshot for the game! Smile

[Image: 66109589_894572100893667_376274079413016...e=5DA11C27]

Morgana facebook page: https://www.facebook.com/morganadungeoncrawler/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)