Skip to content
msx80 edited this page Sep 5, 2024 · 6 revisions

Wiki is currently outdated, will update soon :)

Welcome to the Omicron wiki!

Prerequisites

You need an environment with at least a JDK 8+, possibly and IDE. Here's a detailed, step by step guide to setup Eclipse to run Omicron projects.

Project setup

Omicron is built as a multi module maven project. The following modules are included:

TODO list and describe

Getting started

First you have to build the Omicron Player, you can do this by going into the omicron-player directory and giving the command:

mvn clean package

This will create an omicron.jar file under omicron-assembly\target. This is the cartridge player, you can run it and open .omicron cartridge files.

Now you can build a cart, go to the demo/FeatureDemo directory and enter:

mvn clean install

A cartridge named feature-demo.omicron will be created!

Now run the player and load the cartridge from it, or just run it from the command line, like:

java -jar omicron.jar yourpath/demo/FeatureDemo/feature-demo.omicron

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>your.awesome.game</groupId>
  <artifactId>awesome-game</artifactId>
  <version>1.0.0</version>
  <dependencies>
    <dependency>
      <groupId>org.github.msx80.omicron</groupId>
      <artifactId>omicron-api</artifactId>
      <version>0.0.1</version>
    </dependency>
  </dependencies>
</project>

Then you create a class that implements the interface org.github.msx80.omicron.api.Game, like this one:

package your.awesome.game;

import org.github.msx80.omicron.api.Game;
import org.github.msx80.omicron.api.Sys;
import org.github.msx80.omicron.api.SysConfig;
import org.github.msx80.omicron.api.SysConfig.VirtualScreenMode;
import org.github.msx80.omicron.basicutils.Colors;

public class AwesomeGame implements Game {
	
  private Sys sys;
  public void init(final Sys sys) 
  {
    this.sys = sys;
  }

  public void render() 
  {
    sys.clear(Colors.RED);
  }
  
  public boolean update() 
  {
    return true;
  }

  public SysConfig sysConfig() 
  {
    return new SysConfig(240, 136, VirtualScreenMode.SCALED, "Hello World!", "helloworld");
  }
}

Run mvn clean install on this project and you should have your game ready!

Launching your game

That's it, you've made a working skeleton setup for Omicron. Now you have a "game", but a game can't run by itself becouse it needs a launcher, and an engine to run it. So let's create another very simple project, that depends on both your game and desktop:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>your.awesome.game</groupId>
  <artifactId>awesome-game-launcher</artifactId>
  <version>0.0.1</version>
  <dependencies>
    <dependency>
      <groupId>your.awesome.game</groupId>
      <artifactId>awesome-game</artifactId>
      <version>2.0.0</version>
    </dependency>
    <dependency>
      <groupId>org.github.msx80.omicron</groupId>
      <artifactId>desktop</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    </dependency>
  </dependencies>
<build>  
<plugins>
 <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>your.awesome.game.AwesomeGameLauncher</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
</plugins>      
</build>  
</project>

And a class to run:

package your.awesome.game;

import org.github.msx80.omicron.DesktopLauncher;

public class AwesomeGameLauncher {
	
	public static void main(String[] args)
	{
		DesktopLauncher.launch(new AwesomeGame(), false);
	}
}

With this the launcher is ready! Now just run: mvn clean install assembly:single and you should have a nice, runnable jar with your game!

Run it with the following command:

java -jar target/awesome-game-launcher-0.0.1-jar-with-dependencies.jar

All game are released as a single jar, your assets will all be included in it.

The API

(todo)

Clone this wiki locally