kgress 0.0.1 copy "kgress: ^0.0.1" to clipboard
kgress: ^0.0.1 copied to clipboard

outdated

RPG type stuff on an app

Introduction #

Some code to help me make an RPG like game in a phone app. This project is built on top of the Flame Flutter Game engine.

IMPORTANT #

This project is still very much under development. Documentation below is not yet fully completed!

Getting Started #

Examples #

You can run the examle game by changing main.dart to the following:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:kgress/example/world/example_game_world.dart';
import 'package:kgress/game/world/container/cupertino_game_container_app.dart';

//  Run the example game
runApp(CupertinoGameContainerApp(ExampleGameWorld()));

Game Tools #

KGRESS comes with tooling to allow you to preview areas in your game. You can switch to using these tools by updating the main.dart to the following:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:kgress/game/tools/cupertino_game_tool.dart';

//  Run the game editor tool
GameCartridge exampleGame = GameCartridge(
  areas: List.from([
    exampleArea,
    mainArea,
    trainingArea
  ]),
  elementDrawerRepo: ExampleElementDrawerRepository()
);
runApp(CupertinoGameToolsApp(exampleGame));

Elements #

Elements are characters/things on the screen. They are everything from NPCs to your character to tiles on the floor.

Definining an Element Kind #

Element kinds come in various flavours. For example, this defines a floor tile:

ElementKind decorativeTile = StationaryObjectKind(name: "Fancy Floor Tile", stationaryImage: greenGrayTile);

Adding an Element #

You add an element to an area in the game by using its element kind:

  Area currentArea = Area(10, "Test Area");

  AreaForEdit editor = AreaForEdit(currentArea);
  editor.fill(floorTile, layer: 0);

  editor.add(decorativeTile, 0, 0);

The code above adds your new "decorative tile" to the top corner of the area.

Adding movement and actions #

You can specify some actions for an element you want to add to a scene by using a variation on the code for adding an element.

  Area currentArea = Area(10, "Test Area");

  AreaForEdit editor = AreaForEdit(currentArea);
  editor.add(nonPlayerCharacter, 10, 10, actionSetActions: backAndForthActions);

The code above adds an element of kind "nonPlayerCharacter" to the area and gives it actions to execute.

Architecture #

Overarching Architecture #

Gameworld #

Elements #

Elements (things on the screen in an area of the game) have element kinds, which fall under over-arching element types.

Imagesets #

Imagesets provide canned frame sets for drawing elements on the screen. Elements can thus be added to a scene without your needing to worry about how they will be rendered.

Game Cartridges #

Relationship between the Game Cartridge and Components in a Game

Actions #

Tooling #