# How do I find generic game logic

Get help using Construct 2

### » Thu Jul 14, 2016 5:50 pm

I am self-learned in most of the things I do. I seem to love information. I would like to find a book or blog with game logic information. This does not have to be C2 specific but that would be icing on the cake. I have been searching but not finding what I want.

I would like to know how to write subroutines to accomplish the tasks in many types of game (mostly puzzle types). An example would be say a poker game. Do I need to write code to check for all the possible outcomes (Pair, 3 of a kind, Full house,etc) or is there a simpler way to get the result that would result in less bloat and faster operation. Take this into a more complex game would be like candy crush. The basics of the logic to check for the three or more matches. not only in the current move but in whole grid. I could list more but I think my point is clear.

I am asking this so I do not come to this forum and ask this type of question with everything I try to make. Hope I have made my question clear. I know I could take a game creation course but am looking to go at my pace and not invest a fortune.

Thanks
John

P.S. If this question would be be better elsewhere please direct and I will remove and repost it.
B
28
S
5
G
2
Posts: 77
Reputation: 3,087

### » Thu Jul 14, 2016 6:42 pm

For specific types of game logic, your best bet is google. For example, poker hand evaluation (not a simple algorithm!): https://www.google.com/webhp?sourceid=c ... tion+logic

There are so many types of games that there is no one source/book/tutorial for all types of programming logic. However, it has almost all been done before, so wikipedia and google are your friends - you just need to know what to look for.

Basically while you can work through complex logic yourself, it most likely has been done and documented already. There are also usually many many different ways of doing the same thing - here is a classic example https://en.wikipedia.org/wiki/Sorting_algorithm.
B
59
S
29
G
122
Posts: 1,822
Reputation: 69,046

### » Thu Jul 14, 2016 9:40 pm

Thanks, this is the type of thing I am looking for. I had a feeling there would be no short formula. I assumed I would have to write a check routine for everything I am looking for. Not like a simple check that I could apply accross th board so to speak. In the poker example, I assume a top-down (highest hand routine) would be most efficient. Example being if they have a royal flush the other hands could perhaps be skipped.
B
28
S
5
G
2
Posts: 77
Reputation: 3,087

### » Thu Jul 14, 2016 10:08 pm

Usually best not to lose too sleep over "best" or "most efficient" methods, unless you run into specific performance issues. Which is rare, considering the computing power available today.

I would always recommend a method that is easy to understand and makes sense based on your own logic rather than an arcane optimized method that you don't completely understand.
B
59
S
29
G
122
Posts: 1,822
Reputation: 69,046

### » Sat Sep 30, 2017 10:02 pm

thanks again
B
28
S
5
G
2
Posts: 77
Reputation: 3,087