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

Refactor Enemy AI #2381

Merged
merged 5 commits into from
Oct 25, 2020
Merged

Refactor Enemy AI #2381

merged 5 commits into from
Oct 25, 2020

Conversation

mateofio
Copy link
Contributor

@mateofio mateofio commented Oct 5, 2020

Depends on: #2331
Depends on: #2380

Fix: #1831

  • Configurable enemy AI algorithms
  • RPG_RT compatible algorithm
  • RPG_RT+ compatible algorithm with bug fixes
  • Write full unit test suite
  • Manual play testing

@mateofio mateofio added Battle Has PR Dependencies This PR depends on another PR labels Oct 5, 2020
@mateofio mateofio force-pushed the enemyai branch 2 times, most recently from d5502bd to 0ccfa76 Compare October 8, 2020 13:59
@mateofio mateofio mentioned this pull request Oct 9, 2020
8 tasks
@fdelapena fdelapena added this to the 0.6.3 milestone Oct 9, 2020
@mateofio mateofio changed the title WIP: Refactor Enemy AI Refactor Enemy AI Oct 10, 2020
@mateofio mateofio marked this pull request as ready for review October 10, 2020 03:58
@mateofio mateofio requested review from Ghabry and a user October 10, 2020 03:58
@mateofio
Copy link
Contributor Author

I've written a full unit test suite and tested the code manually. This is ready for review

@mateofio
Copy link
Contributor Author

mateofio commented Oct 11, 2020

Proposal for next PR - custom chunks to enable per actor/enemy ai

I wanted to run this proposal by you guys first before I started implementing. Basically I want to make actor and enemy ai configurable per actor / enemy.

  1. Add a custom actorai chuck to lcf::rpg::Actor
Value Algo
-1 Use System Default
0 RPG_RT
1 RPG_RT+
2 ATTACK
  1. Add a custom actorai chuck to lcf::rpg::SaveActor
Value Algo
-1 Use Actor value
>= 0 Use specified algo
  1. Add a custom enemyai chunk to lcf::rpg::Enemy
Value Algo
-1 Use System Default
0 RPG_RT
1 RPG_RT+
  1. Add a default_actorai and default_enemyai chunk to the lcf::rpg::System
Value Algo
-1 Use RPG_RT, or override with what user passes to --actorai / --enemyai command line args
>=0 -1 in System means always use this and ignore the command line args, except in --test-play mode
  1. Refactor the actorai / enemyai factory to be array based, and preload the EasyRPG shipped algos into the arrays. Custom engines can add more of their own.

So this gives you maximum flexibility. For vanilla RPG_RT games, all the chunks are defaulted to RPG_RT and you can use the command line arguments. For games where the author really wants to use a specific algo, the command line arguments are no longer allowed to override the game authors wishes.

@Ghabry Ghabry removed the Has PR Dependencies This PR depends on another PR label Oct 11, 2020
@Ghabry
Copy link
Member

Ghabry commented Oct 12, 2020

Your proposal sounds good to me. You can have decimal 200 for it in every object you listed.
Don't forget to prefix the options with easyrpg_ to indicate that it is a custom chunk (I'm open for shorter prefixes or other ideas)

@mateofio mateofio mentioned this pull request Oct 12, 2020
91 tasks
@Ghabry Ghabry merged commit 65cceb5 into EasyRPG:master Oct 25, 2020
@ghost
Copy link

ghost commented Dec 10, 2020

I admit I'm late here, but I fully support the idea for using ID 200+ and the prefix easyrpg_ for custom features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Verify correctness of Game_Enemy::ChooseRandomAction
3 participants