Skip to content

Mhat'S Engine attempts to be a safe, simple and fast cross-platform 2-D 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/x86-64), MacOS (x86-64/Arm64) and Linux (Ubuntu x86-64).

License

XMhat/MSEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MS-Engine

Contents…

  1. About
  2. Features
  3. Using
  4. Scripts
  5. Examples
  6. Credits
  7. Contributing
  8. License and disclaimer

About…

MS-Engine (Mhat'S Engine) attempts to be a safe, simple and fast cross-platform 2-D multimedia engine written in C++20 for Visual C++, Clang and GNU C++ Compilers. MS-Engine brings together many open-source libraries into one easy-to-use environment controlled by the LUA interpreter. Right now MS-Engine aims to operate on Windows XP and better (x86 plus x86-64), MacOS (x86-64 plus Arm64) and Linux (Ubuntu x86-64).

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, MP3 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.

Using…

All MS-Engine needs to run is an app.cfg 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 text file contains a list of CVars that configure the engine the way you want. It can 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.

You also need to set the app_cflags cvar properly in the app.cfg to specify which subsystems you want to enable. The default value is 0 which means show an error to say you did not set a front-end value. The possible combination of flags you can specify are as follows…

Flag Front-end Purpose Namespaces
0x1 Yes Enable Win32 or NCurses Terminal.
0x2 No Enable OpenAL subsystem. Audio, Source, Sample and Stream.
0x4 Yes Enable OpenGL subsystem. Clip, Cursor, Display, Fbo, Font, Input, Palette and Texture.

Combining certain flags unlocks additional namespaces…

Flag Purpose Namespaces
0x6 (0x2+0x4) Enable OpenAL and OpenGL subsystems. Video.

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…

System Location
Windows C:\Users\<UserName>\AppData\Roaming\<AuthorName>\<AppShortName>
MacOS /Users/<UserName>/Library/Application Support/<AuthorName>/<AppShortName>
Linux /home/<UserName>/.local/<AuthorName>/<AppShortName>

MS-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 app_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.

Examples…

A remake of the classic Amiga and DOS game Diggers was made with this engine and available to play. You can open up the executable (Win32 or Linux) or .adb archive (MacOS) with 7-Zip.

This YouTube video is a preview of a private (quick and messy) script I made that dynamically builds a fifteen minute video 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.

Credits…

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

Library Version Author Purpose
7-Zip 23 Igor Pavlov Powerful general data codec.
FreeType 2.13 © The FreeType Project Load and render TTF fonts.
GLFW 3.3 © Marcus Geelnard & Camilla Löwy Interface to Window, OpenGL and input.
LibJPEGTurbo 3.0 © IJG/Contributing authors Codec/container for YCbCr still DV data.
LibNSGif 1.0 © Richard Wilson & Sean Fox Codec/container for motion paletted RGB pixel data.
LibPNG 1.6 © Contributing authors Codec/container for RGB pixel data.
LUA (modded) 5.4 © Lua.org, PUC-Rio User command interpreter.
MiniMP3 1.0 Martin Fiedler Codec/Container for legacy PCM audio data.
NCurses 6.4 © Free Software Foundation Linux and MacOS text mode support.
Ogg 1.3 Xiph.Org Container for Vorbis and Theora data.
OpenALSoft 1.23 Chris Robinson 3-D audio API.
OpenSSL 3.3 OpenSSL Software Foundation Basic SSL networking and (de/en)cryption.
RapidJson 1.1 © THL A29 Ltd., Tencent co. & Milo Yip Store and access JSON objects.
SQLite 3.45 Contributing authors Interpreter to store and access user non-volatile data.
Theora 3.2 Xiph.Org Codec for YCbCr motion DV data.
Vorbis 1.3 Xiph.Org Codec for PCM audio data.
Z-Lib 1.3 © Jean-loup Gailly & Mark Adler Common general data codec.

Contributing…

Please read this document for information on how to contribute and the people who have helped contribute to the project.

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 6970 graphics running the latest Ubuntu and uses GcEnx's CrossOver port to maintain both Windows versions since 2020 and was the main development environment between 2006 and 2020 on various high-end gaming and workstations.

License and disclaimer…

Please read this document for the license and disclaimer for use of this software.

Copyright © 2006-2024 MS-Design. All Rights Reserved.

About

Mhat'S Engine attempts to be a safe, simple and fast cross-platform 2-D 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/x86-64), MacOS (x86-64/Arm64) and Linux (Ubuntu x86-64).

Topics

Resources

License

Security policy

Stars

Watchers

Forks