Home - OpenWeek/app-for-a-KAP GitHub Wiki

Welcome to the app-for-a-KAP wiki!

First off, if you are only interested into getting the game to play and test, you will have to wait a little more and check the release tab once in a while 😄 The game is still in alpha stages, when it will be more complete, we will release certain versions. Of course, you can still build it yourself with Android Studio or another android development tool.

If you are a developer wanting to help us in our quest, or simply are interested into the code, welcome ! Thank you for your interest :) We suggest you to read these wiki pages and to read the CONTRIBUTING.md file before actually write your pull request. It will increase their chances to be accepted and will make you gain time.

Setting things up

As you noticied if you have read the README, the game is coded in Java using the open library libGDX. So you'll need first to install Java and the Android JDK if it's not already done. We recommend you to use Android Studio, available here , but of course any decent IDE can be used.

If you are using Android Studio, the needed libraries and plugins will be downloaded automatically after opening the project.

Weird bug making impossible to build the project

A weird bug can happen if you clone from github and making impossible to build the project. Error messages like Cause: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded or something about a BouncyCastle are actually caused by a bad keystore cache. Here is the solution to correct this bug (if you are under a linux distribution) :

  1. First, go into ~/.android/ and delete the debug.keystore file
  2. In that folder, execute the following command : keytool -genkey -v -keystore ~/.android/ debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
  3. Follow the instructions
  4. It will generate a new debug.keystore file. Try to build up again, it should work now.

This bug is tricky cuz the error messages given by android studio aren't clear at all about the error source. This is not an error happening only in this repository, but it happen often with libGDX projects.

Structure

The root is divided into 3 folders.

  • /docs contains the work documents related to the project. You are free to add documentation there if you like
  • /kapotopia contains the code of our project, we will discuss of that folder for now on.
  • /raw-assets contains the raw assets of the used images or animations, to heavy to be included in the final apk

As in many libGDX projects, we use several folders for different platforms. In this case, we will focus into getting our game ready for an Android release and an IOS release. The later will come after the Android port is complete, which is our top priority. The core folder actually contains the majority of our code, including the game logic. The other folders contain specific code and resources for each platform. For instance, the assets are contained in the android/assets/ folder.

Core folder

The core folder is divided into different packages and classes. The logic of the structure is the following :

  • The Screens folder : contains the different screens of the game. Concretly, each of the java classes contained there implement the Screen interface.
  • GameX folders : These folders contains the logic associated with the different minigame's screens.
  • Animations folder : contains the abstractions for the used animations. To add a new animation, we extends the AnimationAbstract class in a new class and use the AnimationBuuilder wrapper to build our animation.
  • AssetsManaging folder : contains the AssetsManager, a Singleton class that take care of holding up in memory the disposable resources. (Note that this class is of course different from the libgdx AssetManager, we wanted more flexibility). It also contains statics methods for taking care of Sounds and Fonts in a friendly way with enums ( UseFont and UseSound )
  • DataStructures folder : contains basic DT implementations
  • DialogsScreen folder : contains classes relative to CinematicScreen
  • Helpers folder : Huge package containing lot of libgdx common objects Builders. Usually, libgdx objects (like Label, TextButton, ImageButton, ...) takes lot of space for configuration making the code less readable. These wrappers helps reduce the complexity of building such objects. This package also contains various helpful generic classes that can be reused.
  • Every else java classes contained outside of these folders are considered as shared classes between the screens.

As you can guess, the development is mainly focused on the screen classes. We try to parallelize the different tasks to be done between contributors, in this case the different minigames.

Shared classes are certainly the most important ones to understand before trying to go further in the development, for that we will discuss of them in separate wiki pages.

If you are new to this project and want to contribute, we suggest you to read these pages first before do a Pull Request. Remember to read the CONTRIBUTING.md document before actually try to code.

Assets folder

The assets folder is contained in the /android folder. It contains every resources used for the game. This include :

  • The sprites and background pictures in game3/, World1/Game1, World1/Game2, EcranMenu/ and IST/ folders
  • The icons in the icons/ and ImagesGadgets folders
  • The sounds and musics in the sound/ folder
  • The font used in the fonts/ folder
  • The libgdx skins in the skins/ folder
  • The values used in the game

Project tree

Here is a more detailled folders tree from the project root :

  • kapotopia/
    • core
      • src
        • gdx/kapotopia$
          • Animations
          • AssetsManaging
          • DataStructures
          • DialogsScreen
          • Game1
          • Game2
          • Game3
          • Game4
          • Helpers
            • Builders
            • ...
          • Screens
          • ... (various .java files)
      • build.gradle
    • android
      • assets
        • defaultSkin
        • EcranMenu
        • fonts
        • game3
        • icons
        • ImagesGadgets
        • IST
        • MireilleImages
        • skins
          • comic
        • sound
          • bruitage
        • strings
        • Symbole du jeu
        • World1
          • Game1
          • Game2
      • res
        • drawable
        • mipmap-anydpi-v26
        • mipmap-hdpi
        • mipmap-mdpi
        • mipmap-xhdpi
        • mipmap-xxhdpi
        • mipmap-xxxhdpi
        • values
      • build.gradle
      • AndroidManifest.xml
    • build.gradle
  • docs
  • raw-assets
    • actiontext-G1
    • IST
    • MireilleImages