Skip to content
DominicDolan edited this page Sep 28, 2020 · 10 revisions

Welcome to Mechanica!

This project is a 2D game engine with all the niceness and safety of Kotlin !

Features

The 3 major features that this game engine comprises are:

  • The Drawer, to make it quick, easy and very readable to draw something to the screen
  • Scenes and Processes, two types of classes that allow, if used properly, can keep your game's code base clean and efficient
  • Custom Shaders, a nice and neat way of writing your own custom shaders that automatically does 'shader plumbing' for you

Additionally there are other minor features that can take some of the hassle out of game development:

  • Persistence, Use variables like normal except they can be set to persist between sessions
  • Resource Management, manage resources without needing to worry about the various different scenarios that might break your IO
  • Input, that allows you to create custom input controls
  • Animations, that allow you to do either a frame by frame animation or to simply animate a value in a very customizable way

Future Feature:

  • A UI System that allows for a very intuitive way of writing UI, check out samples in the mechanica-ui module of the source code

Setting up the project with Gradle

Clone or download the repository and build with gradle

Create a new Project with gradle. In the settings.gradle file add:

includeBuild("C:/path/to/mechanica")

And in the build.gradle file add a dependency on the project:

dependencies {
    implementation("com.mechanica.engine:mechanica:1.0")
}

In the new project create a main method with something similar to the following:

fun main() {
    Game.configure {
        setViewport(height = 10.0)
    }

    // Create an instance of the Drawer class,
    // it can be used to draw anything from rounded rectangles to custom shaders
    val draw = Drawer.create()

    // Start the game loop and draw text to the screen
    Game.loop {
        draw.centered.grey.text("Hello, Mechanica")
    }
}

More samples can be seen in the samples module in Mechanica