Small multi-platform 2d tengine engine (android / ios / win32 / nix / kolibrios / web (emscripten))
I welcome everyone who is 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 am looking for odnodumtsev. I believe that there are many more people who like the glorious and kind old school. This is the whole mission - to write pleasures 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 its not-so-standard ideology:
Initially, I wrote all this under nintendo ds, my favorite gaming platform. But times are changing and everything had to be moved 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 of course conditional, on win32 all the functionality works fully). With the advent of one very good enthusiast, the project also acquired the NIX platform, for which many thanks to him. Although nintendo ds is no longer supported, I intentionally did not remove the platform code under the preprocessor key from the project. There were also some nintendo-specific architectural features, such as support for multiple screens and logical rendering layers. All this is described in a meager,
Now tengine is:
In addition to all this, there is a gui subsystem, which is an add-on for tengine. The main idea: all gui elements are ordinary game objects, which, upon initialization, acquire the pre-installed functionality of gui elements such as, for example, a “button”. It is enough to register any game object in the gui container and indicate what behavior is expected from it. The add-on takes care of the rest.
The level editor (me3) is a utility for creating "levels" for tengine and includes:
Dealing with the editor is 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 an interface in Russian, which, as for me, is quite intuitive. The documentation, unfortunately, has not yet been mastered to write.
Anyone who is still interested, everything is available at https://bitbucket.org/pascualle/tengine
As a bonus, I recently cataloged the verlet library described in the post habrahabr.ru/post/178135 . While it stands a little apart, but has already been tested for performance (see the example in samples / spider)
Read also a small tutorial (note, it is without pictures!) "Creating a small game using tengine" habrahabr.ru/post/180443
What is the purpose of this post? The answer is simple - I am looking for odnodumtsev. I believe that there are many more people who like the glorious and kind old school. This is the whole mission - to write pleasures 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 its not-so-standard ideology:
- project architecture 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. Removing memory occurs in the strictly reverse order of creation (this is followed by a simple mechanism for controlling deleted pointers)
- the use of third-party libraries is minimized and needs to be argued, it is 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 dynamically create an object
- using fixed point instead of float
- multi-platform
- the official language of the project is C
Initially, I wrote all this under nintendo ds, my favorite gaming platform. But times are changing and everything had to be moved 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 of course conditional, on win32 all the functionality works fully). With the advent of one very good enthusiast, the project also acquired the NIX platform, for which many thanks to him. Although nintendo ds is no longer supported, I intentionally did not remove the platform code under the preprocessor key from the project. There were also some nintendo-specific architectural features, such as support for multiple screens and logical rendering layers. All this is described in a meager,
Now tengine is:
- ready-made multi-platform functionality for android ndk, ios, win32, nix, kolibriOS, Emscripten (there was still functionality for nitro-sdk (nintendo ds), but I decided not to continue developing this branch due to lack of time, it’s likely that someone is now interesting nitro is very small)
- browser-based js / html based on Emscripten (https://github.com/kripken/emscripten/wiki), good performance even on ie11
- memory usage based on the principle of frame allocator (deleting memory in the strictly reverse order to creation)
- architectural limitation of the creation of dynamic objects, which allowed to abandon the use of scripting languages
- using openGL es 1.x / 2.0 as well as a proprietary blitter for rendering
- using openAL (openSL es for android NDK) for sound
- support multi-touch, dpad, keyboard
- pthread-based multithreading support (streaming animation loading, file handling, sound)
- functionality for working with the network at the initial stage
- (primitive) system of particles
- graphic resource converter (r5g5b5a1 primary and r8g8b8a8 auxiliary)
- simple interface for working with game objects: positions, properties, states
- events (end of animation, achievement of a node, etc.)
- support for applying basic affine transformations for animation frames of game objects
- the ability to check pixel boundaries of a game object of complex shape
- tile card support
- translucent support
- support mixing image data with specified color
- support for the logic of path nodes (along which objects can move)
- (partially implemented) system of collision lines, with the help of which it is possible to set boundaries or places of “passability” at an arbitrary angle
- emulator for win32 / nix, simplifying application development and debugging
- basic documentation
In addition to all this, there is a gui subsystem, which is an add-on for tengine. The main idea: all gui elements are ordinary game objects, which, upon initialization, acquire the pre-installed functionality of gui elements such as, for example, a “button”. It is enough to register any game object in the gui container and indicate what behavior is expected from it. The add-on takes care of the rest.
The level editor (me3) is a utility for creating "levels" for tengine and includes:
- graphic resources subsystem
- a subsystem for creating complex frame-by-frame animation, including collision zones, user events, attachment points (for dynamically attaching other game objects, for example, weapons to the hand)
- subsystem to create a tile map of the background
- a subsystem of triggers with which you can change the properties of objects according to certain conditions
- subsystem of track nodes
- collision line creation subsystem
- subsystem for creating logical states of objects, tying them to animation
- a subsystem for creating properties of objects and working with them
- object manager
- debugging of the finished map, tracking the operation of triggers, user events
- support for fonts, text fields (text objects), internal text editor
- functional support for localization of texts in different languages
- creation of ready-made binary files with data for tengine, export to xml
Dealing with the editor is 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 an interface in Russian, which, as for me, is quite intuitive. The documentation, unfortunately, has not yet been mastered to write.
Anyone who is still interested, everything is available at https://bitbucket.org/pascualle/tengine
As a bonus, I recently cataloged the verlet library described in the post habrahabr.ru/post/178135 . While it stands a little apart, but has already been tested for performance (see the example in samples / spider)
Read also a small tutorial (note, it is without pictures!) "Creating a small game using tengine" habrahabr.ru/post/180443