Skip to content

Latest commit

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Mhatxotic Engine

Contents…

  1. About
  2. Features
  3. Using
  4. Scripts
  5. Examples
  6. Credits
  7. Contributing

About…

Mhatxotic Engine attempts to be a safe, simple and fast cross-platform2-Dmultimediaengine written in C++20 for Visual C++, Clang and GNU C++ Compilers. This engine brings together many open-sourcelibraries into one easy-to-use environment controlled by the LUA interpreter. Right now the engine aims to operate on Windows XP and better (x86-64), MacOS (x86-64 plus Arm64) and Linux (Ubuntu and Mintx86-64).

Development is mainly focused by myself on the MacOS version using an M1 Ultra machine with the latest version operating system between 2020 to present. Infrequent development is on the Linux port with an old i7 Mid-2011 iMac and AMD Radeon 6970graphics running the latest Ubuntu and uses the Homebrewport of Wine to maintain the Windows version since 2020 and was the main development environment between 2006 and 2020 on various high-end gaming and workstations. The engine is also tested successfully on a very old DellXPS M1330 Laptop from 2007 with NVidia GeForce 8400GS graphics running the latest Mint.

↑ Top

Features…

  • Scaleable to the limits of your hardware and operating system.
  • Use of LUA interpreter with configurability and infinite-loop timeout.
  • Full and safe error reporting with extensive use of C++ exceptions.
  • Front-end choice of Unix NCurses, Win32 console or OpenGL 2-D interface.
  • Asynchronous image format loading (such as PNG, JPG, GIF and DDS).
  • Support for transparent frame buffer objects and window transparency.
  • Optional global 8-bit colour palette system for retro applications.
  • Asynchronous audio format loading (such as WAV, CAF and OGG).
  • Full support for Theora (OGV) video with basic keying using GLSL.
  • OpenAL audio with samples, streams and sources interfaces.
  • Asynchronous basic HTTP/HTTPS client and SSL socket functionality.
  • Optional encryption of your non-volatile data with cvars system.
  • Safe directory, memory and file manipulation functions.
  • SqLite database support optimised for speed.
  • (De)Compression supporting ZIP, LZMA, RAW and AES encryption.
  • Very fast JSon support via RapidJson.
  • Better optimised binaries from semi-amalgamated source code.
  • Less than half-a-second startup time to usable on a modern device.

↑ Top

Using…

All the engine needs to run is an app.json file in the directory, a non-solid 7-zip archive (ending in .adb not .7z) in the directory or a .7z archive appended to the engine executable. This JSON formatted text file contains a list of CVars that configure the engine the way you want. It has to be formatted as Windows, MacOS or Unix so it does not matter about the line ending format, but it does have to be UTF-8 (No BoM) formatted which is what all files, filenames and all strings are handled as in the engine. On Windows, Unicode filenames are automatically converted to and from UTF-8.

{
"Version": <version>,
"Constants": { <cvars> },
"Sets": [
{ <cvars> },
...
],
"ActiveSet": <set>,
}
  • <version> (required) = The app metadata version (currently 1).
  • <cvars> (required) = An object of variables to override in the engine. (example: "app_shortname": "MyApp"). You can omit the quotations for integers/floats.
  • Sets (optional) = Custom variable sets which contain array of <cvars> objects.
  • <set> (optional) = Use specified index in Sets.

You also need to set the app_cflags cvar properly in the app.json to specify which subsystems you want to enable. The default value is 0 which means the engine will only output only to your terminal standard output and will run forever until a SIGINT interrupt occurs or a Core.Quit() API call; and the resulting Core.OnEnd() callback has confirmed it. Otherwise the possible combination of flags you can specify are as follows…

FlagFront-endPurposeNamespaces
0x1YesEnable Win32 or NCurses Terminal.
0x2NoEnable OpenAL subsystem.Audio, Source, Sample and Stream.
0x4YesEnable OpenGL subsystem.Clip, Cursor, Display, Fbo, Font, Input, Palette and Texture.
0x8NoEnable frame limiter.

Combining certain flags unlocks additional namespaces…

FlagPurposeNamespaces
0x6 (0x2+0x4)Enable OpenAL and OpenGL subsystems.Video.

↑ Top

Scripts…

The engine looks for the specified file named via the lua_script variable which is main.lua by default, compiles it, caches it in the database for faster future access, executes it and waits for a termination request either via a console command, operating system or the script itself and will execute continuously based on the app_tickrate variable which is by default, every 1/60th of a second (16.6msec) and in OpenGL mode, will execute regardless of hardware limitations as an accumulator is used to skip rendering in an attempt to catchup.

Writable directory locations…

SystemLocation
WindowsC:\Users\<UserName>\AppData\Roaming\<AuthorName>\<AppShortName>
MacOS/Users/<UserName>/Library/Application Support/<AuthorName>/<AppShortName>
Linux/home/<UserName>/.local/<AuthorName>/<AppShortName>

The engine does not allow the use of .. (parent), the use of a / (root) directory nor X:/ (Windows drive) prefix for the accessing of any out of scope assets to maintain a sandbox-like safe environment. The only exception is the start-up database name sql_db and the working directory ast_basedir which can only be set on the command-line. In Windows, all backslashes (\) in pathnames are automatically replaced with forward-slashes (/) for cross-platform compatibility as MSVC's standard C library file and Windows API functions support unix forward-slashes natively.

See this automatically generated document for a complete rundown of all configuration variables and scripting functions. LUA core reference manual is here.

↑ Top

Examples…

A remake of the classic Amiga and DOS game Diggers was made with this engine and available to play.

This YouTube video is a preview of a private (quick and messy) script I made that dynamically builds a carousel which takes advantage of framebuffer-objects, True-type fonts, triangle rotations, dynamic texture coordinate manipulations, Vorbis audio and Theora video streams, and Lua's incredibly versatile ability to build event and animation systems.

↑ Top

Credits…

This engine makes use of the following open-source and commercially distributable components that are always updated to the latest versions...

LibraryAuthorPurpose
7-ZipIgor PavlovPowerful general data codec.
FreeType© The FreeType ProjectLoad and render TTFfonts.
GLFW© Marcus Geelnard & Camilla LöwyInterface to Window, OpenGL and input.
LibJPEGTurbo© IJG/Contributing authorsCodec/container for YCbCr still DV data.
LibNSGif© Richard Wilson & Sean FoxCodec/container for motion paletted RGB pixel data.
LibPNG© Contributing authorsCodec/container for RGB pixel data.
LUA (modded)© Lua.org, PUC-RioUser command interpreter.
NCurses© Free Software FoundationLinux and MacOStext mode support.
OggXiph.OrgContainer for Vorbis and Theora data.
OpenALSoftChris Robinson3-D audio API.
OpenSSLOpenSSL Software FoundationBasic SSL networking and (de/en)cryption.
RapidJson© THL A29 Ltd., Tencent co. & Milo YipStore and access JSON objects.
SimpleWebPMiku AuahDarkDecoder/container for YCbCr still DV and RGBA data.
SQLiteContributing authorsInterpreter to store and access user non-volatile data.
TheoraXiph.OrgCodec for YCbCr motion DV data.
VorbisXiph.OrgCodec for PCM audio data.
Z-Lib© Jean-loup Gailly & Mark AdlerCommon general data codec.

Contributing…

Thank you for your interest in contributing to the Mhatxotic Engine project. If you decide to contribute code in any way — whether that may be via issues, discussions, pull requests or any other medium then by doing so you accept that you give full and permanent permission for us to use and modify your code as we see fit. As gratitude, your (nick)name or organisation will be credited in the credits section and the credits 0 console command output inside all future executables.

↑ Top

Copyright © 2006-2026 Mhatxotic Design. All Rights Reserved.

About

Mhatxotic Engine attempts to be a safe, simple and fast cross-platform 2D multimedia engine written in C++20 for MSVC++, Clang and GNU C++ Compilers. It brings together many OSS libraries into one easy-to-use environment controlled by the LUA interpreter with the aim to operate on WinXP+ (x86-64), MacOS (x86-64/Arm64) and Linux (Debian x86-64).

Topics

Resources

Security policy

Stars

12 stars

Watchers

2 watching

Forks

Releases

Contributors

Languages