flame

package module
v0.0.0-...-ac9a988 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: GPL-2.0 Imports: 8 Imported by: 9

README

Introduction

Flame is RPG game engine written from scratch in Go.

The main goal is to create simple, flexible, extensible and completely modular game engine.

Flame is able to create all game objects from textual data, this guarantees that game data is easy to modify and extend.

This repository contains engine core API, which allows to load game module data from textual format, create and modify game objects, and export game module data back into textual format(ie. basic game flow load game -> play -> save game).

Easiest way to create a game with Flame is to download some graphical or textual fronted(like Mural or Burn Shell) and create module or use some existing one.

Flame modules are available for download here.

The project idea is based on Senlin game engine.

Currently in an early development stage.

Flame as a project consists with many different repositories, some of them are independent and can be reused in other projects:

  • Flame - engine core API
  • Burn - commands interpreter with it's own scripting language Ash for creating cutscenes etc.
  • Fire - TCP server that enables creating multiplayer games
  • Ignite - AI program for the Fire server
  • Burnsh - textual fronted(CLI)
  • Mural - graphical fronted(2D GUI)
  • MTK - simple graphical toolkit
  • Stone - simple library to render Tiled maps
  • Arena - example Flame module

Example games:

Arena

Simple demo game based on Arena module with Mural GUI support.

Download: Linux, macOS, Windows

OpenElwynn

2D Game that recreates the Elwynn Forest area from WoW, with multiplayer support.

Download: Linux, macOS, Windows

Repository: GitHub

Usage

You can find usage examples in example package.

Modules

Modules contain all game data in the form of textual files. Modules are divided into chapters, that's contains chapter-specific data.

Modules are stored by default in data/modules directory.

Module data are available across all chapters, data files are placed in sub-directories(/items, /characters, etc.) in the module directory.

Chapter data are available only when a specific chapter is active, data files are placed in sub-directories(/characters, /dialogs, etc.) in chapter directory(in [module]/chapters).

Translation files are placed in /lang directory both for modules and chapters.

The example module is available here.

Documentation

Source code documentation can be easily browsed with go doc command.

Documentation of configuration files and data structures in the form of Troff pages is available under doc directory.

You can easily view documentation pages with man command.

For example to display documentation page for character data structure:

man doc/characters

Note that documentation of data structures is still incomplete.

Contributing

You are welcome to contribute to project development.

If you looking for things to do, then check TODO file or contact maintainer(ds@isangeles.dev).

When you find something to do, create a new branch for your feature. After you finish, open a pull request to merge your changes with master branch.

Contact

License

Copyright 2018-2023 Dariusz Sikora <ds@isangeles.dev>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Documentation

Overview

flame package provides structs for module and chapater.

Index

Constants

View Source
const (
	Name, Version = "Flame", "0.1.0-dev"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chapter

type Chapter struct {
	// contains filtered or unexported fields
}

Chapter struct represents module chapter.

func NewChapter

func NewChapter(mod *Module, data res.ChapterData) *Chapter

NewChapter creates new module chapter.

func (*Chapter) AddAreas

func (c *Chapter) AddAreas(areas ...*area.Area)

AddAreas adds specified areas to loaded areas list.

func (*Chapter) Apply

func (c *Chapter) Apply(data res.ChapterData)

Apply applies specified data on the chapter. Also, adds chapter resources to resources base in res package.

func (*Chapter) Area

func (c *Chapter) Area(areaID string) *area.Area

Area returns area with specified ID, or nil if area with such ID was not found. Loads area if area with specified ID was not requested before.

func (*Chapter) AreaObject

func (c *Chapter) AreaObject(id, serial string) area.Object

AreaObject retruns area object with specified ID and serial or nil if no object was found.

func (*Chapter) AreaObjects

func (c *Chapter) AreaObjects() (objects []area.Object)

Objects returns list with all area objects from all loaded areas.

func (*Chapter) Areas

func (c *Chapter) Areas() (areas []*area.Area)

Areas returns all active(loaded) areas.

func (*Chapter) Character

func (c *Chapter) Character(id, serial string) *character.Character

Character returns existing game character with specified serial ID or nil if no character with specified ID exists.

func (*Chapter) Characters

func (c *Chapter) Characters() (chars []*character.Character)

Characters returns list with all existing(loaded) characters in chapter.

func (*Chapter) Conf

func (c *Chapter) Conf() *ChapterConfig

Conf returns chapter configuration.

func (*Chapter) Data

func (c *Chapter) Data() res.ChapterData

Data creates data resource for chapter.

func (*Chapter) ID

func (c *Chapter) ID() string

ID returns chapter ID.

func (*Chapter) Module

func (c *Chapter) Module() *Module

Module returns chapter module.

func (*Chapter) ObjectArea

func (c *Chapter) ObjectArea(ob area.Object) *area.Area

ObjectArea returns area where specified area object is present, or nil if no such area was found.

func (*Chapter) Resources

func (c *Chapter) Resources() *res.ResourcesData

Resources chapter resources.

func (*Chapter) Update

func (c *Chapter) Update(delta int64)

Update updates chapter.

type ChapterConfig

type ChapterConfig struct {
	ID          string
	Path        string
	StartArea   string
	StartPosX   float64
	StartPosY   float64
	StartItems  []string
	StartSkills []string
	StartAttrs  int
	StartLevel  int
}

Struct for chapter configurtion values.

func (ChapterConfig) AreasPath

func (cc ChapterConfig) AreasPath() string

AreasPath returns path to chapters areas directory.

func (ChapterConfig) CharactersPath

func (cc ChapterConfig) CharactersPath() string

CharactersPath returns path to chapter characters directory.

func (ChapterConfig) DialogsPath

func (cc ChapterConfig) DialogsPath() string

DialogsPath returns path to chapter dialogs directory.

func (ChapterConfig) FullPath

func (cc ChapterConfig) FullPath() string

FullPath returns path to chapter directory.

func (ChapterConfig) LangPath

func (cc ChapterConfig) LangPath() string

LangPath returns path to chapter lang directory.

func (ChapterConfig) ObjectsPath

func (cc ChapterConfig) ObjectsPath() string

ObjectsPath returns path to chapter objects directory.

func (ChapterConfig) QuestsPath

func (cc ChapterConfig) QuestsPath() string

QuestsPath retruns path to chapter quests directory.

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module struct represents game module.

func NewModule

func NewModule(data res.ModuleData) *Module

NewModule creates new game module from specified data.

func (*Module) AddChangeChapterEvent

func (m *Module) AddChangeChapterEvent(event func(char *character.Character))

AddChangeChapterEvent adds function to trigger when chapter change is required.

func (*Module) Apply

func (m *Module) Apply(data res.ModuleData)

Apply applies specified data on the module. Also, adds module resources to resources base in res package.

func (*Module) Chapter

func (m *Module) Chapter() *Chapter

Chapter returns current module chapter.

func (*Module) Conf

func (m *Module) Conf() *ModuleConfig

Conf returns module configuration.

func (*Module) Data

func (m *Module) Data() res.ModuleData

Data creates data resource for module.

func (*Module) Object

func (m *Module) Object(id, serial string) serial.Serialer

Object returns game object with specified ID and serial or nil if no such object was found.

func (*Module) Resources

func (m *Module) Resources() *res.ResourcesData

Resources returns module resources.

func (*Module) SetChapter

func (m *Module) SetChapter(chapter *Chapter)

SetChapter sets specified chapter as current chapter.

func (*Module) Update

func (m *Module) Update(delta int64)

Update updates module.

type ModuleConfig

type ModuleConfig struct {
	ID      string
	Path    string
	Chapter string
}

ModuleConfig struct represents module configuration.

func (ModuleConfig) ChaptersPath

func (c ModuleConfig) ChaptersPath() string

ChaptersPath returns path to module chapters.

func (ModuleConfig) CharactersPath

func (c ModuleConfig) CharactersPath() string

CharactersPath returns path to directory for exported characters.

func (ModuleConfig) EffectsPath

func (c ModuleConfig) EffectsPath() string

EffectsPath returns path to directory with effects bases.

func (ModuleConfig) ItemsPath

func (c ModuleConfig) ItemsPath() string

ItemsPath returns path to directory with items bases.

func (ModuleConfig) LangPath

func (c ModuleConfig) LangPath() string

LangPath returns path to lang directory.

func (ModuleConfig) ObjectsPath

func (c ModuleConfig) ObjectsPath() string

ObjectsPath returns path to directory with area objects bases.

func (ModuleConfig) RacesPath

func (c ModuleConfig) RacesPath() string

RacesPath returns path to directory with races data files.

func (ModuleConfig) RecipesPath

func (c ModuleConfig) RecipesPath() string

RecipesPath returns path to directory with recipes base.

func (ModuleConfig) SkillsPath

func (c ModuleConfig) SkillsPath() string

SkillsPath returns path to directory with skills base.

Directories

Path Synopsis
Package with game area struct.
Package with game area struct.
character package provides game character struct and other types for game characters.
character package provides game character struct and other types for game characters.
Package for crafting structs.
Package for crafting structs.
Package with functions for importing/exporting data files and directories.
Package with functions for importing/exporting data files and directories.
res
res/lang
Package for easy retrieval of translation data.
Package for easy retrieval of translation data.
Package for effects.
Package for effects.
example
character/move
Example for moving module character.
Example for moving module character.
game
Example of loading module and creating game.
Example of loading module and creating game.
Package with engine log.
Package with engine log.
Package with utils for module objects.
Package with utils for module objects.
Package for requirements(e.g.
Package for requirements(e.g.
Package for random number generator.
Package for random number generator.
Package for generating unique serial values for game objects.
Package for generating unique serial values for game objects.
Package for skill structs.
Package for skill structs.
Package with training structs.
Package with training structs.
Package with use action struct for usable objects.
Package with use action struct for usable objects.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL