-
Notifications
You must be signed in to change notification settings - Fork 582
(SM autoconverted) how to get started developing forge
[WARNING!!!]
Page imported from the old SlightlyMagic wiki. To be integrated into other wiki pages and/or README... or deleted.
Welcome to the development wiki for the Forge project. This document aims to answer questions about Forge building and testing. There's something everyone can help with:
-
Game Testers: Testers simply play the game, but take the time to report bugs so the developers can fix them.
- Startup suggestion: Here's how to report bugs quickly and easily.
-
Code Contributors: Contributors are comfortable modifying/creating card files and fixing minor bugs.
- Startup suggestion: After you complete your build, you may want to look at the card scripting API.
-
Java Developers: Developers work with the Java source directly, implementing game features and publishing changes.
- Startup suggestion: The Forge team recommends these plugins at present.
Whatever your interest, the first step is to register/login on the forum.
This document is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
Discussion and comments at the Discord or in the forums. It is good practice to discuss changes before they become permanent.
Editing directions using the Mediawiki syntax can be found here.
Sections to be edited are marked "Section Incomplete", "TODO", or similar.
Special thanks go (in alphabetical order) . . .
- to Doublestrike who restructured and updated this document for better usability.
- to Chris H., who provided Mac OS specific instructions and corrections.
- to jeffwadsworth who provided corrections.
- to Rob Cashwalker, who provided the first draft of what became this document.
- to everyone else who edited this document on the wiki at slightlymagic.net.
This section deals with installation details for the various software used in the common development environment.
Java is the programming language which Forge is written in. It's got its own runtime environment that allows the same program to be run on any operating system. For development, it is best to install a Java Development Kit, or JDK, instead of a JRE or other JVM if possible.
Download Java from this site. If you want 64-bit Java, you must visit the site with a 64-bit browser (currently Internet Explorer is the most popular option).
There's many tutorials on the Net that do a great job of explaining this install. Basically, run the installer.
You can test your install from the command line by entering java -version
. You should get something like:
java version "1.6.0_27-ea"
Java(TM) SE Runtime Environment (build 1.6.0_27-ea-b03)
Java HotSpot(TM) Client VM (build 20.2-b03, mixed mode, sharing)
If you've run the installer, but the test doesn't work, you'll need to
show your computer where to look for the Java compiler. Find your
system environment variables and append
;path-to-java-install/bin
to the end of the PATH
variable. You may
need to log off/on before it works.
Both flavors of Java (x86 and x64) can be installed to a USB drive to move your dev environment between operating systems. A batch file must be created to (temporarily) modify the PATH variable of the host machine, with this line of code included:
SET path=path-to-jdk-folder\bin;!path!
A GOTO
block can be set to test for OS architecture using the
following line:
if %processor_architecture:86=%==%processor_architecture%
Java comes pre-installed on versions of Mac OS X Snow Leopard (10.6) and earlier. To run Forge on Lion (10.7) or newer, Java (specifically the JDK) version 7 is required. This can be downloaded here.
Open the package file to launch the installer. Follow the installer instructions.
For mobile-dev Mac OS requires the use of the -XstartOnFirstThread JVM argument.
You can test your install from the Terminal.app application that is
located in your /Applications/Utilities/ folder by entering java -version
into the terminal window. You should get something like:
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511c)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)
Although we officially recommend a JDK, the curious may be interested in how the softwares differ. See JRE vs. JDK vs. JVM.
Maven is a tool used for publishing versions of Forge for public release. It automates and standardizes the process so best practices are followed and project structure is consistent.
You do not need to install Maven unless you plan on being part of this process. Otherwise, skip ahead to m2e Plugin.
- Download the zip file here.
- Unpack the file to your preferred location on your hard drive.
- Find your system environment variables
and append
;path-to-maven-install/bin
to the end of thePATH
variable.- You may need to log off/on before it works.
From the command line, mvn --version
should produce something similar
to
Apache Maven 3.0.3 (r1075438; 2011-03-01 01:31:09+0800)
Maven home: C:\path-to-maven\bin\..
Java version: 1.6.0_27-ea, vendor: Sun Microsystems Inc.
Java home: C:\path-to-jdk-folder\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
Maven can be run from a USB drive. Change the JAVA_HOME variable, and
add the \bin to the PATH variable. Add the following lines to your
batch file:
SET java_home=path-to-jdk-folder
SET path=%java_home%\bin;!path!
Maven should already be installed.
From the Terminal application, mvn --version
should produce something
similar to
Apache Maven 3.0.3 (r1075438; 2011-03-01 01:31:09+0800)
Maven home: C:\path-to-maven\bin\..
Java version: 1.6.0_27-ea, vendor: Sun Microsystems Inc.
Java home: C:\path-to-jdk-folder\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
You will need an editor to modify the Java code. We recommend IntelliJ as described below.
It comes in two versions:
- Community Edition: free to download and enough for this project (it is not a trial version that expires);
- Ultimate Edition: paid version that has support for various frameworks (that we don't need);
On the official website can be found versions for Windows/Linux/OSX.
You will not need to install any plugins.
We've recently switched to Git. The new workflow for getting the code and submitting patches is as follows:
-
- <https://git.cardforge.org/>
-
- <https://git.cardforge.org/core-developers/forge>
-
Click on the [Fork] button to create your own fork of the project.
-
- [email protected]:Myrd/forge.git
-
- git clone [email protected]:Myrd/forge.git
-
- git commit -a
-
- git push
-
Now, on your Forge clone page, click "Merge Requests" on the left side and then "New merge request" and select your Fork project and the branch (e.g. master) and select "Compare branches and continue", from where you will be presented with UI to create the merge request.
-
Once the merge request is created, someone from the Forge project can review it and merge it in.
To keep your Git fork up to date, do the following:
-
- git remote add upstream [email protected]:core-developers/forge.git
-
- git fetch upstream git merge upstream/master
-
If there are merge conflicts, resolve them and commit the changes (and push).
-
- git fetch upstream git checkout master git reset --hard upstream/master git push origin master --force
For more git usage, but less focus on forge's project organisation, take a look here.
This section details the use of Maven to generate published builds released in the Forge forums.
==
Team Synchronizing Perspective
== (Section incomplete.)
- Java Applet
- Java Application
- Maven build
- Maven build...
- Maven clean
- Maven generate-sources
- Maven install
- Maven test
Several example are provided below.
- The Java Applet menu command is used to run Java Applets. Currently not needed in forge.
- The Java Application menu command will let you run the forge game. The first time you use this command you may have a java heap space error. Quit forge and then select the Run -> Run Configurations menu command. Select the (x) = Arguments tab and add -Xmx1024m to the VM arguments checkbox.
- The JUnit Test menu command is used to run JUnit tests. The Run Configurations window can be used to configure this option.
- The Maven build command will build the forge jar-with-dependencies file in your /git/cardforge/target/ folder. This version of the Maven build command does not open the window labeled Edit Configuration. Use the Maven build... command instead if you want to enter a goal.
- The Maven build... menu command will give you a window labeled
Edit Configuration. You enter the goal into the Goals: text
box. Click Apply. Then click Run.
- The goal -U -B clean -P osx,windows-linux install will build the jar-with-dependencies file and packages this jar with the necessary files to produce two archives. A windows and unix specific archive and a Mac specific archive. This goal does not upload these archives to a site for distribution.
- The goal -U -B clean -P windows-linux install will build a snapshot package build of the Windows/Linux package only.
- The goal -U -B clean -P osx install will build a snapshot package build of the Mac OSX package only.
- The goal -U -B clean -P osx,windows-linux install release:clean release:prepare release:perform will build the jar-with-dependencies file and packages this jar with the necessary files to produce two archives. A windows and unix specific archive and a Mac specific archive. This goal also uploads these archives to a site for distribution.
- The goal -U -B clean install will build the forge jar-with-dependencies file in your /git/cardforge/target/ folder. The Maven install menu command should do the same thing. Full build, package, no uploads. Good for testing.
- The Maven clean menu command will remove the various files and folders that were added to the target folder as part of the build process. When finished, there will be two empty folders named classes and test-classes located inside of the target folder.
- The Maven generate-sources command will run the build-helper-maven-plugin. Does not appear to do anything of notice.
- The Maven install command will build the forge jar-with-dependencies file in your /git/cardforge/target/ folder.
- The Maven test command will run the TestSuite that is part of the Maven build process.
Currently handled by Blacksmith, a bot on the Discord channel
Currently handled by Blacksmith, a bot on the Discord channel
Spaces only.
TBD
This could mean you have a corrupt miglayout jar. Starting at your home folder, try removing the .m2/repository/com/miglayout folder. Then run 'mvn -U clean install' to redownload it. (You may have to install a command-line version of maven to do this.)
- Right click your Forge project (default name is Forge [trunk], choose Maven, then Update dependencies. The Update Maven Dependencies window opens.
- Make sure your Forge project(s) have check marks, then click OK.
-
-
Gameplay Guide
-
Modding and Development
-
-
- Skins
- Music & Sounds
- Card Images
- File Formats