Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InteractivePawn should trigger actions when the player presses a key or touches it #115

Closed
NathanLovato opened this issue Dec 10, 2018 · 8 comments
Assignees
Labels
enhancement New feature or request game design

Comments

@NathanLovato
Copy link
Contributor

They shouldn't have a "facing" dictionary either with up to 4 active directions at a time. To interact with an NPC, the player should have to:

  • tap on it in touch mode
  • press an action key on the keyboard or the controller

And automatic trigger upon walking in an area around the pawn should work differently: it should have some trigger area or something.

@NathanLovato NathanLovato added enhancement New feature or request game design labels Dec 10, 2018
@GraphicEdit
Copy link

Can I get Godot 3.1 ?

@guilhermehto
Copy link
Contributor

What do you mean, @GraphicEdit ?

@GraphicEdit
Copy link

I have 3.0.6 but I need 3.1 right?

@guilhermehto
Copy link
Contributor

Yes, this project is developed using Godot 3.1, which currently is in Alpha stage

@guilhermehto
Copy link
Contributor

The goal for the issue is to add another function that will allow the player to start an interaction when he wants to? This way, the pawns can either auto start the interaction or wait for player input?

Regarding the "facing", it's just another option that was added in case we want the NPC's to only trigger interactions from a given direction. The distance for the interaction can also be increased if needed. There's already support for Area2D triggers that don't rely on ray casts. Want to remove them anyway?

@guilhermehto guilhermehto self-assigned this Dec 10, 2018
@GraphicEdit
Copy link

How Can I get it (Godot 3.1),?

@NathanLovato
Copy link
Contributor Author

NathanLovato commented Dec 10, 2018

This way, the pawns can either auto start the interaction or wait for player input?

Yes, and now it should support touch (tapping on the cell where an NPC is)


@GraphicEdit https://godotengine.org/article/dev-snapshot-godot-3-1-alpha-2
You can find the link quickly on any search engine. This is not the place to get support, please use Discord or something next time.

@GraphicEdit
Copy link

ok.. Thanks..

guilhermehto added a commit to guilhermehto/godot-turn-based-rpg that referenced this issue Dec 11, 2018
By getting near the pawn, a small balloon will show, allowing the player to press `ui_accept` to start the interaction. They can be started automatically by setting `auto_start_interaction` to `true`. Works with both Area2D triggers and the raycasts.

For the touch, it was already working as far as I could tell.

Closes gdquest-demos#115
food-please pushed a commit to food-please/godot4-open-rpg that referenced this issue Apr 5, 2023
Add Godot 3.1 project, update readme

Add gitignore

Add start battler, combat action, turn queue and combat scenes

Add battler animation

Add interface, theme, lifebars

Add working turn loop and turn queue

Create a base BattlerAnim class for animated battlers

Add lifebars and make turn base combat work, with characters attacking automatically

Add target position so battlers don't overlap their opponent when they attack

Fix #2 bar receiving damage taken instead of new health

Add play_death function and rename stagger -> play_stagger on BattlerSkin and BattlerAnim

Make sub nodes accessible from the Job node

Make battlers die on health depleted, make them unselectable

closes gdquest-demos#3

Add character classes/jobs as resources

Only contains starting stats at the moment

Make the Job node and stats use the StatingStats Resources

Make battlers use the Attack CombatAction class

Update battlers to use the two different starting character stats resources

Add battle win/losing condition, closes gdquest-demos#5

Add speed characteristic to the battlers

Sort battlers in the TurnQueue based on their speed, closes gdquest-demos#10

Add the SelectArrow, to select targets on the battlefield

Remove initialize call on ready in TurnQueue

Remove print call

Allow the player to select a target to attack, closes #1

Make the SelectArrow face the target and move smoothly between targets

Add texture slot to the CombatAction - icon for the UI

Add appear animation on BattlerSkin

Move party detection away from global state (tree and groups)

closes gdquest-demos#11

Add battle intro animation sequence

Closes gdquest-demos#9

Remove Battlers from node groups

Fix direction of the SelectArrow and Battler target_global_position

Remove print call in TurnQueue

Add shader-based animated transition effect

Add combat start transition, move run scene to Game.tscn

closes gdquest-demos#8

Update readme

Add a link to the contributor's guide on GDquest

Fix job node duplicating itself with the tool mode

Renaming the job node in the editor on child scenes doesn't work, we'll need another solution like drawing in the viewport

Refactor initialize loop and getting battlers

Add note about static typing in Godot 3.1

Add a note about refactoring from the maintainers

Add the initial game concept, part of gdquest-demos#13

Clarify the story

added function that will chose opponent following some rules, see commit comment

Update the readme, write about characters and a little bit about combat

Part 2 of gdquest-demos#13

Skills system added

It's now possible to add skills as resources and use them in combat.
Some changes:

- Initial stats now have mana
- A combat action for skills has been added
- A really simple menu to select which action to perform in the given
turn
- Resource for skills
- Skills can be executed on a given chance

What can be improved:
- As of now, the skills have a `base_damage` which is added on top of the
already calculated damage in the `Hit` script. We might want to use the
strength as a multiplier to increase the overall damage of the skill,
for instance, instead of just adding them together.

- The menu for selecting the action is really simple and the UX is bad
to say the least. I'll create a separate issue for this.

- Skills are only available as a form of attack, i.e. you can't create
healing skill with the current system. But it can be extended to do so.

- They are not specific to jobs. For instance, both Dan and Blue are
fighters, but you'll have to add skills to them separately. Though, this
is most due to how they were created. We should probably create a
separate FighterJob and add the skills to them, this would fix the
problem imo.

Closes gdquest-demos#16 and gdquest-demos#15

Add Character Growth

Characters gain experience points at the end of battle, which contribute to their level.  Levels determine stat growth along defined curves for each character.

Mana bars added

The bars system has been refactored. It's now possible to easily extend
it to create different bars i.e. stamina, rage, energy, etc..
The interface anchor has been removed and replaced with a proper control
node to hold the bars. Folder structure has also been cleaned.

Note that the newly added manabar will not show as of now since the
characters do not have mana at level 1 (not sure why). They were
configured to only appear if the battler has more than 0 of max mana.

Closes gdquest-demos#31

Local map (gdquest-demos#27)

* Update the readme, write about characters and a little bit about combat

Part 2 of gdquest-demos#13

* first mockup for grid movement

* back to defaul enviroment

* Get the right information when creating the battle scene from the localmap scene

* first mockup for grid movement

* back to defaul enviroment

* Get the right information when creating the battle scene from the localmap scene

* substitute Game scene with the one with local map

* add local map and transition from it to combat

* cleanup incongruences between versions

* Add localmap to the scene

* bugfix for wrong indentation in Battler.gd . Avoid continously transition to combat if the player keeps the direction button towards the enemy (in the map)

* Deleted template comments; Class, script and filename renamed in CamelCase;
Signal in LocalMap connected in parent node.

Add Battle Formations

Improve data persistence in an out of combat

Reduces a lot of the object designs to be reusable resources that act as templates for factory methods.

Changed local_map.visible to add/remove_child to prevent player movement.

Add Godette battler sprite

Add dialogue system to LocalMap (gdquest-demos#36)

Added CHANGELOG.md by following git commits.

Update changelog for versions 0.1 and 0.2, closes gdquest-demos#20

Remove .import folder

Implement minimal Attack and UseSkill BattleActions

Add a few sentences about the game world and monsters gdquest-demos#42

Add robi's head as the godot project icon

Readme: Add banner image and refine the intro

Add basic item and inventory handling

Add battlers and background sprites

Refactor the Inventory and Item classes

To have add/remove functions as part of the api
Changed some names for more common English words

Added the ability to cancel the selection arrow (gdquest-demos#58)

Had to remove the typed part of the `execute()` function from CombatAction.gd. It wasn't a `void` anymore: it returns if it actually managed to hit a target. When changing the function type to bool, yields would throw an error. I'm not sure if this is a bug with typed GDScript.

Concept arts integrated into the combat system

The only "missing" point is converting the game from 720p to 1080p. For
what I can tell, it's already 1080p, but it's being tested as 720p.

I had to downscale the sprites for the battlers, they were occuping the
whole screen.

For the platforms, I decided to only hide the sprite:
- The platforms might be used in a different area theme in the future
- The characters already have their own shadow
- Shadows have different sizes depending on what battler is "casting" it

Closes gdquest-demos#53

Add Leader-Follower behavior (closes gdquest-demos#49)

* Refactor Actor and standardize naming convention

* Add Leader and Follower

* Remove unnecessary look direction signal

* Fix moved signal emission passing the same position

* Move pawns to a YSort container

Added CoC based on GNU Kind Communications Guidelines

Update gitignore

Update Code of Conduct

Rename code-of-conduct.md to CODE_OF_CONDUCT.md

Refactor Party class

Add assert and use key in dict to check if an item is in the Inventory

Refactor Pawn follow, fix gdquest-demos#64

Use class_name for pawns and derivatives
Make it so followers are not registered in the grid so they don't collide with the player's pawn
Rename classes to Pawn* to make it clear they're related to the map/grid

Added monster drops (gdquest-demos#61)

* Added monster drops

Monsters can now be configured to drop items based on a resource (MonsterDrops.gd).
The usability is not the greatest, but that's due to not being able to export custom types.
There were two possible approaches that I saw:
1. An `Array` holding dictionaries for each item that can be dropped along with the data needed for the drop behavior.
2.  Create a custom resource that would encapsulate all the data for the items that can be dropped from a monster: The item itself, min and max quantities, and the chance.

I decided to go with the first one.

ps: The items are _NOT_ being added to the player's inventory . This is just the functionality needed for the monsters to start dropping items.

Closes gdquest-demos#59

* Embedded drops array to battler template, fixed code issues

Add battle music

Increase battlers size, move pawn and remove extra UI element

Refactor combat start and end signals, add battle music

I renamed `encounter` to `encountered_enemies` and used a few new signals to
remove a `get_parent` call, etc.

Added contextual menu scene

This adds the base for a contextual menu. It has to be extended to work both in combat and in other contexts (i.e. open the inventory and what not)

Still does not close gdquest-demos#65 because it's not working on the combat scene yet

Initialize drops to an empty array on characters

Refactor ContextualMenu

Add centered layout (centered around the Y axis)
Add offset for the entire layout

Add import files for ContextualMenu

Rename ContextualMenu into CircularMenu, ContextualAction into CircularButton

Refactor tooltip to update itself based on a button instance

The button and tooltip depended on CircularMenu to initialize them properly. Now the tooltip will work with any button or control node. Also, the CircularButton works on its own, as it should: it doesn't need the menu to pass polar coordinates anymore.

Move old school character stats diplay to its own file

Refactor combat to support multiple targets and add the circular menu

Main changes:

- Simplified combat actions. Action handle the logic that relates to
their name. E.g. the attack-specific code is now in Attack.gd and not in
its parent class. Removed unused parameters. Removed actions selecting
their own target: this breaks the single responsibility principle (and
made the action code break when I changed stuff in the interface)
- Removed the old school UI and action_list code in favor of the
circular menu
- Almost all functions that dealed with one target now work with an
array of targets instead, even if the player only selects one target
- All commands should support working with multiple targets as a result

A lot of the changes I needed to make to accomodate for either feature
broke the game, so that's why I'm packing all the changes in a single
commit.

Restore ability to cancel monster selection

This replays the turn with the same battler, reopening the actions
select menu

Added animated damage and heal popup

Added fixes based on Nathan's suggestions

Back on Par with Master

Slash still seems broken

Removed Print statements

Added Popup information with font gdquest-demos#70 part 2

Refactor Popup -> PopupLabel, split into two files with distinct responsibility

closes gdquest-demos#79

Add default value to potion resource

Make followers follow the player's pawn again

Also place them on the character's pawn at the start. They're not registered in the grid anymore so we can place them wherever we want
fix gdquest-demos#72

Remove unused DanBattler scene

Refactor SkillAction battle command

remove skill_to_use from base CombatAction class, move down to specialized SkillAction
rename skill_to_use -> skill

Disable CircularButton if not enough mana for a skill

Refactor CircularButton to extend Button
Disable if Battler.can_use_skill is false
Closes gdquest-demos#77

Add victory fanfare

Update battle theme music

Add RectExtents util to BattlerAnim to define their width and height visually

Use the battlers' extent/size to place popup labels, closes gdquest-demos#84

Place circular menu based on the battler's extents

Add keyboard navigation to CircularMenu, closes gdquest-demos#74

Add wasd to navigate the UI menu

Improve the look of the rewards panel

Make default.theme's panel background transparent
The panel now takes the width of the screen and anchors to the top of the window
closes gdquest-demos#78

Improve popup label animation

I temporarily changed the colors, but the label will need more work. Maybe a bitmap font instead of actual text: there are some artifacts with scale animation

Move all fonts to assets/fonts

Remove Munro

Fix and replace default theme font

Add default theme to hookable lifebar

Make the CircularMenu use the CombatAction's icon, add bilboshot icon

closes gdquest-demos#80

Update the changelog for v0.2.0

Add version number to the project

README: Replace old combat screenshot with v0.2.0

Deselect active battler at the end of the battle

Rename project to Godot Open RPG

Add support links to Open RPG

Add two icons and jobs for Godette and Robi

Changelog: add missing changes to v0.2

Merge dialogue and dialogue_player folders

Replace experience array with a formula, closes gdquest-demos#87

Refactor conversations, fix second line not showing

I tried to simplify the code, shorten the player script
The DialogueBox now uses the pressed signal on buttons for better mouse and touch support in the future

Move DialogueBox to its own scene, apply default ui theme

Turn fullscreen option off

Missing skills now decrease mana properly

Fixed CoC link in README

After the filename of the CoC changed, the README was not updated.

Characters dialogue database and portraits added

I opted to serve the textures with a function in the database that handles the fetching of the desired texture. It looked more natural, easier and more natural than to add this logic to the Dialogue.gd since all it does is returning the Dictionary with the dialogue phrases, the actual building of the interface happens in DialogueBox. There, I fetch the textures by reaching to the database.

Closes gdquest-demos#92

Leader and followers created from party in LocalMap

Closes gdquest-demos#90

Walk the dialogue resources directory to build the character dialogue database

closes gdquest-demos#101

Update changelog with the first improvements in v0.3

Refactor battlers to make it easier to edit and extend them

Also improved combat actions and moved some calculations out of battlers and into the actions instead.

Update changelog for upcoming v0.3 release

Replace the code of conduct file with a link to the gdquest website

Reset the DialogBox upon playing a new dialogue, fix gdquest-demos#103

Remove obsolete PawnFollower check in Grid.gd

Removed events from grid in local map (gdquest-demos#104)

* Removed events from grid in local map

Closes gdquest-demos#50

Also created boiler plates for pawns that have some type of interaction with the player. They work with both raycasts (in case we want something like pokemon) and area2ds for something that should only trigger on contact.

* MapActions created and grid removed from interactions

I used @nhydock's approach (sent via discord) to provide the correct nodes for the interactions aka using it's path. This implies on having to left click > edit children on every InteractivePawn after adding the desired actions. One alternative would be to provide the actions' scenes with the UI node, this way, each of them could display the UI when needed, without having to set node paths to them. Not sure which approach is better.
The actions are added to the InteractivePawn's `Interactions` node. I left one node in the map which starts an encounter after a dialogue, as mentioned by @NathanLovato

Refactor MapActions to not rely on a NodePath to their ancestor

LocalMap now initializes the actions with itself.
Added a method to start a dialogue on LocalMap
Moved files from pawns/interactives/ to pawns/
Removed now obsolete Dialogue.tscn and Dialogue.gd files

Remove unused variable, fix node not found warning

Make SelectArrow work with the arrow key's direction instead of array order

Closes gdquest-demos#109
It works in a basic fashion but the UX needs polish. Help welcome!

Add touch controls to SelectArrow, closes gdquest-demos#106

Add an add-on to edit RectExtents interactively

Most of the work for gdquest-demos#108

Currently only resizes uniformly around the rectangle's center! It needs
more code to add support for all 4 anchors. Or just fixing the issue
below, restoring the move tool's functionality and deselect, could do
the trick

RectExtents's internals changed a little, now it calculates its own
_rect property, a Rect2, based on its size and offset

Known issues: The input code blocks the move tool and selecting other
nodes at the moment

This is an exercise to get a sense for Godot's EditorPlugin API and
prepare some tutorial on the subject.

Big thanks to xphere, I used his godot-zone plugin as a reference to get
started :)

Fix consuming all mouse input in the RectExtents plugin, activate the plugin

closes gdquest-demos#108

Clean up Game scene, removed an Area2D and RectExtents

Update battler extents on BattlerAnim scenes

needed as I changed how RectExtents works

Add Pathfinder node, refactor Grid into GameBoard gdquest-demos#107

Grid -> GameBoard
Add types to GameBoard
The pathfinder node doesn't inherit from anything. It uses an Astar node
to find the path between 2 points on a 2d grid

Fix monster selection crash and add fallback if angle-based selection fails

Fix crash with mutating array when selecting monsters. With only the type hint the local array would not reinitialize in Godot 3.1 alpha 2, causing a crash

Fix party spawn: respects party size and spawns pawn inside grid cell

Fix gdquest-demos#111, fix 110

Rename pawn files to reflect the class names

Add spawning point to use with the GameBoard

Now you can place the characters' spawn position in the level editor

Add switch between touch and keyboard input modes for PawnLeader, gdquest-demos#107

change default map size to a value other than (0,0) Fix gdquest-demos#112

Update icons on combat actions

Visual destination point added to pawn leader when touch mode is active

I opted to add it to the leader, as a sprite.
Closes gdquest-demos#114

Open and close animations added to CircularMenu

Closes gdquest-demos#73

Move destination_point to PawnLeader, remove instancing on PawnFollower

Improve circular menu open and close animation

Transitions set to QUART, eases only in or out
Added fade anim
Made anim longer

Remove grid_size property from the grid, use Tilemap.get_used_rect()
instead

Delete reference to map_size in localmap.tscn
instantiate class pathfinder directly with the class_name instead that preload gd file

Compatibility with godot version > alpha2 : explicitily indicates enum types

Fix Touch Screen issues

InteractivePawn triggers actions with player input

By getting near the pawn, a small balloon will show, allowing the player to press `ui_accept` to start the interaction. They can be started automatically by setting `auto_start_interaction` to `true`. Works with both Area2D triggers and the raycasts.

For the touch, it was already working as far as I could tell.

Closes gdquest-demos#115

Fix gdquest-demos#128, play the death animation correctly when a battler dies

fix enum in rectextents plugin for 3.1 alpha 3

Create extensible AI for battlers

Update changelog

Keep battlers in the TurnQueue, close gdquest-demos#121

Update changelog and readme for upcoming v0.3

[WIP] Add new interface elements to represent the combat turn order (gdquest-demos#118)

* [WIP] Add new interface elements to represent the combat turn order...

This commit add two new scenes: TurnOrder and CombatPortrait.

The TurnOrder scene is designed to be a child of the CombatInterface node in
the CombatArena scene. It is initialized at the same time as the other
interface nodes, and dynamically display a CombatPortrait node for each
battlers, both PC and NPC.

For the moment, the CombatPortrait are just placeholders, and do not display
the real battlers portraits.

* [WIP] Rebuild the TurnOrder interface every time the TurnQueue is updated

* [WIP] Better CombatPortrait animation between combat turns

* [WIP] The TurnOrder node manages its own connections with signals...

... also add missing docstrings, and a CombatPortrait placeholder

* Fix previous commit, add missing Godette combat portrait

* Do not rebuild the TurnOrder interface if no battler enters of leaves the arena

... also add better combat portrait for Godette, Robi and Porcupine (256x256px)

* Animate the CombatPortrait faster

* Finally add the combat portrait of each battler

* Use battler.is_able_to_play() in CombatArena instead of directly checking the stats attribute...

... and minor comment changes in the turn order interface.

* Slightly reduce the space between CombatPortrait in the TurnOrder interface

Add grasslands tileset, clean up temp grid tileset

closes gdquest-demos#95

Manabars won't hide when depleted by default

Also, when a bar is set to hide when depleted, it will not show up again once another encounter starts.

Game over screen added (gdquest-demos#120)

* Game over screen added

When the whole party is defeated, a game over screen is displayed. The player can either restart the encounter, or exit the game from it.

Closes gdquest-demos#29

* Fixed mistakes and removed Game Over scene from CombatArena

* Removed grab focus from selection arrow

Add missing .import files for the turn order interface (close gdquest-demos#138)

Fix clipping when the `highlight` animation of a `CombatPortrait` starts (close gdquest-demos#140).

Now, the only animation that modifies the modulate property is `disable`.

Fix a bug that causes skills to be learned at the wrong level.

Add missing import files

Set emulate touch from mouse

Add assert to ensure InteractivePawns have Actions

Rename Grid -> GameBoard

/!\ Nodes you add to on instanced scenes (interactive pawns in this case) are lost when you rename a parent!

Fix PawnLeader not moving to the right target position with touch + camera

Snap pawns to the new grid size on LocalMap

Fix gdquest-demos#144: Player can move when interacting with NPCs

This relies on pausing the game: The NPCs still process during pause, as
e.g. if they were walking around you may not want to freeze the entire
game.

The PawnLeader stops as it inherits its pause mode from LocalMap and
GameBoard.

The StartCombatAction unpauses the game to play combat. I've changed the
interaction with map actions so they use the "finished" signal instead
of InteractivePawn waiting for the method to return.

Fix gdquest-demos#145: Refactor interactions with NPCs, fix wrong triggers

Add physics layers, remove boolean variable to check if the character is
interacting, now the game pauses during interactions
Now using physics layers and masks as well to only interact with the player's
pawn.

Fix gdquest-demos#147: Make Raycast-based player detection reliable on NPCs

Fix gdquest-demos#146: Set the PawnActor's pivot position before starting the tween animation

Also added variables to store references to nodes like AnimationPlayer,
Added Robi sprite, gdquest-demos#93

Add docstrings and refine the code in CharacterStats and GrowthStats

Turn PartyMember in a standalone gdscript file

Rename InteractivePawn -> PawnInteractive

Separate pawn animation from the PawnActor into a PawnAnim scene

Just like BattlerAnim before it, we have pawns that are reusable character
controllers, that apply to NPCs and to the playable character. And these pawns
could be any character in the game, so we need to be able to change the skin on
them.

Having separate scenes for animation is also essential for animators to be able
to do their job properly, while the devs can keep working on the Pawn scenes

Move and clean up sprites stored outside the assets/ folder

Register the PawnInteractive class in the project.godot file

Fix TransitionColor not lined up with the game's viewport

Add separate scenes for robi and godette's pawn anims

Document ready_for_combat in PartyMember

Add some docstrings to Battler.gd

Remove unused method in PawnContainer

Close gdquest-demos#148: Change the Pawns' animated character based on the party members

Update the changelog for v0.3.0

Add docstrings to some classes to explain their role

set initial animation for PawnAnim

Refactor GrowthStats out of CharacterStats

Basic quest system added

Code reviewed, fixed objectives being completed twice

Fix gdquest-demos#156: Only start interaction when clicking on the NPCs' area

Update changelog for upcoming v0.4, use Godot 3.1 alpha 4

Update some resources' values

Change game version setting to 0.3.0

Close gdquest-demos#149: Add save game support

Trying to use Resource to gather all the save data and let Godot store it on the
disk for us
This makes it possible to edit savegames from the inspector
Added a DebugInterface to save and load data, for testing purpose

Use a string template instead of a hard-coded name for savegame files

Fix gdquest-demos#160: Reconnect save and load buttons

fix wrong node path in DebugInterface

Remove savegame

Add debug savegames to gitignore

Fix wrong argument passed to the load function

I've really got to take some rest 😂

Add save/load to the changelog for v0.4

Inline GameSaver node in DebugInterface scene

WIP quest journal added

Quest rewards added

RectExtentsGizmo: safely register do and undo commands upon releasing the drag action

Gilles explained the UndoRedo object is shared by the entire editor, so another
plugin or function could write to the object in between our do/undo actions,
causing bugs or crashes.

Quest journal completed

Quest marks for pawns added

Pawns on `local_map` now have a "bubble" on top of them that indicates that they have a quest to give/active/to be delivered by players.

Works with both:
- Deliver quest to the same NPC that gave it
- Deliver to a different NPC

First refactoring pass on the quest system

Removed QuestPawn
Made Quest bubble standalone
Added docstrings to a few nodes

I left some TODO notes for more things to refactor. I think the questsystem api
still has some room for simplification.
Every NPC should also be able to handle quests imo

Fix gdquest-demos#170: Ensure the cell the player clicked is a valid target for the Astar path

Close gdquest-demos#171: Rewrite the quest system to better respect the single responsibility principle

This is a breaking change. I'm looking for some feedback on how the code feels now.

Quests start but won't complete yet at this point. I
want to do gdquest-demos#167 and hopefully gdquest-demos#168 as well to simplify the system even more.
Until now it was a pain to just create quests and place them in the game world,
for multiple reasons. E.g. The fact that the GiveQuestAction is inherited in
PawnQuestGiver scenes makes it so the quest reference gets lost every time you
modify the action's script in all instances.

The Journal is also broken right now!

- Made the QuestSystem as a singleton: it had to be passed around multiple parts
  of the game, and probably more and more files as we expand it. I'd rather
  avoid singletons but as the API is limited this has the potential to simplify
  the code IMO
- Devs should now ONLY interact with QuestSystem. The API is a lot simpler:
  start() and deliver() to start and finish quests talking to NPCs. For now the
  rest is handled by the quests internally, based on their objectives.

Reconnect the QuestSystem to the Game node

To know when an encounter starts and connect to newly created monsters in CombatArena

Fix gdquest-demos#172: Encapsulate quest rewards and fix signal not emitted on objectives

Remove debug code to complete quests instantly

GameBoard: Fix pathfinding error when clicking on an InteractivePawn

Now we only call Pathfinder.find_path() when clicking on empty cells

Close gdquest-demos#167: Now all InteractivePawns can handle quests

There's more refactoring to the quest system with this commit. It removes extra
code and scenes.

Quests work from start to finish technically-speaking, although there's more
work left to get the QuestBubble to display properly and to solidify
interactions from the player. I haven't decided yet where to handle that last
part: on the actions themselves or in the QuestSystem.

Now, Quests are the one element that emit signals about their state (started,
completed, delivered).

To use the QuestSystem, you have to get the real quest object in the
QuestSystem's database using the reference scene in the corresponding MapActions.

The quest doesn't pass itself through these signals. If you need a reference to
it on callbacks, you have to bind the quest as the last argument in the connect
method:

```quest.connect('completed', self, '_on_Quest_completed', [quest])```

One of the advantages of this code redesign is that each NPC should only connect
to and track the quest that's referenced in its `[Give/Complete]QuestAction.`
Thus there's no need for safety checks anymore or looping over all existing
quests in the game to find which is active, if it's the tracked quest, etc.

The system's functionality is limited but imo we shouldn't try to create too big
of a system, as we won't have the content to justify it. Now I see how time
consuming a quest system can be, and it'd be easy to go down the rabbit hole
trying to make an advanced one (handling all possible events, cinematics,
spawning npcs or modifying the game world, etc.).

Update Readme to recommend Godot 3.1 alpha 5

Close gdquest-demos#168: Move CharacterStats out of Battler, to PartyMember

The code has grown pretty complex. Diving back into the battler, rewards, etc.,
I found them hard to work with and some bits weren't logical. E.g. using the
porcupine's experience stat (earned experience) as the player's experience
reward upon killing them!

I missed some of these during code reviews. Anyway that's part of the coding
game: this demo is preproduction work, we have to try ideas and refactor as we
gain experience.

This breaks the rewards at the moment, as they were coupled with the battlers'
stats. It also breaks monsters. I'm opening issues to reflect that.

Fix gdquest-demos#180: Create a unique copy of the stats Resource for all battlers

Fix gdquest-demos#181: Use stats.level and Partymember.experience for quest rewards

Fix gdquest-demos#177: Make Quest-related actions inactive depending on the quest's progress

Fix gdquest-demos#182: Deactivate CompleteQuestAction after completing the quest

Fix gdquest-demos#178: Make QuestBubble show different icons depending on Quest-related MapActions

Fix gdquest-demos#173: refactor QuestJournal to work with the refactored quest system

Handle movement input better

- check press-only mouse (left-button) & touch input events

closes gdquest-demos#169

Simplify the connection between Game, LocalMap, and CombatArena

I started refactoring the code to make it easier to follow. This removes some
unused signal, makes some names more consistent and the code a bit easier to
read.

The Game node shouldn't be responsible for updating the party after an
encounter: the party should update itself.

Refactor and documentand document  CircularButton and CircularMenu

Close gdquest-demos#89: Added Popup for missed skills (gdquest-demos#184)

* Added Popup for missed skills

* Fixed signal name, reduced Builder and label Popups.

Refactor PopupLabel and PopupLabelBuilder to simplify their API

PopupLabel: Fixed wrong string in assert

Level up on experience change; fixed type mismatch

Fix gdquest-demos#190: Enabling Pixel Snap

remove link to Patreon readme

Reorder directories, first pass

Move all code to a src/ directory, pass 2

Add a copy of the code rewrite by Razvan Radulescu

Add import files, remove unused directory

Fix type errors

Port Pathfinder to Astar2D, clean up code

Rewrite initial movement demo in GDScript 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request game design
Projects
None yet
Development

No branches or pull requests

3 participants