An entity and spell system c++ godot engine module, for complex (optionally multiplayer) RPGs.
Go to file
2020-07-29 18:27:45 +02:00
data Cleaned up SpellDamageInfo and SpellHealInfo. 2020-07-29 18:27:45 +02:00
database Removed XPData. 2020-07-10 17:17:15 +02:00
doc_classes Sync classref with current source. 2020-06-20 23:34:32 +02:00
drag_and_drop Also update ESDragAndDrop to use resource paths. 2020-04-19 18:22:05 +02:00
editor Added an editor plugin to be able to add a few tools into the tools menu. Disabled for now/. 2020-04-13 19:15:07 +02:00
entities Added a body changed signal, and a vmethod to Entity. 2020-07-29 15:21:29 +02:00
formations Centralized most of the 4.0 port code into a new header. 2020-05-22 20:48:08 +02:00
infos SpellCastInfo, EntitySkill, EntityResource, EntityDataContainer, and ItemInstance are now Resources, so Godot will be able to serialize them with Entity. 2020-06-13 18:33:51 +02:00
inventory comvert quite a few more getters/setters to the newer style. 2020-06-05 19:40:53 +02:00
pipelines Cleaned up SpellDamageInfo and SpellHealInfo. 2020-07-29 18:27:45 +02:00
profiles Centralized most of the 4.0 port code into a new header. 2020-05-22 20:48:08 +02:00
projectiles/3d Centralized most of the 4.0 port code into a new header. 2020-05-22 20:48:08 +02:00
props Added in PropDataEntity from the Props module. 2020-07-06 22:27:28 +02:00
singletons Now the ESS singleton stored xp data aswell. They can be found in the project settings. 2020-07-10 16:55:35 +02:00
skeleton Moved the 3D skeleton implementation into the 2D one. 2020-07-09 00:26:20 +02:00
spawners Added a new class ESSEntitySpawner. It is a resource. This will make setting up entity spawning a lot less painful. Also the module will be able to contain a few built in solutions. An instance is available from the ESS singleton (can be set, or loaded/automatically loaded). Also fixed a few smaller issues with saving/loading. 2020-04-18 14:31:36 +02:00
utility Now Entity only has one level property instead of separate class and character levels. Updated notifications accordingly. 2020-07-10 15:24:14 +02:00
.gitignore Now the module can be built as a shared library. This doesn't work on windows (at least it didn't a while ago when I tried it). 2020-01-03 15:52:26 +01:00
config.py Removed XPData. 2020-07-10 17:17:15 +02:00
config.pyc The bag is now scriptable. 2019-08-14 15:52:23 +02:00
defines.h 4.0 compile fix. 2020-06-20 22:36:31 +02:00
entity_enums.cpp Also add common points for shields. 2020-06-16 18:43:21 +02:00
entity_enums.h Also add common points for shields. 2020-06-16 18:43:21 +02:00
item_enums.cpp TextureLayers are now customizable. 2020-05-21 21:20:56 +02:00
item_enums.h TextureLayers are now customizable. 2020-05-21 21:20:56 +02:00
LICENSE Updated the license header for 2020, also added the license text to the top of the c++ files. Removed a now unneeded, unused file. 2020-01-31 19:34:47 +01:00
README.md Added a pre-built binaries section. 2020-07-28 15:28:53 +02:00
register_types.cpp Removed XPData. 2020-07-10 17:17:15 +02:00
register_types.h Updated the license header for 2020, also added the license text to the top of the c++ files. Removed a now unneeded, unused file. 2020-01-31 19:34:47 +01:00
SCsub Removed XPData. 2020-07-10 17:17:15 +02:00
spell_enums.cpp The diminishing return categories are now customizable. 2020-06-06 18:06:30 +02:00
spell_enums.h The diminishing return categories are now customizable. 2020-06-06 18:06:30 +02:00

Entity Spell System

An entity and spell system for the GODOT Engine, that is usable for both 2d, and 3d games. The main purpose of this module is to handle spells, auras, and most entity-related things like spawning, items, inventory, contaiers, vendors, interaction, targeting, equipment (+ visuals), loot, crafting, talents, pets, npcs, etc ...

The module supports networking. It is designed to be authoritative, so players shouldn't be able to cheat by design.

It is a c++ engine module, which means you will need to compile it into godot. (See compiling)

It supports both godot 3.2 and 4.0 (master). Note that since 4.0 is still in very early stages I only check whether it works from time to time.

What the module doesn't cover

Movement, and controls.

Unfortunately, there isn't a one-stop-shop solution for movement, especially if we throw networking into the mix, and the same is true for targeting. This means that this module cannot really do much in this regard, but it will give you as much help to set everything up as possible.

Optional Dependencies

Mesh Data Resource

https://github.com/Relintai/mesh_data_resource.git

Adds mesh support to ModelVisuals. This is exists because in gles2 mesh data cannot be accessed directly from ArrayMeshes.

Pre-built binaries

You can grab a pre-built editor binary from the Broken Seals repo, should you want to. It contains all my modules.

Overview

The module provides a huge number of script callbacks, usually as virtual methods they usually start with an underscore.

Do not call methods with underscores, all of them has a normal counterpart, always call that.

For example entity has crafts(int id) and _crafts(int id) (virtual). Always use crafts(int id), it will call _crafts(int id).

For networked classes, every variable is broken up into clientside, and serverside. This makes it easier to develop games that can also run locally, with less overhead and simpler logic. E.g. this makes it easy to use the visibility system even when you play locally on the server, because you just use the clientside variables, and your logic will work the same way.

Entity

This is the main class that can be used for players/mobs/npcs and also other things like chests.

I ended up merging subclass functionality into it, because that way it gains a lot more utility, by sacrificing only a small amount of memory. For example this way it is easy to make chests attack the player, or make spell that animate objects.

Spawning

Since spawning (= creating) entities is entirely dependant on the type of game you are making, ESS cannot do everything for you. It will set up stats, equipment etc, but there is no way to set up positions for example.

You can implement your spawning logic by inheriting from ESSEntitySpawner, and implementing _request_entity_spawn.

You will need to register this spawner into the ESS singleton, either by using setup(resource_db, entity_spawner), or by using the provided property/setter entity_spawner/set_entity_spawner().

The ESS singleton also contains convenience methods to request spawning an Entity.

EntityCreateInfo

Entity spawning usually requires a lot of complexity and hassle, this helper class aims to make it painless.

All methods that deal with spawning will take this as a parameter.

EntityData

Since setting up Entities as scenes is usually quite the hassle, EntityData had to be created.

It stores everything an entity needs.

In order to spawn an entity you need it.

AI

You can implement ai by extending EntityAI, and then assigning it to an EntityData.

When an Entity gets spawned it will create a copy for itself, so you can safely use class variables.

Bags

Stores item. See Bag. It has aquite a few virtual methods, you should be able to implement most inventory types should you want to.

Entity will send these over the network.

Also Entities have a target bag property. For example this makes vendors easily implementable.

VRPCs

Entities has a networked visibility system. The method itself is called vrpc, it works the same way as normal rpcs. If you want to send data to every client that sees the current entity, use this.

Spells, Auras

Spell is the class you need to create spells, it stores the data, and also it has the ability to be scripted.

Aura is also built the same way as spells.

Infos / Pipelines

SpellCastInfo

Stores information about the state of a spell's cast.

AuraApplyInfo

Helps to apply auras

SpellDamageInfo, SpellHealInfo

These are used in the damage and heal calculation. For example these can be used to implement immunities, or absorb effects by modifying their damage values in aura callbacks.

Examples

Eventually I'll create a separate repository with a few examples/demos, but for now you can check the game I've been working on for examples.

For 3d: https://github.com/Relintai/broken_seals.git

For 2d: https://github.com/Relintai/broken_seals_2d.git

Compiling

First make sure that you can compile godot. See the official docs: https://docs.godotengine.org/en/3.2/development/compiling/index.html

  1. Clone the engine if you haven't already:

If you want Godot 3.2: git clone -b 3.2 https://github.com/godotengine/godot.git godot

If you want Godot 4.0: git clone https://github.com/godotengine/godot.git godot

  1. go into the modules folder inside the engine's directory"

cd godot cd modules

  1. clone this repository

git clone https://github.com/Relintai/entity_spell_system.git entity_spell_system

(the folder needs to be named entity_spell_system!)

  1. Go up one folder

cd ..

  1. Compile godot.

For example:

scons p=x11 t=release_debug tools=yes

TODO

Add to readme: Loot, Species, cds, categ cds, items (crafting etc), Xp, levelling, Stats, drag and drop, talents, vendors, Skills, Profiles, Projectiles, Singletons, Skeleton, Global enums resourcedb