Rule set based game engine design help

Background: I just finished Dave Thomas’s book. I feel like I still have some holes in my understanding of the book itself. I have two thoughts, one being a quick reread of the book to fill in the blanks and the other to create something. Suggestions welcome on which you prefer.

I’m leaning towards the latter and was looking at ideas to build or contribute to ongoing development in the community. I am nowhere near the level required to contribute to the community yet. A few of my friends designed a new board game and we were alpha-testing it last night. We had a lot of fun playing it and finally started talking about getting a kickstarter going. I threw in the idea of creating a browser/phone game that mimics the board game.

I never created games or game engines. So, I started looking up game engine design/AI stuff in Elixir. I did not come up with many.

http://www.automatingthefuture.com/blog/2016/3/21/ai-generate-and-test-elixir

I would like some input on existing resources that any of you may have come across and also any suggestions on how Elixir implementation of this game engine might look like (simplified game description below).

Number of Characters (upto 10 but say 2 for now, A and B)
Char A: has 5 items (a1,a2,a3,a4,a5)
Char B: has 6 items (b1,b2,b3,b4,b5,b6)

Each item can be played on a user’s turn or can be used to counter another user item. Each item also has a integer value associated with it that acts as the number of points a player gains when played. Some items when played can be countered which would render that item and the counter item null and discarded with no point gains. The relationships between the items form the core of the game. To simplify it let’s assume the below( you can ignore the actual relations but just understand how it works):

a1 -> b2,b3 (means items a1 can counter items b2 or b3)
a2 -> b3,b4
a3 -> b4,b5
a4 -> b5,b1
a5 -> b1,b2
b1 -> a2,a3
b2 -> a3,a4
b3 -> a4,a5
b4 -> a5,a1
b5 -> a1,a2
b6 -> a2,a3

The game assumes a user player and a AI. I am trying to create the AI part of it provided a user input (the item played)

Coming for a OOP, it’s so tempting to do model & create this such a framework. But, i want to build this in Elixir. Am I shooting myself in the foot picking up such a problem that many not lend itself very well with Elixir? Any guidance on the best way to achieve this is appreciated.

2 Likes

If the number of available items is limited to 64 or less, the usual way to model this would be a bitvector. This is bread and butter code for C or Java with enums. It’s a technique used in every game since the dawn of creation.

Elixir does appear to have bitwise operators.

2 Likes

Working on a project is a great way to learn and what you want to do is fine for Elixir. You may end up using Elixir as a backend server and building a phone UI in some other language, but I wouldn’t even worry about that yet.

If you want to learn how to create a game engine, Game Programming Patterns is my favorite resource.

4 Likes