Skip to content

Getting started

fehaar edited this page Mar 20, 2012 · 18 revisions

Getting the tools

The first thing you should do is to make sure that you have all the following tools installed:

Getting the template

Go get the FFWD Template here: https://github.com/fehaar/FFWD-templates. The template is wired up with FFWD (this project) as a submodule, so when you have cloned the main project - remember to init submodules to get the FFWD source out. The template has both an XNA project and a basic Unity project with the configurations wired up to go.

Test that the template is working in the following way:

  1. Open Unity, and open a new project in the Unity subfolder of the Template project. When you do that, you should see some project content and get the FFWD menu in the Unity menu bar.
  2. Choose the menu item FFWD and select the Full export option. This will export the demo logo scene to the XNA project. You should not get any errors in the console, but some messages telling you what has happened.
  3. Open the XNA project FFWD.Template in Visual Studio.
  4. In the FFWD.Template.XmlContent include the Scene and Assets that have been exported. Do the same in the FFWD.Template.Content project.
  5. In the FFWD.Templates.Scripts project, include the scripts that have been exported from Unity.
  6. For the scene, set the Content Processor to FFWD - Scene processor. You may need to try and compile the project at least once for this option to appear.
  7. Compile and run the XNA project - you should see the same as when you start the scene in Unity.

Problems with the template scene

If you have issues with getting the project to work, and have non-english region settings, you need to check the following settings due to an issue with how XNA compiles XML:

  1. Open "Region and Languages" in Windows
  2. In the Formats tab, select "Additional settings"
  3. Change the "Decimal symbol" to be . (dot) and "Digit grouping symbol" to be , (comma).
  4. Apply.
  5. Restart Visual Studio and make a rebuild. Now things should be working.

Starting your project

Now we want to get started with your project. What to do depends on how your old project is doing:

  • If you are starting a new project, you can just start working in the template directory.
  • If you have an old project on the asset server, you can just check out the project to the template project using Unity.
  • If you old project is using external version control, you can just copy the contents of the Assets folder to the template directory.
  • If you are using no source control at all (you really should). Copy both the Assets and the Library folder from your old project, in order to get all the references between your components to the new project.

Run the ProjectInitializer.exe file in the template directory. It will ask you for the name of your project. Input it and it will make a copy of the XNA template project inside the XNA project with all naming changed. You can delete the FFWD.Template project afterwards.

Open Unity and open the FFWD configuration from the menu. Change the path to your XNA project directory and the export paths to fit the new project.

Now you are ready to get to work!

Strategies for porting a project

There are many ways of approaching getting your project ported. How you want to go about it, depends on the size and complexity of the project.

The first step is to setup the scenes you want to export in the FFWD configuration. You should probably start by choosing only some of your basic scenes, whatever is needed for the project to run in some form, and then do a full export.

In XNA you can either work incrementally or try to do everything at once. Which approach you choose, depends on how long you want to wait before seeing anything run in XNA.

The incremental approcah consist of selecting one scene and including that in the game. When you try to compile it, you will get some errors from the scripts that are referenced in the scene and not yet included in the project. Include the scripts one by one, solving any compile errors that occur along the way - refer to Porting scripts for some pointers on what to do. When you are done with that, you have the nessecary scripts for that single scene. Include all the assets for the scene, and try compiling again, including any scripts that are missing. When you get through, change the name of the scene that is to be started in Game1.cs and see if the scene runs.

The everything at once approach consists of exporting all the scene you need and include all scenes, assets and scripts in the XNA project before the compilation process begins. This will probably take a lot longer to get working than in the incremental approach. But when you are through, your project should be working with all scenes.

Getting everything to work

All of this seems easy, but everything will probably not just work out of the box. If it does, you either have a very simple project, or the framework has matured a lot since this text was written.

The following pages contain a lot of resources for working out the kinks in your game. Sometimes the solution to an issue will involve that you change things in your Unity game, sometimes it will be done mostly in XNA. Where you choose to do most of your work depends on the kind of problems you run into. I will always try to keep Unity up to speed as much as I can, as it is easier to change things in scenes there. But for your scripts you could just work with it in XNA and never change the scripts in Unity. Just remember not to export the scritps from Unity if choosing that aprroach.