stephengold / jme-vehicles

A tech demo and library for simulating vehicles in jMonkeyEngine
BSD 3-Clause "New" or "Revised" License
17 stars 7 forks source link
application java jme3 jmonkeyengine jmonkeyengine3 jvm-library library minie open-source pacejka simulation skid-mark vehicle

The More Advanced Vehicles Project demonstrates vehicle simulation using the jMonkeyEngine (JME) game engine and provides a library to support driving simulations.

It contains 5 subprojects:

  1. MavLibrary: the MaVehicles library
  2. MavDemo1: a demo application with a Lemur-based GUI
  3. MavDemo2: a demo application with a Nifty-based GUI
  4. HelloMav: a very simple application using the MaVehicles library
  5. MavCommon: examples of vehicles, worlds, skies, etcetera

Contents of this document

Important features

Jump to the table of contents

<img height="400" src="https://i.imgur.com/TsWukzO.png" alt="A silver sports car flies out of a pipe. There are driving controls in the foreground and a racetrack in the background.">

How to download and run the MavDemo1 application

  1. Install a 64-bit Java, if you don't already have one. (MavDemo1 no longer supports 32-bit Java.)
  2. Point the JAVA_HOME environment variable to your JDK installation: (In other words, set it to the path of a directory/folder containing a "bin" that contains a Java executable. That path might look something like "C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot" or "/usr/lib/jvm/java-17-openjdk-amd64/" or "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home" .)
    • using Bash or Zsh: export JAVA_HOME=" path to installation "
    • using Fish: set -g JAVA_HOME " path to installation "
    • using Windows Command Prompt: set JAVA_HOME=" path to installation "
    • using PowerShell: $env:JAVA_HOME = ' path to installation '
  3. Install the latest MavDemo1 release from GitHub:
  4. cd to the extracted "MavDemo1" directory/folder that contains "bin" and "lib".
  5. Run the Maud startup script:
    • using Bash or Fish or or Zsh: ./bin/MavDemo1
    • using Windows Command Prompt: ./bin/MavDemo1.bat
    • using PowerShell: .\bin\MavDemo1.bat

The demo runs in a 1280x720 window. After a brief loading animation, the Main Menu appears in the upper-left corner of the window.

Jump to the table of contents

How to build and run More Advanced Vehicles from source

  1. Install a 64-bit Java Development Kit (JDK), if you don't already have one.
  2. Point the JAVA_HOME environment variable to your JDK installation: (In other words, set it to the path of a directory/folder containing a "bin" that contains a Java executable. That path might look something like "C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot" or "/usr/lib/jvm/java-17-openjdk-amd64/" or "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home" .)
    • using Bash or Zsh: export JAVA_HOME=" path to installation "
    • using Fish: set -g JAVA_HOME " path to installation "
    • using Windows Command Prompt: set JAVA_HOME=" path to installation "
    • using PowerShell: $env:JAVA_HOME = ' path to installation '
  3. Download and extract the More Advanced Vehicles source code from GitHub:
    • using Git:
    • git clone https://github.com/stephengold/jme-vehicles.git
    • cd jme-vehicles
    • git checkout -b latest project-1.6.0
    • using a web browser:
    • browse to the latest release
    • follow the "Source code (zip)" link
    • save the ZIP file
    • extract the contents of the saved ZIP file
    • cd to the extracted directory/folder
  4. Run the Gradle wrapper:
    • using Bash or Fish or PowerShell or Zsh: ./gradlew build
    • using Windows Command Prompt: .\gradlew build

After a successful build, Maven artifacts will be found in "MavLibrary/build/libs".

You can install the artifacts to your local Maven repository:

You can run the MavDemo1 application:

You can run the MavDemo2 application:

You can run the HelloMav application:

You can restore the project to a pristine state:

Jump to the table of contents

Controls

In the MavDemo1 application

During the JmePower loading animation:

General controls:

When the physics simulation is paused:

When driving:

Additional controls when the chase camera or orbit camera is active:

Additional controls when the orbit camera is active:

In the MavDemo2 application

During the JmePower loading animation:

General controls:

Additional controls when the physics simulation is paused:

Additional controls when the engine is running:

Additional controls when the chase camera or orbit camera is active:

Additional controls when the orbit camera is active:

In the HelloMav application

Jump to the table of contents

How to add the MaVehicles library to an existing project

The MaVehicles library comes pre-built as a single JVM library that depends on Minie. However, the Minie dependency is intentionally omitted from the MaVehicles POM so developers can specify which Minie library should be used.

For projects built using Maven or Gradle, it is not sufficient to specify the dependency on the MaVehicles Library. You must also explicitly specify the Minie dependency. The following examples specify "+big4", but "+debug" or the default Minie library should also work.

Gradle-built projects

Add to the project’s "build.gradle" file:

repositories {
    mavenCentral()
}
dependencies {
    implementation 'com.github.stephengold:MaVehicles:0.7.1'
    implementation 'com.github.stephengold:Minie:8.0.0+big4'
}

For some older versions of Gradle, it's necessary to replace implementation with compile.

Maven-built projects

Add to the project’s "pom.xml" file:

<repositories>
  <repository>
    <id>mvnrepository</id>
    <url>https://repo1.maven.org/maven2/</url>
  </repository>
</repositories>

<dependency>
  <groupId>com.github.stephengold</groupId>
  <artifactId>MaVehicles</artifactId>
  <version>0.7.1</version>
</dependency>

<dependency>
  <groupId>com.github.stephengold</groupId>
  <artifactId>Minie</artifactId>
  <version>8.0.0+big4</version>
</dependency>

Jump to the table of contents

Wish list

More Advanced Vehicles is a work in progress. Some ideas for future development:

See also the project's issue tracker.

Jump to the table of contents

Licensing

The source code has a BSD 3-Clause license.

Resources/assets/media:

Jump to the table of contents

Conventions

Package names begin with com.jayfella.jme.vehicle

Both the source code and the pre-built libraries are compatible with JDK 8.

The world (and physics-space) coordinate system is right-handed:

The world (and physics-space) units of distance are meters.

Jump to the table of contents

External links

Jump to the table of contents

Acknowledgments

Like most projects, More Advanced Vehicles builds on the work of many who have gone before. I therefore acknowledge the following artists and software developers:

CC Attribution

Hosting

I am grateful to GitHub, Sonatype, Imgur, JFrog, and YouTube for providing free hosting for this project and many other open-source projects.

I'm also grateful to my dear Holly, for keeping me sane.

If I've misattributed anything or left anyone out, please let me know, so I can correct the situation: sgold@sonic.net

Jump to the table of contents