The Gods Must be Crazy

Game Description

The Gods Must be Crazy is a single player game where players have the objective of destroying life in the solar system by engaging with a simple solar physics system of frictionless motion in space which is guided by gravity of several celestial bodies. Each level provides new solar systems with their unique hurdles for the player to overcome. The human population spreads in a pattern where once a planet is filled with people, a spaceship is launched to spread life within that solar system. If no more planets are left to inhabit, then the spaceship will leave the solar system, meaning that the player has lost. The tools in the player's arsenal to stop them are meteors and solar flares. Meteors can be launched from a meteor field by selecting a direction and some speed. These use up higher energy from the “divine power” bar as compared to solar flares, but have higher damage. Solar flares are fired from the sun to the point where the player right-clicks.

Programming Challenges

Making a game in 48 hours presents the most obvious challenge - to overcome one’s own stupidity. The mistake I made during developing this game was with the collision detection system which lead to many wasted hours debugging the problem. At some point I had to give up on tweaking the collision detection system and concede that it would do for now. It was only after the game jam was finished that I figured out the bug in the system, which related to the incorrect assumption made about XNA sprite origin and their position.

Features

  • 2D rendering engine written in C# and based on XNA Framework’s component system
  • Circle based collision detection system
  • Simulation of object motion in space
  • Text based level editor
  • Menu system

Video

Screenshots

Code Sample

The Draw method in the game's root class merely delegates all entities in its component list as shown in the snippet below:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.Black);

    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);

    // Draw all the menus
    if (menusRunning)
    {
        foreach (MenuWindow currentMenu in menuList)
            currentMenu.Draw(spriteBatch, ScreenWidth, ScreenHeight);
    }
    else if (endGame)
    {
        Texture2D screen = winState ? Content.Load<Texture2D>("EndScreenWin") : Content.Load<Texture2D>("EndScreenLose");
        spriteBatch.Draw(screen, new Rectangle(0,0,ScreenWidth, ScreenHeight), Color.White);
    }
    else
    {
        spriteBatch.Draw(TextureBackgroundMenu, new Rectangle(0, 0, GalaxyGame.ScreenWidth, GalaxyGame.ScreenHeight), Color.White);

        if (drawOrbit)
        {
            DrawPath(currentState.X, currentState.Y, 1f);
        }

        // Get sorted list so UpdateOrder also defines render order
        IEnumerable<GameComponent> sortedComponents = Components.Cast<GameComponent>().OrderBy(gameComponent => gameComponent.UpdateOrder);
        foreach (CelestialObj gameObject in sortedComponents)
        {
            if (gameObject != null)
            {
                gameObject.Draw(spriteBatch);
            }
        }

        for (int i = 0; i < ExplosionLocations.Count; i++)
        {
            Rectangle dest = new Rectangle((int)ExplosionLocations[i].X, (int)ExplosionLocations[i].Y, 64, 64);
            Rectangle source = new Rectangle((int)(CurrentKeyTime[i] / keyTime) * 64, 0, 64, 64);
            spriteBatch.Draw(explosion, dest, source, Color.White);
        }

        hud.Draw(spriteBatch);
    }

    spriteBatch.End();

    base.Draw(gameTime);
}

Download

Click here to dowload the latest version of the game

Installation Instructions:

  • Extract the downloaded file, and run setup.exe