Skip to content

mcgivrer/fromClassToGame

Repository files navigation

fromClassToGame

Java CI with Maven Codacy Quality Badge CodeQL FOSSA Status Known Vulnerabilities Codacy Coverage Badge Cucumber Reports OpenHub

Description

This project is a journey from a Class to a Game. First commits will set the basis, and progressively transform, chapter after chapter, the initial class into a playable game.

During the chapters from the docs/ you will transform the simple Game class from beginning to a package structured framework with some useful features to support object management and display, and just now how to organize the code in a project, using a bit of TDD to develop and refactor

Latest evolution

Added some valuable features like:

  • A Core Game class,
  • A standard central GameObject,
  • an InputHandler to capture player interaction
  • A ResourceManager service,
  • A SceneManager service,
  • A SystemManager and convert any service to System interface,
  • Implement a Render upon Graphics2D and RenderHelper,
  • Some fancy other objects like TextObject, LifeObject or ScoreObject,
  • A Camera to move view with following a specific target,
  • A PhysicEngine to compute more realistic moves,
  • Some Behavior capability to GameObject,
  • A Map of attributes to GameObject
  • A new InventoryObject to manage a player inventory with its own renderer helper and behavior,
  • Bring the RenderingHelper mechanism to easily extend the Render capability,
  • A evolution of the PhysicEngine by adding InfluenceArea2d bringing some perturbation to the World,
  • Adding Particle and ParticleSystem to create special effects like rain and fire,
  • Replace the good old InputHandler by an ActionHandler (WIP) to support input command mapping,
  • Add a DebugViewportGrid object and its rendering helper.

More to come

  • A CollisionSystem is a work in progress
  • Some TileMap object to display beautiful game level graphic set and all its dependencies (Tile, TileSet and TileLayer) are also work in progress !
  • A Mouse and Gamepad events integration to rules'em all !

Build, Run and See

How to build

To build the project, the good maven command is :

mvn clean install

Starting test

To execute test verification, using a bunch of cucumber tests :

mvn test

Running the beast

And finally, to run such a beautiful piece of code :

mvn exec:java

You will get the current display:

screenshot - DemoScene with objects

This sample demo will show :

  1. Some GameObject as player (the red one), and some random spawning enemies (orange ones),
  2. the ScoreObject, displaying score (sic),
  3. the LifeObject showing the remaining number of life,
  4. the InventoryObject, showing a qick inventory to select an available item.

The latest demo integrate the Fire ParticleSystem and the InfluenceArea2d world perturbation

screenshot - the latest evolution of the game framework with ParticleSystem and World InfluenceArea2d

Have Fun !

McG.

SnapGames
SnapGames Logo