Table of Contents
Home - Tesseract Engine Wiki
Welcome to the Tesseract Engine Wiki
Overview
Tesseract Engine is a 3D Game Engine designed for small to medium-sized games. It offers a Lua scripting interface, making it flexible and user-friendly for game developers. Written in C++, it features a simple, intuitive, and good-looking interface to streamline game development.
Key Features
- Lightweight and Efficient: Perfect for small to medium-sized games.
- Lua Scripting Interface: Simplify game logic with a powerful and flexible scripting system.
- Cross-Platform Support: Build games for various platforms with ease.
- Dynamic Texture Support: Automatic texture and model loading for streamlined asset management.
- OBJ File Support: Seamless handling of common 3D model formats.
Navigation
Recent Updates
Version 0.0.68
- Added Script Component
- Introduced Lua Editor (W.I.P)
- Lua Binding Functions:
Engine.GetGameObjectByTag()
Component::GetComponent()
Engine.Log()
Transform:SetPosition(vec3)
Transform:SetRotation(vec3)
Version 0.0.50
- Texture preview and automatic texture/model loading.
Version 0.0.45
- OBJ file support.
Version 0.0.37
- Dynamic texture support.
Repository Links
- Clone URL: https://dock-it.dev/Bit-By-Byte/Tesseract-Engine.git
- Issues: Track Issues
- Releases: Latest Releases
Get Involved
Reporting Issues
- Navigate to the Issues tab to report bugs or suggest new features.
Pull Requests
- Create a branch, make your changes, and submit a PR under the Pull Requests section.
Community Discussions
- Explore ideas and get feedback in the Activity section.
Lua Api
Engine Function
How to use Engine?
First, you must import it to allocate memory in the engine for your Lua script.
local Engine = require("engine")
Simple Functions
Function | Description | Example Usage |
---|---|---|
ScriptName |
Returns the name of the currently running file. | Engine.ScriptName() → main.lua |
Log |
Logs a string to the Engines Log Window, With a color | Engine.Log("Hello, World!", {1,1,1,1}) |
GetGameObjectByTag |
Returns the Object by the Tag Given. | Engine.GetGameObjectByTag("Player") → GameObject |
KeyCode
The KeyCode
defines constants for all the keys available in the system. These constants are mapped to their respective key codes, allowing a standardized way to handle keyboard input.
KeyCode Values
Here is a list of all the available key codes:
Alphanumeric Keys
KeyCode.A
toKeyCode.Z
: Letters A to ZKeyCode.D0
toKeyCode.D9
: Digits 0 to 9
Punctuation and Special Characters
KeyCode.Space
: SpacebarKeyCode.Apostrophe
: 'KeyCode.Comma
: ,KeyCode.Minus
: -KeyCode.Period
: .KeyCode.Slash
: /KeyCode.Semicolon
: ;KeyCode.Equal
: =KeyCode.LeftBracket
: [KeyCode.Backslash
: \KeyCode.RightBracket
: ]KeyCode.GraveAccent
: `
Function Keys
KeyCode.F1
toKeyCode.F25
: Function keys F1 through F25
Arrow Keys
KeyCode.Up
: Up ArrowKeyCode.Down
: Down ArrowKeyCode.Left
: Left ArrowKeyCode.Right
: Right Arrow
Navigation Keys
KeyCode.Home
: HomeKeyCode.End
: EndKeyCode.PageUp
: Page UpKeyCode.PageDown
: Page Down
System Keys
KeyCode.Escape
: EscapeKeyCode.Enter
: EnterKeyCode.Tab
: TabKeyCode.Backspace
: BackspaceKeyCode.Insert
: InsertKeyCode.Delete
: Delete
Modifier Keys
KeyCode.LeftShift
,KeyCode.RightShift
: Left and Right ShiftKeyCode.LeftControl
,KeyCode.RightControl
: Left and Right ControlKeyCode.LeftAlt
,KeyCode.RightAlt
: Left and Right AltKeyCode.LeftSuper
,KeyCode.RightSuper
: Left and Right Super (e.g., Windows key)KeyCode.Menu
: Menu Key
Keypad Keys
KeyCode.KP0
toKeyCode.KP9
: Keypad numbers 0 to 9KeyCode.KPDecimal
: Decimal point on the keypadKeyCode.KPDivide
: Divide on the keypadKeyCode.KPMultiply
: Multiply on the keypadKeyCode.KPSubtract
: Subtract on the keypadKeyCode.KPAdd
: Add on the keypadKeyCode.KPEnter
: Enter on the keypadKeyCode.KPEqual
: Equal on the keypad
Lock Keys
KeyCode.CapsLock
: Caps LockKeyCode.NumLock
: Num LockKeyCode.ScrollLock
: Scroll Lock
Miscellaneous Keys
KeyCode.PrintScreen
: Print ScreenKeyCode.Pause
: PauseKeyCode.World1
,KeyCode.World2
: Additional international keys
Engine.KeyDown
Function
Description
The Engine.KeyDown
function checks if a specific key is currently pressed.
Syntax
Engine.KeyDown(keyCode)
Parameters
keyCode
: A value from theKeyCode
enumeration representing the key to check.
Returns
true
if the specified key is pressed.false
if the specified key is not pressed.
Example Usage
local KeyCode = require("./assets/scripts/keycode")
local Engine= require("./assets/scripts/engine")
function OnUpdate(dt)
-- Check if the "W" key is pressed
if Engine.KeyDown(KeyCode.W) then
print("W key is pressed")
end
-- Check if the Space key is pressed
if Engine.KeyDown(KeyCode.Space) then
print("Space key is pressed")
end
end
This function is ideal for handling real-time input, such as moving a character in a game or interacting with UI elements.
Math Library Wiki
Overview
The math.lua
library provides a collection of math constants, basic math functions, and trigonometric utilities to simplify common mathematical operations in Lua.
Features
Constants
The library includes commonly used mathematical constants:
Constant | Description | Value |
---|---|---|
PI |
Ratio of a circle's circumference to its diameter | 3.14159 |
E |
Base of the natural logarithm | 2.71828 |
TAU |
Full circle in radians (2 * PI) | 6.28318 |
Functions
Basic Math Functions
These functions are available under Math.functions
:
Function | Description | Example Usage |
---|---|---|
square(x) |
Returns the square of x . |
Math.functions.square(5) → 25 |
cube(x) |
Returns the cube of x . |
Math.functions.cube(3) → 27 |
max(a, b) |
Returns the maximum of a and b . |
Math.functions.max(10, 20) → 20 |
min(a, b) |
Returns the minimum of a and b . |
Math.functions.min(10, 20) → 10 |
clamp(value, minValue, maxValue) |
Clamps value between minValue and maxValue . |
Math.functions.clamp(15, 0, 10) → 10 |
Trigonometric Functions
These functions are available under Math.trig
:
Function | Description | Example Usage |
---|---|---|
deg_to_rad(degrees) |
Converts degrees to radians. | Math.trig.deg_to_rad(180) → 3.14159 |
rad_to_deg(radians) |
Converts radians to degrees. | Math.trig.rad_to_deg(Math.constants.PI) → 180 |
Installation
- Place
math.lua
in your project directory. - Import the module using
require
:
local Math = require("math")
Example Usage
Here is an example script using the math.lua
library:
local Math = require("math")
-- Access constants
print("PI:", Math.constants.PI)
print("E:", Math.constants.E)
-- Use basic math functions
local result = Math.functions.square(5)
print("Square of 5:", result)
local clampedValue = Math.functions.clamp(15, 0, 10)
print("Clamped value:", clampedValue)
-- Use trigonometric functions
local radians = Math.trig.deg_to_rad(180)
print("180 degrees in radians:", radians)
local degrees = Math.trig.rad_to_deg(Math.constants.PI)
print("PI radians in degrees:", degrees)
Contributing
- Fork the repository.
- Create a new branch for your feature:
git checkout -b feature-name
. - Commit your changes:
git commit -m "Add feature"
. - Push to the branch:
git push origin feature-name
. - Open a pull request.
License
This library is released under the MIT License. See the LICENSE file for more details.