6 Home
Spencer Conlon edited this page 2025-01-02 18:35:22 +00:00

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.


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 to KeyCode.Z: Letters A to Z
  • KeyCode.D0 to KeyCode.D9: Digits 0 to 9

Punctuation and Special Characters

  • KeyCode.Space: Spacebar
  • KeyCode.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 to KeyCode.F25: Function keys F1 through F25

Arrow Keys

  • KeyCode.Up: Up Arrow
  • KeyCode.Down: Down Arrow
  • KeyCode.Left: Left Arrow
  • KeyCode.Right: Right Arrow

Navigation Keys

  • KeyCode.Home: Home
  • KeyCode.End: End
  • KeyCode.PageUp: Page Up
  • KeyCode.PageDown: Page Down

System Keys

  • KeyCode.Escape: Escape
  • KeyCode.Enter: Enter
  • KeyCode.Tab: Tab
  • KeyCode.Backspace: Backspace
  • KeyCode.Insert: Insert
  • KeyCode.Delete: Delete

Modifier Keys

  • KeyCode.LeftShift, KeyCode.RightShift: Left and Right Shift
  • KeyCode.LeftControl, KeyCode.RightControl: Left and Right Control
  • KeyCode.LeftAlt, KeyCode.RightAlt: Left and Right Alt
  • KeyCode.LeftSuper, KeyCode.RightSuper: Left and Right Super (e.g., Windows key)
  • KeyCode.Menu: Menu Key

Keypad Keys

  • KeyCode.KP0 to KeyCode.KP9: Keypad numbers 0 to 9
  • KeyCode.KPDecimal: Decimal point on the keypad
  • KeyCode.KPDivide: Divide on the keypad
  • KeyCode.KPMultiply: Multiply on the keypad
  • KeyCode.KPSubtract: Subtract on the keypad
  • KeyCode.KPAdd: Add on the keypad
  • KeyCode.KPEnter: Enter on the keypad
  • KeyCode.KPEqual: Equal on the keypad

Lock Keys

  • KeyCode.CapsLock: Caps Lock
  • KeyCode.NumLock: Num Lock
  • KeyCode.ScrollLock: Scroll Lock

Miscellaneous Keys

  • KeyCode.PrintScreen: Print Screen
  • KeyCode.Pause: Pause
  • KeyCode.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 the KeyCode 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

  1. Place math.lua in your project directory.
  2. 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

  1. Fork the repository.
  2. Create a new branch for your feature: git checkout -b feature-name.
  3. Commit your changes: git commit -m "Add feature".
  4. Push to the branch: git push origin feature-name.
  5. Open a pull request.

License

This library is released under the MIT License. See the LICENSE file for more details.