Getting started with War Worlds 2

Shield
posted Quote

If you're wanted to help with the development of War Worlds 2, the set up is somewhat different to War Worlds 1 (hopefully, it's much simpler to get started now). I'm going to assume you have basic proficiency with command line tools, and using Android Studio in general (if not, you can try here, or ask any questions below). I'm also assuming a linux-like development setup (macOS is linux-like for the purposes of this guide), but the steps for Windows shouldn't be too different).

Prerequisites

  1. Android Studio, which you can get here: developer.android.com/studio
  2. git, which you can get here: git-scm.com
  3. A github account, from here: github.com

You should be familiar with Android app development, running the Android emulator and so on. If you're not familiar with that, I'm happy to help, or you can use one of the many tutorials on the internet.

Getting the code

The first thing to do is grab the code from github. If you're planning on actually contributing, I suggest forking the code on github and working from your fork (more on that later), but if you just want to get something up and running quickly, you can just check out the source directly. Assuming you have a directly called src that you want to put everything in:

$ cd ~/src
$ mkdir wwmmo && cd wwmmo
$ git clone git@github.com:codeka/wwmmo.git code

This will take a while as it downloads the code, but once complete you'll be ready to go.

Running the server

Unlike War Worlds, there's no separate database to worry about, so once you got the game downloaded, you can just open it up in Android Studio.

Open the "build.gradle" file in Android Studio. Hopefully it should all load without complaint and you'll see something like this below in your 'Project' window:

The next thing you'll need to is set up the run configurations. Under Run -> Edit Configurations... if you don't already see an entry for "Server", click "+" and choose Application, then make sure it looks like the one below:

The main difference being that your "Working directory" would point to wherever your server/src/main folder is. Finally, click "Run 'server'" from the Run menu to start the server.

You should see the server being build, then a minute or two later (the first build takes the longest as it has to download the dependencies), you'll see something like this in the output window:

You should be able to connect to the backend by visiting http://localhost:8080/admin. Click "View" under "Starfield" on the left, and just click "Jump". You should see something like this:

Running the client

Make sure the server is still running from the previous section before running the client.

The simplest way to run the client is in an emulator. First, make sure you have Run configuration for the client. As before, choose "Edit configurations" from the "Run" menu, if there's no entry for "client" click "+" and choose "Android app" then make sure it looks like below:

Once you've done that, you can run the client. Choose "Run..." from the "Run" menu, select "client". If you don't have any emulators, you can just create a new one. Pick a Nexus 5 or something like that.

The first time you run the emulator, it'll take a while. But once it's up, the game should start and connect back to the server that you've already got running. Once you go through the setup screens of the game, you should see it running:

Troubleshooting

The game doesn't connect to the server

It's possible I've checked in my local server's IP address again... edit client/build.gradle, and make sure it has the following section:

debug {
  buildConfigField "String", "DEFAULT_SERVER", "\"http://10.0.2.2:8080/\""
}

If if has something else, then I've probably checked in my local server again... sorry!

Edited by Dean,
Edited by Dean,
Edited by Dean,
Edited by Dean,
Edited by Dean,

Shield
posted Quote

I think I will try to look at this project. I don't know how much I can help but I can at least try to understand what is going on. Eventually when I learn more about java I will do what I can.

Shield
posted Quote

I got the emulator to set up but then I got stuck at the part where you edit the server configuration I can't get the same Use pathway of module: Server. No other options were available to me. Also when I try to add the some code for (main module) it says that class 'au.com.codeka.warworlds.server.Program' not found in module 'wwmmo-master'.

Post Reply