A downloadable Engine


Infinit Engine Documentation

Overview

Infinit Engine is a lightweight, Python-based game engine built on top of Pygame and Tkinter. It enables developers to create games and applications with features like code execution, asset importing, background customization, and compiling Python scripts into standalone executables.

Core Components

Initialization

  • Pygame Initialization: Initializes the game engine and sets up the display with a resolution of 800x600 pixels.
    python
    Copy code
    Infinity2D.init() screen = Infinity2D.display.set_mode((800, 600)) Infinity2D.display.set_caption("Infinity Engine") 
    
  • Background Color: Default background color is set to white (255, 255, 255).
  • Clock: A Pygame clock is used for controlling the frame rate.
    python
    Copy code
    clock = Infinity2D.time.Clock() 
    

Ursia Integration

Ursia is an optional module for advanced functionality. If installed, it is initialized, and its features can be accessed.

  • Initialization:
    python
    Copy code
    def initialize_ursia():     if ursia:         ursia.init() 
    
  • Example Feature: A predefined action can be triggered using Ursia:
    python
    Copy code
    def use_ursia_feature():     ursia.perform_action("example_action") 
    

Code Editor

The engine includes an integrated Tkinter-based code editor.

  • Features:
    • Write, edit, and execute Python scripts.
    • Save scripts to files.
    • Import image assets for use in games.
    • Change background color using a color picker.
    • Compile scripts into standalone executables.
  • Initialization:
    python
    Copy code
    def start_code_editor():     root = tk.Tk()     root.title("InfinityEngine")     root.geometry("1200x800") 
    

Functionality

1. Code Execution

Execute Python code directly from the editor.

python
Copy code
def run_code():     threading.Thread(target=execute_code, daemon=True).start() 

2. Saving Code

Save editor content to a .py file.

python
Copy code
def save_code():     file_path = filedialog.asksaveasfilename(defaultextension=".py") 

3. Importing Assets

Import image files and load them into the engine.

python
Copy code
def import_asset():     imported_image = Infinity2D.image.load(file_path) 

4. Background Color Customization

Change the editor background color with a color picker.

python
Copy code
def open_color_settings():     background_color = tuple(int(value) for value in color_code) 

5. Compiling Code

Compile scripts into standalone .exe files using PyInstaller.

python
Copy code
def compile_to_exe():     compile_command = f"pyinstaller --onefile ..." 

Editor Buttons

  • Copy & Paste: Edit text in the editor.
  • Run Code: Execute Python scripts.
  • Save Code: Save scripts to .py files.
  • Import Asset: Add images to the project.
  • Settings: Change the background color.
  • Compile to EXE: Compile Python scripts to executables.
  • Use Ursia: Trigger Ursia-specific actions.

Usage Instructions

  1. Run the Engine:
    bash
    Copy code
    python your_engine_file.py 
    
  2. Write Code:
    • Open the editor window.
    • Write or paste your Python code.
  3. Save and Compile:
    • Save the script.
    • Compile to an executable if needed.
  4. Advanced Features:
    • Import assets for game projects.
    • Utilize Ursia module if installed.

Dependencies

  • Python 3.x
  • Pygame (pip install pygame)
  • Tkinter (bundled with Python)
  • PyInstaller (pip install pyinstaller)
  • Optional: Ursia (install if required)

Development log