Skip to content

Commit ed0a51a

Browse files
committed
update
1 parent 5cf0200 commit ed0a51a

File tree

7 files changed

+208
-7
lines changed

7 files changed

+208
-7
lines changed

docs/build.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
2+
**NGE** is a modern Java library, you can build and distribute your application in several ways, depending on your target platform and user base.
3+
4+
!!! tip
5+
The [template app](./getting-started.md) includes a **GitHub Actions** workflow that builds for all supported platforms using every available methods.
6+
You can use this as a reference or adapt it directly for your own project.
7+
8+
9+
10+
## Building for Desktop
11+
12+
### Portable JAR
13+
14+
To build a standalone JAR file:
15+
16+
17+
```bash
18+
./gradlew build
19+
```
20+
21+
or on Windows:
22+
23+
```bash
24+
gradlew.bat build
25+
```
26+
27+
The output will be located at:
28+
29+
```
30+
dist/portable/yourapp-version-portable.jar
31+
```
32+
33+
This is the traditional approach to distributing Java applications. It's simple, cross-platform, and requires only a single build step.
34+
35+
However, it has a few limitations:
36+
37+
* Slightly longer startup time compared to native executables
38+
* Requires users to have **Java Runtime Environment (JRE) version 21 or higher** installed
39+
40+
While you *can* manually bundle a JRE with your app, there's a better alternative, discussed next.
41+
42+
43+
### Installer
44+
45+
This method packages the portable JAR **along with a JRE**, and wraps them in a platform-specific installer. It simplifies distribution and ensures your users don't need to install Java separately.
46+
47+
48+
```bash
49+
./gradlew buildInstaller
50+
```
51+
52+
or on Windows:
53+
54+
```bash
55+
gradlew.bat buildInstaller
56+
```
57+
58+
The output will be located at:
59+
60+
```
61+
dist/yourapp-version-platform.setup
62+
```
63+
64+
!!! note
65+
You can only create an installer for the platform you’re currently on. To support multiple platforms, you’ll need to run this process on each one individually.
66+
67+
68+
69+
### Native Executable (Recommended)
70+
71+
The most optimized way to distribute your app is as a **native executable**, which provides:
72+
73+
* Significantly faster startup times
74+
* No need for users to install a JRE
75+
* No need to bundle a JRE with your app
76+
77+
!!! note
78+
Native builds require **GraalVM 24 or higher**.
79+
80+
You can install it easily using [SDKMAN](https://sdkman.io/):
81+
82+
```bash
83+
sdk install java 24-graal
84+
```
85+
86+
87+
Depending on the complexity of your app, you might need to run the *tracing agent* to help GraalVM understand your app's dependencies.
88+
89+
To do that you need to run
90+
91+
```bash
92+
./gradlew traceNative
93+
```
94+
95+
and use all the features of your app. This will update the tracing files for GraalVM.
96+
97+
When you are ready you can build the native executable with:
98+
99+
100+
```bash
101+
./gradlew buildNativeExecutable
102+
```
103+
104+
or on Windows:
105+
106+
```bash
107+
gradlew.bat buildNativeExecutable
108+
```
109+
110+
The output will be located at:
111+
112+
```
113+
dist/yourapp-version-platform.buildNative/
114+
```
115+
116+
This directory includes the executable along with all required dependencies and resources that you will need to ship alongside with your app.
117+
118+
119+
!!! note
120+
Native executables can **only** be built on the platform you're currently running. GraalVM does **not** support cross-compilation yet.
121+
122+
123+
124+
## Building for Android
125+
126+
TBD
127+
128+
## Building for the Web (Browser)
129+
130+
TBD
131+
132+
133+
## Building for iOS
134+
TBD

docs/components/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public interface Component<T> {
2828
## Fragments
2929
!!! abstract "See [Fragment Javadoc](https://javadoc.ngengine.org/org/ngengine/components/fragments/Fragment.html)"
3030

31-
Fragments are interfaces that extend a component’s functionality. By implementing one or more fragment interfaces (e.g., `ViewPortFragment`, `LogicFragment`), a component signals which engine systems it needs. The manager detects these fragments and handles their lifecycle in a predefined order:
31+
Fragments are interfaces that extend a component’s functionality. By implementing one or more fragment interfaces (e.g., `MainViewPortFragment`, `LogicFragment`), a component signals which engine systems it needs. The manager detects these fragments and handles their lifecycle in a predefined order:
3232

3333
1. **Initialization** (`receiveXXX` methods)
3434
2. **Loading** (`loadXXX` methods)

docs/getting-started.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,70 @@
1-
Getting started with NGE is straightforward. Everything begins with a `NGEApplication`, which you instantiate via a static method:
1+
Nostr Game Engine is fully modular: you can pick and choose individual engine components from our [GitHub Package Registry](https://github.com/orgs/NostrGameEngine/packages?repo_name=ngengine) and include them in any Gradle project.
2+
3+
However, the quickest way to start development is with the app template, detailed below.
4+
5+
## Bootstrapping with the App Template
6+
7+
Getting started with a new Nostr Game Engine project is easy thanks to the preconfigured Gradle template.
8+
9+
You can obtain the template in two ways:
10+
11+
- **Clone the repository**:
12+
13+
```bash
14+
git clone https://github.com/NostrGameEngine/nge-app-template.git
15+
```
16+
17+
- **Download as ZIP**:
18+
19+
[Download the Template App](https://github.com/NostrGameEngine/nge-app-template/archive/refs/heads/master.zip){ .md-button }
20+
21+
After downloading, extract the contents to your workspace and open the project in your favorite Java IDE.
22+
23+
!!! tip
24+
We recommend using [Visual Studio Code](https://code.visualstudio.com/), but any Java-compatible IDE will work.
25+
26+
27+
### Test the demo app
28+
29+
Before going further, you can try to launch the demo app to ensure everything is set up correctly.
30+
31+
Open a terminal in the project root and run:
32+
33+
```
34+
./gradlew run
35+
```
36+
or on Windows:
37+
38+
```powershell
39+
gradlew.bat run
40+
```
41+
42+
![Demo App Screenshot](./images/demo-app.png)
43+
44+
### Configure Project Properties
45+
46+
Edit the `gradle.properties` file in the project root to customize your application details:
47+
48+
```properties
49+
version=0.1
50+
projectName=ngeapp
51+
mainClass=org.example.NGEAppMain
52+
copyright=Copyright (c) 2025
53+
```
54+
55+
you can also change `ngeVersion` if you want to use a different version of the engine.
56+
57+
### Next Steps
58+
59+
The next sections will walk you through the core concepts that make up a Nostr Game Engine application.
60+
You can start experimenting with the source code you've just downloaded, to see how things work.
61+
62+
Whenever your application is ready, you can head over to the [Building and Distribution](./build.md) section to learn how to package your app for distribution.
63+
64+
65+
## NGEApplication
66+
67+
Everything begins with a `NGEApplication`, which you instantiate via a static method:
268

369
```java
470
Runnable appBuilder = NGEApplication.createApp(app -> {

docs/images/demo-app.png

433 KB
Loading

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ NGE follows many of the same paradigms as jMonkeyEngine 3 (jME3), so if you're a
4444

4545
NGE modules use the following prefixes:
4646

47-
- **jME3 Modules**: All original jMonkeyEngine 3 modules are re-published under the `jme-` prefix (for example, `jme-core`, `jme-graphics`, `jme-networking`).
47+
- **jME3 Modules**: All original jMonkeyEngine 3 modules are re-published under the `jme3-` prefix (for example, `jme3-core`, `jme3-lwjgl3`, `jme3-networking`).
4848
- **NGE Modules**: NGE-specific modules are published under the `nge-` prefix (for example, `nge-core`, `nge-auth`, `nge-network`).
4949

5050
!!! Tip "You can mix and match `nge-` modules with any compatible jME3 release. However, for the latest bug fixes and cutting-edge features, we recommend using the latest NGE builds."

docs/postprocessing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
Postprocessing in NGE is anything that happens after the scene has been rendered but before it is displayed on the screen. This includes effects like bloom, depth of field, and more.
22

3-
Postprocessing effects can be attached to a viewport with a component that implements [ViewPortFragment](https://javadoc.ngengine.org/org/ngengine/components/fragments/ViewPortFragment.html) and overrides the `loadViewPortFilterPostprocessor` method, from there you can add your desired postprocessing effects to the [FilterPostProcessor](https://javadoc.ngengine.org/com/jme3/post/FilterPostProcessor.html) instance that is passed preconfigured to the method.
3+
Postprocessing effects can be attached to a viewport with a component that implements [MainViewPortFragment](https://javadoc.ngengine.org/org/ngengine/components/fragments/MainViewPortFragment.html) and overrides the `loadMainViewPortFilterPostprocessor` method, from there you can add your desired postprocessing effects to the [FilterPostProcessor](https://javadoc.ngengine.org/com/jme3/post/FilterPostProcessor.html) instance that is passed preconfigured to the method.
44

55
!!! example
66
```java
7-
public class MyPostProcessingComponent implements Component<Object>, ViewPortFragment {
7+
public class MyPostProcessingComponent implements Component<Object>, MainViewPortFragment {
88
@Override
9-
public void loadViewPortFilterPostprocessor(AssetManager assetManager, FilterPostProcessor fpp){
9+
public void loadMainViewPortFilterPostprocessor(AssetManager assetManager, FilterPostProcessor fpp){
1010
// add your postprocessing effects here
1111
// fpp.addFilter(new BloomFilter());
1212
// ....
1313
}
1414

1515
@Override
16-
public void updateViewPort(ViewPort viewPort,float tpf) {}
16+
public void updateMainViewPort(ViewPort viewPort,float tpf) {}
1717
}
1818
```
1919

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ theme:
3131
nav:
3232
- Overview: index.md
3333
- Getting Started: getting-started.md
34+
- Building and Distribution: build.md
3435
- Component System: components/index.md
3536
- Authentication: auth.md
3637
- Networking:

0 commit comments

Comments
 (0)