Games icon indicating copy to clipboard operation
Games copied to clipboard

ECS Approach

Open Zomis opened this issue 3 years ago • 2 comments

With the power of Kotlin, it's time once again to try an Entity/Component/System approach.

Remember the decisions made and the lessons learned and try to make it as easy as possible to do it "right". Remember to fail early and fail often when something is wrong, such as trying to get a component that is not attached to an entity.

Especially remember the following:

  • View, what is public, what is private, what is invisible
  • It should be quite easy to make AIs
  • Actions are important and can be performed at different times, this is probably where the systems come in, to decide which action is possible when, but the whole "Systems" aspect needs a lot more thought here. How is different from "game flow" and "yield action" and other previous variants of deciding which actions (and options, and recursive options) are allowed?

Zomis avatar Jan 04 '22 23:01 Zomis

companion objects in Kotlin can have a name and a type, which makes them a lot nicer to refer to. See how Kotlin has done with coroutine context elements, for example: public companion object Key : CoroutineContext.Key<Job>

Zomis avatar Jul 28 '22 13:07 Zomis

Simple Tic-Tac-Toe created. Will try and re-use lots to create similar games: TTTUltimate, Connect4...

Creating AIs in ECS style might be a bit more tricky, especially scoring AIs. Since the way I've done it in TTT encourages one-action-per-entity. So instead of one actionType with 9 possible actions, there is now 9 actionTypes with one action each. The actionTypes are named for example /board/1,2/play

Zomis avatar Aug 17 '22 19:08 Zomis