XUI2D allows us to develop games that run on B4A, B4J and B4i. This tutorial will explain the recommended way to organize your projects. I recommend following the suggested structure even if you target a single platform. It is very simple and will help you add more platforms in the future. I guess that most developers will want to create a mobile game. It is still very useful to start with the B4J implementation. The development cycle in B4J is much faster. Code modules We want to share all the game modules between the different platforms. There are three types of modules: - The X2 modules. These modules can be treated as a library and can be shared between all games. This is not a must. - The game modules. These are the most important modules and these modules must be shared between the three platforms. - Platform specific modules including the Main module. The folders structure should be like this: Inside the root game folder we have a folder for each platform. The shared modules are stored here. There is also a shared files folder that will soon be discussed. As you probably guessed, the platform specific modules are stored in the platform specific folders: In all the examples included in the examples pack, this folder only contains the main project file and the unused starter service in B4A. The modules should be added as relative links and it should look like this: Note the light grey relative path. This means that the game modules are one folder up and that the X2 modules are two folders up. Files With the exception of the layout files, all other files should be shared between the projects. The files are saved in the Shared Files folder and are copied with a custom build action that is defined in the Game module: Code: #CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files" Robocopy only copies the files if they were modified so it will not slow down the compilation. "folders ready" is a new compilation step that happens after the project generated folders were created. Now we can edit the files in the Shared Files folder and they will be updated automatically when we run the project. Tips - B4A and B4J XUI2D library is based on jBox2D. B4i iXUI2D is based on the C++ box2d. In most cases the behavior will be the same. However there are some edge cases. - Be careful with modifying returned B2Vec2 vectors unless the documentation says that the vector can be modified. When in doubt use B2Vec2.CreateCopy and modify the new vector. The behavior of such cases can be different between the platforms. - You should of course test on all platforms. Especially when you test performance. - B4A is the only platform where XUI.Scale is not 1 (on phones). It can take some time to understand how to handle the device scale. - The simplest way to create a new project is to make a copy of one of the examples inside the X2 folder. As the references are relative all the references will be correct and the projects will be ready. - There are currently 9 different examples in the examples pack. This means that there are 27 projects. It would not have been possible to create and maintain these projects without this organized structure. - The files in the platform specific Files folder are empty. They are copied from the Shared Files folder on the first run. - You can use similar structure for other projects as well. Not just XUI2D.