Skip to content

Commit

Permalink
Working on more 'Engine' Systems. Trying to get something working and…
Browse files Browse the repository at this point in the history
… playable
  • Loading branch information
CaptainSly committed Aug 22, 2024
1 parent c667508 commit ad03e03
Show file tree
Hide file tree
Showing 32 changed files with 197 additions and 313 deletions.
12 changes: 7 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ Someway somehow I've taken inspiration from the following titles when I build ea

One of the main focuses for PaperFX is to provide a way for people to play Textbased "Open World" RPGs. Paper will allow the user to load Plugin files (*.pepm or *.pepf) to play games, similar to the way The Elder Scrolls and Fallout allow modding, though without the need to pay attention to your load order.

## Project Structure

## How to build
PaperFX is separated into a gradle multiproject. PaperFX is the over all main "project" and it has 3 sub-projects that comprise it
* Ink - The substance that fills Paper and Pen and allows the two to actually work. It's the core 'engine' and most if not all of the non-ui code. It holds all the code for most basic game data objects
* Pen - The editor, what was previously called Ink, now swapped to Pen, allows you to create Plugin for Paper to run.
* Paper - The program that takes what Ink offers, and what was created with Pen to provide an game experience. It's the main UI for the 'engine' and is what the PLAYER will mostly use and provides the main game loop.

Run the Gradle Tasks - inkFX-FatJar and paperFX-FatJar respectively for each program. Run them through a console using java -jar *.jar. Will update when a better option is present.
With it broken up in to 3 major projects, both Pen and Paper build and include Ink as a dependency.

## How to use the Editor
A work in progress document is being made as the features and functionality are added.
The document can be viewed [here](technical_documents/Editor%20Documentation.md)

## How to play a game using Paper

Expand Down Expand Up @@ -57,4 +58,5 @@ A [Script Tutorial](technical_documents/ScriptingTutorial.md) of sorts. I'll try
* ZStd
* JavaFX
* TinyLog2
* ControlsFX
* LuaJ 3.0.1 (Needs to be swapped for a reliable fork)
3 changes: 3 additions & 0 deletions ink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ dependencies {
// ZStd - Compression
implementation("com.github.luben:zstd-jni:1.5.6-3")

// ControlsFX
implementation("org.controlsfx:controlsfx:11.2.1")

// Gson
implementation("com.google.code.gson:gson:2.10.1")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.azraein.inkfx;
package io.azraein.inkfx.system;

public class InkFX {
public class Ink {

public static final String VERSION = "0.1.0";

Expand Down
3 changes: 3 additions & 0 deletions ink/src/main/java/io/azraein/inkfx/system/Paper.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.azraein.inkfx.system;

import io.azraein.inkfx.system.actors.Player;
import io.azraein.inkfx.system.actors.dialogue.DialogueParser;
import io.azraein.inkfx.system.io.Database;
import io.azraein.inkfx.system.io.PaperIni;
import io.azraein.inkfx.system.io.plugins.PaperPluginLoader;
Expand All @@ -27,6 +28,8 @@ public class Paper {

public static PaperIni INI;

public static DialogueParser DP;


// Global Properties

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.azraein.inkfx.system.actors.dialogue;

import java.util.Stack;

public class DialogueParser {


}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.luaj.vm2.lib.TwoArgFunction;
import org.luaj.vm2.lib.jse.CoerceJavaToLua;

import io.azraein.inkfx.InkFX;
import io.azraein.inkfx.system.Ink;
import io.azraein.inkfx.system.Paper;
import io.azraein.inkfx.system.io.scripting.lib.PaperUtilFunctions.PaperLuaLocationSetter;
import io.azraein.inkfx.system.io.scripting.lib.PaperUtilFunctions.PaperLuaSetCalendarDate;
Expand All @@ -21,7 +21,7 @@ public class PaperLib extends TwoArgFunction {
public LuaValue call(LuaValue mod, LuaValue env) {
// Create the Paper Table
paperTable = new LuaTable();
paperTable.set("_VERSION", InkFX.VERSION);
paperTable.set("_VERSION", Ink.VERSION);
paperTable.set("database", CoerceJavaToLua.coerce(Paper.DATABASE));
paperTable.set("ppl", CoerceJavaToLua.coerce(Paper.PPL));
paperTable.set("ini", CoerceJavaToLua.coerce(Paper.INI));
Expand Down
50 changes: 39 additions & 11 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,66 @@ plugins {
id("org.openjfx.javafxplugin") version "0.1.0"
}

val app_name = "paper"
val app_classifier = "pre-alpha"
val app_version = "0.1.0"
val app_codename = "Monster-Blood"

val app_main_class = "io.azraein.paperfx.Main"

repositories {
mavenCentral()
maven {
url = uri("https://jitpack.io")
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

javafx {
version = "21.0.2"
modules = listOf("javafx.controls", "javafx.media")
}


dependencies {

implementation(project(":ink"))

// TinyLog2
implementation("org.tinylog:tinylog-api:2.7.0")
implementation("org.tinylog:tinylog-impl:2.7.0")

// LuaJ
implementation("org.luaj:luaj-jse:3.0.1")

// ControlsFX
implementation("org.controlsfx:controlsfx:11.2.1")

}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)

tasks.register<Jar>("fatJar") {

archiveBaseName.set("$app_name")
archiveVersion.set("$app_version")
archiveClassifier.set("$app_classifier-$app_codename")

from (sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)

from({
configurations.runtimeClasspath.get().filter {
it.name.endsWith("jar")
}.map {
zipTree(it)
}
})

manifest {
attributes["Main-Class"] = "$app_main_class"
}

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

tasks.named("build") {
dependsOn("fatJar")
}
12 changes: 5 additions & 7 deletions paper/src/main/java/io/azraein/paperfx/PaperFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.luaj.vm2.lib.jse.CoerceJavaToLua;
import org.tinylog.Logger;

import io.azraein.inkfx.dialog.PluginSelectionResult;
import io.azraein.inkfx.system.Paper;
import io.azraein.inkfx.system.Utils;
import io.azraein.inkfx.system.io.Database;
Expand All @@ -19,8 +18,9 @@
import io.azraein.inkfx.system.io.plugins.PaperPluginLoader;
import io.azraein.inkfx.system.io.plugins.PaperPluginMetadata;
import io.azraein.inkfx.system.io.scripting.ScriptEngine;
import io.azraein.paperfx.ui.controls.dialog.CharacterCreationDialog;
import io.azraein.paperfx.ui.controls.dialog.PaperPluginSelectionDialog;
import io.azraein.paperfx.ui.controls.dialog.player.CharacterCreationDialog;
import io.azraein.paperfx.ui.controls.dialog.player.PluginSelectionResult;
import io.azraein.paperfx.ui.screens.GameScreen;
import io.azraein.paperfx.ui.screens.MainMenuScreen;
import io.azraein.paperfx.ui.screens.PaperScreen;
Expand All @@ -41,9 +41,7 @@ public class PaperFX extends Application {
@Override
public void init() throws Exception {
super.init();

new Paper();


// Check the Paper Working Directory, then instantiate the Plugin Loader.
SaveSystem.checkFileSystem();
Paper.PPL = new PaperPluginLoader();
Expand All @@ -58,8 +56,8 @@ public void init() throws Exception {
paperScreens.put("game", new GameScreen(this));

// Create the Default Globals
Paper.DATABASE.addGlobal("currentQuestId", "");
Paper.DATABASE.addGlobal("currentQuestStage", "");
Paper.DATABASE.addGlobal("playerName", "");
Paper.DATABASE.addGlobal("currentLocation", "");

// Initialize Scripting Engine last.
Paper.SE = new ScriptEngine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public LocationMover() {
String neighborId = Paper.PAPER_LOCATION_PROPERTY.get().getLocationNeighbors()[dir.ordinal()];
Location neighbor = Paper.DATABASE.getLocation(neighborId);
Paper.PAPER_LOCATION_PROPERTY.set(neighbor);
Paper.DATABASE.addGlobal("currentLocationName", neighbor.getLocationState().getLocationName());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import org.tinylog.Logger;

import io.azraein.inkfx.dialog.PluginSelectionResult;
import io.azraein.inkfx.system.io.SaveSystem;
import io.azraein.inkfx.system.io.plugins.PaperPluginMetadata;
import io.azraein.paperfx.ui.controls.cells.PaperPluginMetadataCell;
import io.azraein.paperfx.ui.controls.dialog.player.PluginSelectionResult;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.azraein.paperfx.ui.controls.dialog;
package io.azraein.paperfx.ui.controls.dialog.player;

import java.util.Optional;

Expand Down Expand Up @@ -186,6 +186,7 @@ public void showDialog() {

if (player.isPresent()) {
Player p = player.get();
Paper.DATABASE.addGlobal("playerName", p.getActorState().getActorName());
Paper.PAPER_PLAYER_PROPERTY.set(p);
} else {
Logger.debug("FUCK, Can't load player");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package io.azraein.paperfx.ui.controls.dialog.player;

import org.tinylog.Logger;

import io.azraein.inkfx.system.GameState;
import io.azraein.inkfx.system.Paper;
import io.azraein.inkfx.system.Utils;
import io.azraein.inkfx.system.actors.Player;
import io.azraein.inkfx.system.actors.dialogue.DialogueParser;
import io.azraein.paperfx.ui.controls.tabs.InventoryTab;
import io.azraein.paperfx.ui.controls.tabs.PlayerStatsTab;
import io.azraein.paperfx.ui.controls.tabs.QuestLogTab;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.azraein.paperfx.ui.controls.dialog.player;

import java.util.List;

import io.azraein.inkfx.system.io.plugins.PaperPluginMetadata;

public class PluginSelectionResult {
private List<PaperPluginMetadata> selectedPlugins;
private List<String> selectedPluginPaths;
private PaperPluginMetadata activePlugin;

public PluginSelectionResult(List<PaperPluginMetadata> selectedPlugins, List<String> selectedPluginPaths, PaperPluginMetadata activePlugin) {
this.selectedPlugins = selectedPlugins;
this.selectedPluginPaths = selectedPluginPaths;
this.activePlugin = activePlugin;
}

public List<PaperPluginMetadata> getSelectedPlugins() {
return selectedPlugins;
}

public List<String> getSelectedPluginPaths() {
return selectedPluginPaths;
}

public PaperPluginMetadata getActivePlugin() {
return activePlugin;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.azraein.paperfx.ui.controls.dialog;
package io.azraein.paperfx.ui.controls.dialog.player;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import java.io.File;
import java.util.Optional;

import org.tinylog.Logger;

import io.azraein.inkfx.system.GameState;
import io.azraein.inkfx.system.Paper;
import io.azraein.inkfx.system.actors.Npc;
import io.azraein.inkfx.system.actors.dialogue.DialogueParser;
import io.azraein.inkfx.system.exceptions.IncompatibleSaveVersionException;
import io.azraein.inkfx.system.exceptions.SaveCorruptionException;
import io.azraein.inkfx.system.io.SaveSystem;
Expand All @@ -16,8 +19,8 @@
import io.azraein.paperfx.ui.controls.LocationView;
import io.azraein.paperfx.ui.controls.PaperClock;
import io.azraein.paperfx.ui.controls.PlayerControls;
import io.azraein.paperfx.ui.controls.dialog.SavePlayerFileDialog;
import io.azraein.paperfx.ui.controls.dialog.player.PlayerJournalDialog;
import io.azraein.paperfx.ui.controls.dialog.player.SavePlayerFileDialog;
import javafx.animation.AnimationTimer;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public void startNewGame() {
new EasterEggDialog().show();
}

// Set any default system globals
Paper.DATABASE.addGlobal("playerName", world.getPlayer().getActorState().getActorName());

((GameScreen) paperFX.getScreens().get("game")).startGameLoop();
paperFX.swapScreens("game");
}
Expand Down
Loading

0 comments on commit ad03e03

Please sign in to comment.