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


Messages In This Thread
RE: First video of Morgana game (uses Tilengine) - by megamarc - 03-22-2019, 08:10 PM
WOW!!! - by PerspexSphinx - 11-19-2019, 07:39 AM
Morgana game (uses Tilengine) - by JaumeAlcazo - 01-02-2020, 04:23 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)