Skip to content

geigi/what_the_hack

Repository files navigation

What_the_Hack

Have you ever wondered what "White Hat Hacking" is all about? Try it yourself as the head of a white hat hacking company in What the Hack! Get started by hiring your first employee, buy your first computer and accept one of many generated missions. But it's not as easy as it sounds - each employee has it's strengths and weaknesses, so be sure to find the perfect mission for your team. While playing the game you'll learn a lot about IT security, hacking and prevention of cyber attacks.

What the Hack is a modular game. Creating extensions is easy with the free Unity Editor. Have a look at section Mod Development for more information.

Features

  • What the Hack is a platform
    • Support for all kind of different extensions! (called Mods)
    • Multiple difficulties: game content for everyone
    • Interactive missions that test your knowledge
  • Base Game
    • The base game ships with a special employee and basic missions about IT-security
  • Two game modes: Classic and Realtime!
    • Classic: Just as every other game. Start it and enjoy! Automatic saving is included.
    • Realtime: Even when you close the game, the game time passes. Without draining your battery. You’ll get notifications when your employees need your assistance!

Download

Main Game

Android: Download v1.0.4

Linux: Download v1.0.4

macOS: Download v1.0.4

Windows: Download v1.0.4

Java Cryptography Extension Addon

Desktop: Download v1.0

Android: Download v1.0

Source: GitHub Repository

Development

Mod Creator: Download UnityPackage v1.0.4

Mod Assets: Download UnityPackage v1.0

Template for Addon-APK: GitHub Repository

Installing a mod

Addon-Apps on Android

On Android you can install special Addon-Apps, that contain extensions for What the Hack!

Manual

Mods are served as a zip file and contain a folder which needs to be copied to specific locations depending on your operating system.

  • Android: Android/data/com.github.geigi.wth/files/Mods/ (on external storage or SD card)
  • Linux & macOS & Windows: Mods directory side by side with the executable

Development

Requirements

Whether you want to contribute to the source code or you want to create a mod, the only thing you'll need is Unity v2018.3.7f1.

Important: You must use this exact version of Unity because What the Hack can only load Mods that are compiled with the same version as the base game.

Components

There are three main components:

  • The Main Game Unity project which is located in this directory.
  • The Wth.ModApi and Wth.ModApi.Editor assemblies contain the addon API. They are located in the Assets/Wth.ModApi folder.
  • The AndroidPlugin Android Studio project which is located in the AndroidPlugin folder. It handles the installation and deinstallation of addon apps.

Getting the project started

  1. Clone the repository
  2. Open Unity and the project folder ./

Mod Development

How far can I go?

What the Hack allows all kinds of changes to the game. Each mod will be it's own game mode with unique names, employees, skills and missions. This allows you to create a mod with very specific learning content as well as new gameplay aspects. None of those modifications are mandatory. Here is a list of possible modifications:

  • Create a specific set of skills (this is required for any of the following modifications)
  • Create unique employees with custom sprites
  • Create missions with custom actions for the player
  • Create unique names that are used for employees and for placeholders in missions
  • Implement multiple difficulty levels

Getting Started

  1. Before you create a mod, have a look at the development requirements.
  2. After installing Unity, create a new Unity Project and drag the What_the_Hack Mod Tools.unitypackage into the Editor. This package contains the API as well as the GUI tools to create new mods.
  3. If you want to create interactive missions: Drag the What the Hack Mod Assets.unitypackage into the Editor. This contains prefabs for commonly used UI items like buttons, dropdowns, toggles, scroll views and all of the official sprites and fonts.
  4. Create a ModInfo Scriptable Object: Assets > Create > What_The_Hack ModApi > Mod Info. Each mod requires a unique ID and a banner image with the resolution 400*182. This scriptable object will be the gathering point for your content. If some content is missing when loading the mod, it probably isn't included in the ModInfo.
  5. Get started by using the custom Employee, Skill, Mission and Name Creator GUIs which can be found under Tools > What_The_Hack ModApi.
  6. All the content you generate from the Creators are stored in Assets/Data.

Creating missions (and other content)

This chapter describes how to create custom missions. Creating Skills, Employees or Names is very similar to creating missions. Therefore there won’t be a section for each of the possible modifications.

  1. If you want to create custom missions, you first have to create a skill set in the Skill Creator. The missions you define use the skills from your custom skill set. If you want to use the default skill set, you can download it from this repository: Assets/Data/Skills.
  2. Create a new mission list from the Mission Creator.
  3. Click on your ModInfo file and drag the freshly generated MissionList from Assets/data into the according field of the ModInfo. Otherwise your missions won’t load in What the Hack.
  4. Add a new mission in the Mission Creator.
  5. Don’t forget to hit the Save button when you modified your missions.

Creating a interactive mission

Interactive missions have so called MissionHooks that define a interaction. Each mission can have multiple hooks. Each hook contains a GUI Prefab that will be displayed, as soon as the user opens the interaction window in the game. You can specify at which progress level a hook will be spawned.

Each interaction has only two outcomes: Success or Fail.

  • Create a new MissionHook object: Assets > Create > What_The_Hack ModApi > Missions > MissionHook
  • Define the spawn time in the inspector.
  • Find the HookTemplate from the What the Hack Mod Assets in Assets/Prefabs/ and duplicate it.
  • Open the prefab. You will see the UI in the Scene view of Unity. Remove the demo buttons from the scene graph.
  • You can now create your own UI. Use the Elements you find in the Assets/Prefabs/ folder.
  • The GUI is now created, but it doesn’t contain any logic. You have to report whether the interaction has finished successfully or not. If you use a simple dropdown or toggles to ask the user a question, you can use the included and generic Verifier Components from the Mod API: DropdownHookVerifierand ToggleHookVerifier. Attach one of those components to the root object of your prefab.
  • If you want to create a more complex interaction, you can also write your own code. To do this, create a new Script. Instead of inheriting from MonoBehaviour, you must inherit from ModBehaviour. You can use this class like any MonoBehaviour. If you forget to use MonoBehaviour you won’t be able to export the mod.
    • Implement your desired logic. When the interaction is completed and you want to report the success/failure, you need the MissionHook object that contains this interaction. Just add it as a public variable and assign it in the inspector. To report success call Hook.RaiseSuccess(), for failure call Hook.RaiseFailure().
    • Below you find a reference example:
public class DropdownHookVerifier : ModBehaviour
{
    public Button OkButton;
    public Dropdown Dropdown;
    public MissionHook Hook;
    public List<int> ValidOptions;

    private void Start()
    {
        OkButton.onClick.AddListener(Verify);
    }

    private void Verify()
    {
        if (ValidOptions.Contains(Dropdown.value))
            Hook.RaiseSuccess();
        else
            Hook.RaiseFailed();
    }

    private void OnDestroy()
    {
        OkButton.onClick.RemoveListener(Verify);
    }
}
  • Now you have to assign your prefab to the MissionHook object you created at the beginning. Do this in the inspector.
  • Finally, you have to add your MissionHook to your mission. To do this, open the Mission Creator and add your hook.

Exporting a mod

  • To export your mod, go to Tools > ModTool.
  • Define a mod name, author, description and version number. Also select, for which platforms you want to export the mod.
  • Finally select the content you want to export. What the Hack doesn’t support custom Scenes. Therefore you can deselect them. Also deselect Code if you didn’t create any custom code. Otherwise the mod will not work properly.
  • Set a output directory.
  • Hit Export!

If saving and loading a game doesn’t work

Each ScriptableObject you define (the files in the Assets/Data folder) need to be referenced in a ScriptableObjectDictionary. This file is created automatically and also managed automatically by the Creator windows. If something goes wrong have a look at this dictionary and whether every ScriptableObject from your mod is included here. Otherwise open the according Creator and click Save. This should fix the problem in most cases.

Known bugs

  • Game does not open when tapping on a notification (Android). This is a bug in the Unity Mobile Notifications package.

Cheers to the original creators! ❤️

Special Thanks 🎉

Third party libraries

The following third party libraries are used by this game:

Libraries by Unity3D:

Other Libraries

WTH contains code based on projects

Sounds

sf3-sfx-menu-select.wav by broumbroum freesound.org

Fonts

http://www.zone38.net/font/