Skip to content

jjohannes/javarcade

Repository files navigation

Welcome to the JavaRCAde!

This repository is...

🧩 an example for using the javaRCA.de recipe with different Java development tools.

👾 a concise game engine to develop arcade games in Java while learning about Java dependencies and modules.

The Recipe

Variations of the Example

There are multiple branches in this repository that may interest you. The modules and Java code are the same on all of them. Only the build tool setups differ depending on the choice of dependency notation. There are:

  • 🧩 main This is my favorite choice: use the module-info.java for dependency declaration and Gradle as build tool. (Gradle being the most performant and feature-rich build tool currently available for Java projects.)
  • 🥯 everything This is same as main but with the setup for Maven added. The Gradle setup is kept on the branch as the two definitions do not collide. You can use that branch with both build tools and compare.
  • 👵🏼 no-module-info This is old school Java: no module-info.java files and dependencies are declared directly in the build tools. Both Gradle and Maven setups can be inspected next to each other.

For more details on the structure of this Java project, and Java projects in general, please visit the gradle-project-setup-howto repository.

Building and Running the Game Engine and the Example Game

Compile and run with one command

./gradlew run

Build with Gradle and run with Java

# Compile code, run checks, run tests, assemble artifacts
./gradlew build

# find the install folder
cd apps/app-jamcatch/build/install/app-jamcatch

# Run as Module
java --module-path 'lib' --module de.javarca.engine
# Run on Classpath (old school)
java --class-path 'lib/*' de.javarca.engine.Engine

Build with Maven and run with Java

# Compile code, run checks, run tests, assemble artifacts
./mvnw clean verify

# find the install folder
cd apps/app-jamcatch/target/install/app-jamcatch

# Run as Module
java --module-path 'lib' --module de.javarca.engine
# Run on Classpath (old school)
java --class-path 'lib/*' de.javarca.engine.Engine

Other Build Setup Topics

If you follow the recipe based on this repository, you may have questions about certain other build configuration topics that are currently out of scope here. Please have a look at the issues and the gradle-project-setup-howto project for further guidance.

Modifying the Example Game or Developing Your Own

Note

️ The game engine is in an early state as it primarily acts as an example here. However, it is fully functional to the point it is and may evolve further.

The javarca-engine offers a number of service endpoints based on the javarca-model.

The example Game – Jamcatch 🫙 – uses this to plug the game implementation into the engine. It is split into three modules:

For convenience, there is an additional project app-jamcatch for composing the game. In the build.gradle.kts or pom.xml file of that project you finde the list of modules that make up the game that is used by Gradle or Maven to fill the install folder when building.

Some things you can try:

  • Remove entries from app-jamcatch/build.gradle.kts or app-jamcatch/pom.xml to dynamically change the composition of the game. For example, you can remove the assets and the game still works without graphics.
  • Modify code or assets in one of the three jamcatch- modules to modify the game.
  • You can add additional modules to the game folder with your own implementations and assets and replace modules in app-jamcatch. Or add another app- project to the apps folder. (Note: for Maven you need to register each additional module in the root pom.xml)

Inspiration

Certain aspects of PICO-8 were an inspiration for the game engine.

About

Example used in presentations about Modularization and Dependency Management in Java projects

Topics

Resources

License

Stars

4 stars

Watchers

1 watching

Forks

Contributors

Languages