Zomis / Games

Many kinds of games, playable in both multiplayer or local play. Replays, spectator mode, and AIs.
https://games.zomis.net
MIT License
17 stars 5 forks source link

ECS Approach #282

Open Zomis opened 2 years ago

Zomis commented 2 years ago

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:

Zomis commented 1 year ago

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 commented 1 year ago

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