worldofdragons
v0.0.2
Published
A MMO made with libGDX
Downloads
76
Readme
World of Dragons
A MMO made in LibGDX.
To run open the root build.gradle as a project in your favorite IDE. (hint: IntelliJ IDEA)
To run the desktop build just run the Gradle task desktop:run
, and to run the server use the task headless:run
.
Building and running
This project uses Gradle to manage dependencies.
The Gradle wrapper was included, so you can run Gradle tasks using gradlew.bat
or ./gradlew
commands.
You can use these Gradle tasks to build and run the code:
lwjgl3:run
- Run the desktop applwjgl3:dist
- Build the desktop app into a JAR. It can be found atlwjgl3/build/libs
.lwjgl3:clean build bundleNativeZip
- Build the desktop app into the native OS' app formatheadless:run
- Run the headless appheadless:dist
- Build the headless app into a JAR. It can be found atheadless/build/libs
.headless:clean build bundleNativeZip
- Build the headless app into the native OS' app format
Other useful Gradle tasks and flags:
--continue
: when using this flag, errors will not stop the tasks from running.--daemon
: thanks to this flag, Gradle daemon will be used to run chosen tasks.--offline
: when using this flag, cached dependency archives will be used.--refresh-dependencies
: this flag forces validation of all dependencies. Useful for snapshot versions.android:lint
: performs Android project validation.build
: builds sources and archives of every project.cleanEclipse
: removes Eclipse project data.cleanIdea
: removes IntelliJ project data.clean
: removesbuild
folders, which store compiled classes and built archives.eclipse
: generates Eclipse project data.idea
: generates IntelliJ project data.test
: runs unit tests (if any).
Note that most tasks that are not specific to a single project can be run with name:
prefix, where the name
should be replaced with the ID of a specific project.
For example, core:clean
removes build
folder only from the core
project.
Code outline
Understandably, it can be hard to understand all of the (messy) code. Here is an outline to help.
android
The Android mobile backend. Requires an Android SDK.
src/.../android
- Contains all of the Android backend code.AndroidLauncher.java
- Launches the Android backend.
assets
Contains all assets, such as sounds, images, data, etc.
Warning: this folder is currently very messy. It needs to be reorganized.
core
The main module shared by all platforms. Contains the essential core code.
src/.../worldofdragons
- Contains the core code. Used by all modules.component
- Contains ECS components.BodyComponent.java
- Stores a body for the entity.ConnectionComponent.java
- Stores a network connection for the entity.DoorComponent.java
- Used as a tag for collision detections.FormerPositionComponent.java
- Stores the position of the entity before it was moved. This is used in the server to track if an entity has moved or not.LightingComponent.java
- Stores data important to lighting. Also tracks day-nightMainPlayerComponent.java
- Used in the client to identify the main player.MapComponent.java
- Stores the map, its data, and its renderer for the client.PlayerComponent.java
- Stores player data.PositionComponent.java
- Stores the position of the entity.RenderDataComponent.java
- Stores the render data for the entity. Used for specialized rendering.VelocityComponent.java
- Stores the velocity of the entity.
hijackedmaploader
- Contains code for a hijacked map loader, which only loads the map data.misc
- Contains miscellaneous code.AlertManager.java
- Manages alerts. Big thanks to Dave for this.
network
- Contains the network code.command
- Contains packets sent from the server. Note: this will probably be dramatically changed in a refactor.type
Contains data types for the network. Note: this will probably be removed in a refactor.ClientListener.java
- Listens for incoming packets in the client.Network.java
- Manages Kryo instances for the client and server.PlayerConnection.java
- A customized connection, used in the server, that stores player data.ServerListener.java
- Listens for incoming packets in the server.WoDClient.java
- The WoD client.WoDServer.java
- The WoD server.
screen
- Contains the game screens.GameScreen.java
- The main game screen.LocalGameScreen.java
- A customized version of theGameScreen
that is used to host a singleplayer server.MainMenuScreen.java
- The main menu screen.ResourceLoaderScreen.java
- Loads all assets from theResourcePack
file.ServerScreen.java
- Used in theheadless
module to host a server.
sprite
- Contains the sprites. Note: this will probably be removed in a refactor.system
- Contains the ECS systems.CollisionSystem.java
- Handles collisions.GenericEntityRenderSystem.java
- Used in the client to render simple entities.HudRenderSystem.java
- Used in the client to render the HUD.LightingSystem
- Used in the client to render light on top of the map.MapRenderSystem.java
- Used in the client to render the map.PhysicsSystem.java
- Used in the server to handle physics.PlayerSystem.java
- Used in the server to handle player data and updates.SpecialEntityRenderSystem.java
- Used in the client to render more complex entities.
AnimationSeries.java
- Handles sprite animations.CollisionListener.java
- Used in the physics system to detect collisions.Constants.java
- Stores all constants.Dimension.java
- Used by the server to track all players in a certain room or dimension. Note: this file will probably be moved in a refactor.DimensionManager.java
- Used by the server to manage all dimensions. Note: this file will probably be moved in a refactor.GameState.java
- Keeps track of the current game state. It has a very messy structure and is in need of a refactor. Note: this file might be deleted in a refactor.GDExtras.java
- Contains utility functions for LibGDX.Physics.java
- Contains the physics system, but also is kind of an extension of GameState.ResourcePack.java
- Manages all assets and loads them from a JSON file.ServerAnimationSeries.java
- A customized version ofAnimationSeries
that is used by the server.WorldOfDragons.java
- The main class of the game.
headless
The desktop backend without a graphical interface. Used to run WoD servers.
data
- Contains all of the game data for the server: maps, physics bodies, etc.players
- Currently used to store player save data. This will be stored in a database eventually.resource
- Contains all of the required game assets. Currently, this only consists of the Pixeld16 tileset.src/.../headless
- Contains all of the headless backend code.GUILog.java
- Creates a graphical interface with Swing to display log outputs.HeadlessLauncher.java
- Launches the headless backend.WorldOfDragonsServer.java
- AnApplicationListener
customized for the headless backend. Used to start a WoD server.
ios
The iOS mobile backend using RoboVM.
src/.../ios
- Contains all of the iOS backend code.IOSLauncher.java
- Launches the iOS backend.
lwjgl3
The primary desktop backend using LWJGL3.
src/.../lwjgl3
- Contains all of the desktop backend code.Lwjgl3Launcher.java
- Launches the desktop backend.
Other directories
jre
- Used to store JREs for bundling.
Contributing to pixel art
Most assets should be 16x6 pixels. You should also stick to the color palate. Below are some tools (+ setup) to make pixel art
pixilart.com
An online free to use pixel art editor. To get setup, simply create a new palate, choose to import, and copy-paste in the line below
Color palate
2e222f,3e3546,625565,966c6c,ab947a,694f62,7f708a,9babb2,c7dcd0,ffffff,6e2727,b33831,ea4e36,f57d4a,000000,ae2333,e83b3b,fb6a1d,f79617,f9c22b,7a3045,9e4539,cd683d,e6904e,fbb854,4c3e24,676633,a2a947,d6e04b,fbff86,165a4c,239063,1ebc72,91db69,cedf6c,313638,374e4a,547e64,92a984,b2ba90,0b5e65,0b8b8f,0eaf9c,30e1b8,8ff8e1,323353,484a77,4d65b4,4d9ce6,8fd2ff,45293f,6b3e75,905ea9,a784f3,eaaded,753c54,a24b6f,cf657f,ed809a,fdcbb0,831c5d,c32454,f04f77,f68181,fca890
Aseprite
A high quality pixel art suite with tons of amazing features. To get setup, download the image below and place it in Aseprite's palate folder (found locally in the app files) and restart Aseprite
Color palate image