Closed gianluca-nitti closed 7 years ago
@Cervator might want to have a quick look at the changes to build.gradle
...
Belated note about the build.gradle
(feel free to ping me on Slack for anything important - I've got 4k unread GitHub notifications...): I'm fine with it here. Some bits are out of date but I've forked this to the test org Nanoware and pulled it locally to my Gradle redo workspace so I can include it at some point in the new stuff :-)
For this first pull request I added the code to make this an actual engine facade. The engine runs on the main thread, while the Jetty web server runs on separate threads. Lots of "inspiration" and parts of code come from the standard PC facade. Here is how I set up my workspace, hoping it's the correct way (it should be according to the wiki instructions for facades):
gradlew fetchFacadeServer
Put shortly, to test this branch you can follow this process:
gradlew fetchFacadeServer
. On a freshly cloned copy I usually have no issues if I do agradlew build
before, while if I recall correctly I had the engine complaining about missing world generators when running without manually building the engine first. Maybe I didn't set up all the dependencies properly (*).cd facades/Server
and reach this branch using the following commands:cd ../..
) and run this facade withgradlew facades:Server:run
.(*) about the Gradle configuration: I made some tweaks to the
build.gradle
according to the other facades, to setup a basic server configuration; it all works but I'm not sure if it's the correct way and how to correctly handle packaging/distribution. Also, I added two command line arguments, one to set the engine data directory and the other for the game server port. I'm not sure if the web server port too should be settable via a command line switch, for the moment I didn't change the existing code which sets it according to the PORT environment variable.Maybe we can also improve these logistics details later if necessary, I focused on setting up a working development environment since I'm a bit late on the timeline.
Running the project as a facade introduced some issues with paths, because when you run via
gradlew facades:Server:run
the working directory of the program is the root repository and not the root of the facade, so at the moment you get 404s if you try to accesslocalhost:8080/
; I fixed the path for the logs using the engine'sLoggingContext
, so they are correctly served atlocalhost:8080/logs
. In my opinion we could put the static web files in an appropriate subdirectory ofsrc/main/resources/
but I think this will be relevant when I'll work on the frontend; my main goal at the moment is setting up the authentication API.