Pixel Dungeon Wiki
Register
Advertisement
See also: Development: Modding With Eclipse

This is a short tutorial to help get developers started using the IntelliJ IDE.
I'll be working on OSX, but most application settings should be transferable to other operating systems.
IntelliJ is a great IDE, easy to use, fast and comes packed with a bunch of handy tools to allow you to spend more time coding. I use it for Java on this project and AS3 on a number of other projects.

Prerequisites[]

Java[]

Make sure you have a recent version of Java installed; Java 7 or 8 is good. It's best if you have the JDK (Java Development Kit) installed, but the standard JRE (Java Run Time) will work fine.

If you're not sure if you have java installed, run "java -version" from the command line. If it says java is unrecognized, go download and install Java from here.

IntelliJ[]

If you haven't already, download and install IntelliJ. You can use either the original Intellij or Android Studio. I'm using the Community Edition of the original Intellij, which is free. A default installation is fine, unless you want to customize the extensions the IDE will install.

Android SDK[]

Install the Android SDK.
Google-fu a guide called Android SDK: How to install and get started.
You can also do it from within IntelliJ: Tools → Android → SDK Manager.

Git[]

All version control is done with Git, do make sure you've got that installed too.

The Quick method[]

Pixel Dungeon requires some setting up to get working properly. Fortunately, there's a fork of Pixel Dungeon available with (almost) all the set-up done. The fork is unmodified except for fixing several compile errors. The process is really easy:

git clone --recursive https://github.com/your-user-name/pixel-dungeon
  • Start up Intellij
  • Click on 'File → Open' and navigate to where you downloaded the code to
  • Skip to the 'Build and Run section' below

Source Control and creating a Project[]

All source for Pixel Dungeon is version controlled using GitHub.
Go ahead and create an account if you don't have one.
You can install and use Git from the command line, or you can use an application to help you manage your projects.
Personally I use SourceTree. Although useful, you can get started pulling source using IntelliJ!

Once github has been installed, be sure to configure its application location from settings -> Version Control -> Git. Then, set the location of the github app in the input box at the top of the window.

First, go to the Pixel Dungeon source and the Game Framework source, and fork both projects.

Open IntelliJ (with no project open, on the startup screen), select Check out from Version Control and select GitHub. Log in, and select the pixel-dungeon project, choose your project location and hit next.

OR

Alternatively, you can pull the source yourself, either with git command line or SourceTree.
If you've done it this way, just select Import Project on the startup page and navigate to the newly pulled directory, and hit next.

THEN

A popup will ask if you want to create a new IDEA project; say yes.
Keep pressing next; everything should be setup correctly!

Dependencies[]

You should now have the game project created and ready to build.
However, the PD-classes source we pulled contains the engine for communicating with Android devices.
We will create this module and add it as a dependency to our core pixel-dungeon project.

File → New → Module

Here we want to create a new Android Library Module. I have called the module engine.
Set the content root and module file location to whatever you want; this will create a new project for you.
Next, copy the contents of the PD-classes source into the newly-created src folder.
Your new module project should now contain src/com/watabou/... along with a bunch of newly created project files.

Next, go your pixel-dungeon project structure settings: File → Project Structure....
Go to modules and select the pixel-dungeon module from the list on the left.
At this point, there should be two modules: pixel-dungeon and engine.
Next, select dependencies and click the little plus symbol at the bottom to add a new module dependency.
There should be one option, engine! Add it. Use the arrows to move the dependency about the <Module Source> dependency.

This is the easiest way I found to link this dependency. If there is an easier way, I'd love to know.

Building and Running[]

Hey! We're nearly done!
Click on the pixel-dungeon project in your project list, then navigate to Build → Make Project.
This should build the project and it's dependencies.

To run the game, you'll need to configure some run configurations. You can do this in Run → Edit Configurations. Press the + button to add a new configuration, select Android Application.

Choose the module from the drop down menu; it should be pixel-dungeon.
This should now allow you to choose an Activity to run.
In the Launch field, choose the PixelDungeon class (com.watabou.pixeldungeon.PixelDungeon).
By default, this configuration will run in the Android emulator, but you can modify your settings (or add another config) to allow building to a USB connected device.

Merry modding!

Troubleshooting[]

I'll try and answer any questions you have in the comments section.

Configuration with name 'default' not found[]

If you get this message, it means that you cloned the simple setup fork without the 'recursive' flag. To fix this, open up Git Bash and navigate to the project's root directory. Type the following:

  • git submodule init
  • git submodule update
  • cd game-engine
  • git checkout master

Extensions[]

Now that you've successfully built Pixel Dungeon, here are some tutorials to help you out:


Modding-Creating sprites

Modding-Creating a Storage

Advertisement