Greetings to all who have become interested in learning about my small project, which I do in my free time, about my long-playing project called “tengine”.
What is the purpose of this post? The answer is simple - I'm looking for odnodumtsev. I believe that there are still a lot of people who like a nice and kind old school. That's the whole mission - to write fun for the sake of something small, but quite functional, a platform for "console" toys in the style of 8/16 bits.
tengine DEMO game (web version) control: arrow keys, ctrl. Full ending.
')
The main feature that distinguishes tengine from hundreds of similar crafts is not quite a standard ideology:
- The architecture of the project focuses on minimizing the use of dynamic memory. If memory is allocated, it is allocated exclusively on the initialization of subsystems.
- you need to use dynamic memory as if there is no operating system, constantly remember about fragmentation. Memory deletion occurs in the strictly inverse order of creation (this is followed by a simple mechanism to control the removal of pointers)
- use of third-party libraries is minimized and should be reasoned, often a potential source of memory fragmentation
- the game scene is a ready-to-use memory generated by the level editor.
- work with objects of the game scene is carried out exclusively through identifiers, it is impossible to create an object dynamically
- use fixed point instead of float
- multiplatform
- official language of the project is C
Initially, I wrote all this under nintendo ds, my favorite gaming platform. But times are changing and I had to move everything to the more popular world of technology. So there was a branch for android, which later became the main one. The win32 version plays a more debugging role. As planned, the game is written and debugged on win32, and then compiled to other platforms (all this is conditional, of course, on win32 all the functionality works fully). With the advent of one very good enthusiast, the project also gained the NIX platform, for which he thanks a lot. Although nintendo ds is no longer supported, I deliberately did not remove the platform code under the preprocessor key from the project. There are also some nintendo-specific architectural features that remain, such as support for multiple screens and logical rendering layers. All this is described in poor, but all the same documentation.
Now tengine is:
- ready multiplatform functionality for android ndk, ios, win32, nix, kolibriOS, Emscripten (there was also functionality for nitro-sdk (nintendo ds), but I decided not to continue the development of this branch due to lack of time, the likelihood that someone now interesting nitro is very small)
- browser version of js / html based on Emscripten (https://github.com/kripken/emscripten/wiki), good performance even on ie11
- memory usage according to the frame allocator principle (deleting memory in a strictly reverse order of creation)
- architectural limitation of creating dynamic objects, which made it possible to abandon the use of scripting languages
- use openGL es 1.x / 2.0 as well as a custom blitter for rendering
- use openAL (openSL es for android NDK) for sound
- support multitouch, dpad, keyboard
- pthread-based multithreading support (streaming animation, file handling, sound)
- functionality to work with the network at the initial stage
- (primitive) particle system
- graphics resource converter (r5g5b5a1 main and r8g8b8a8 auxiliary)
- simple interface for working with game objects: positions, properties, states
- events (end of animation, achievement of node, etc.)
- support for applying basic affine transformations for game object animation frames
- the possibility of pixel-by-pixel checking of the boundaries of a game object of complex shape
- tile card support
- translucency support
- support mixing image data with specified color
- support of logic of traveling nodes (on which objects can move)
- (partially implemented) system of collision-lines, with the help of which it is possible to set boundaries or places of “cross-country ability” at an arbitrary angle
- emulator for win32 / nix, simplifies application development and debugging
- basic documentation
In addition to all this, there is the gui subsystem, which is a superstructure over tengine. The basic idea: all the gui elements are normal game objects, which upon initialization acquire the already pre-installed gui elements such as, for example, the “button”. It is enough to register any game object in a gui container and specify what behavior is expected of it. The rest of the add-on takes over.
The level editor (me3) is a utility for creating “levels” for tengine and includes:
- graphic resources subsystem
- subsystem for creating complex frame-by-frame animation, including collision zones, user events, attachment points (for dynamically attaching other game objects, for example, a weapon to a hand)
- background tile map subsystem
- Triggers subsystem, with which you can change the properties of objects under certain conditions
- track node subsystem
- Collage-line creation subsystem
- subsystem of creating logical states of objects, setting them on animation
- subsystem to create properties of objects and work with them
- object manager
- debugging the finished map, tracking triggers, user events
- support for fonts, text fields (text objects), internal text editor
- support for localization of texts in different languages
- creation of ready binary data files for tengine, export to xml
To deal with the editor a bit difficult at first, I wrote it specifically for my friend game designer. But there are examples in the samples folder as well as the interface in Russian, which, as for me, is quite intuitive. The documentation, unfortunately, has not yet mastered writing.
Who is still interested, everything is available at
https://bitbucket.org/pascualle/tengineAs a bonus, not so long ago, I sported the
verlet library described in the post
habrahabr.ru/post/178135 . While it is a little apart, but already tested for performance (see an example in samples / spider)
Read also a small tutorial (attention, it is without pictures!) "Creating a small game using tengine"
habrahabr.ru/post/180443