Page 1 of 2

Looking for beginner tutorial about turn based games

Posted: Sat Jan 16, 2016 10:46 pm
by Tchey
Hello,

I've been following some nice tutorial videos to learn about Love2D, LUA and coding in general, as i'm completly new to this. So i've a kind of simple Invader, a kind of simple plateformer, a kind of simple topdown shooter... Great to learn about how to build and organize the code, collision, movement, loops, table...

I still have very little skills, and out of tutorial i'm lost, for now, but even, i'm now looking for tutorial to make a simple "full" game like the previous ones, but turn based. I'm thinking about games like : Go, Chess, Civilization, Wesnoth, Roguelike, XCOM...

I couldn't find anything, in english or french.

Anything to share ?

Thanks

Re: Looking for beginner tutorial about turn based games

Posted: Sun Jan 17, 2016 6:56 am
by ivan
Hello and welcome to the forums.
"Turn-based games" is a broad term.

Regarding board games like chess, go as well as card games
(where you have a clear and limited set of moves)
programming these can be divided into several parts:
- move validation checks if a given move is allowed by the rules of the game
- move generation finds all possible/valid moves given a position
- move evaluation ranks how 'good' a particular move is
So if you can generate moves and evaluate each one,
then programming the AI becomes a search/sort problem:
you have a tree of moves and you look for the branch of moves with the best evaluation.
In the past I've done a simple Chess move validator/generator:
viewtopic.php?f=5&t=80105

Games like Civilization are a different category
because there you have a lot of possible moves/options.
The basic challenge would be to coordinate moving units
so one option would be a hierarchical system where goals/actions are queued.
For example:

Code: Select all

- build a city
  - select a settler unit
    - if no setters are available, select a city that can build a settler unit
      - build a settler unit in that city
  - move the settler unit to the desirable position
Civ AI is a difficult problem so in many cases
it may be better/more fun to allow the computer
to cheat by boosting production times and so on.

Roguelike and tactical games are probably easier.
There you can just have 'agents' on a map each doing its own things.

Note that all of these can be programmed with little to no graphics.
A graphical interface should be the last thing you want to add on top
just so that the player can input moves.

Re: Looking for beginner tutorial about turn based games

Posted: Sun Jan 17, 2016 10:47 am
by Tchey
Thanks for your answer,

I'm well aware of "gameplay" stuff. I'm more looking for a step by step tutorial, as i don't have yet any programming skills, and i'm willing to learn with Love2D/ Lua support.

My ultimate goal would be to create a xcom-like game, in a different setting (no alien etc), but i'm way, way, far away from being able to create "that".

Before painting a masterpiece, i need to learn how to hold the pencil.

Re: Looking for beginner tutorial about turn based games

Posted: Tue Jan 19, 2016 6:51 pm
by 0x29a
I sincerely believe that there's no such thing - except for maybe some books on implementing AI in video games.

The way I see it:

1) Check out things like circular buffers, stacks and other essential data types. Learn how to implement them yourself or how to use existing solutions.
2) Check out algorithms such as A*, raycasting, sorting and so on
3) Once you got this covered, sky's the limit.

Basic idea goes like this:
- Let's say each party in the battle has "initiative" factor, or how would you call it
- Sort them via this factor, so the character with highest "initiative" will move first
- Perform super-complex AI calculations if it's AI's turn, or give control to the player otherwise
- Repeat previous line

Here's a tutorial that might help you: http://www.raywenderlich.com/12022/how- ... ame-part-1

Also, there are some turn-based games posted on Love2D forums. You can download .love files, extract them and read the code

Re: Looking for beginner tutorial about turn based games

Posted: Thu Jan 28, 2016 12:46 am
by rmcode
I just started working on a turn based game and the basics are pretty quick to set up.

If I have some time this weekend I'll try to write a small tutorial :)

Re: Looking for beginner tutorial about turn based games

Posted: Fri Jan 29, 2016 5:31 pm
by Tchey
Hello,

I didn't have time these days to do anything related to programming, but to search more, and couldn't find anything suitable and understandable by me, at my level of skills (next to zero).

I'd would really like to read your small tutorial.

Re: Looking for beginner tutorial about turn based games

Posted: Tue Feb 09, 2016 8:18 pm
by fade
rmcode wrote:I just started working on a turn based game and the basics are pretty quick to set up.

If I have some time this weekend I'll try to write a small tutorial :)

Hey! :) Any chance you made that tutorial? I would sure love to read it.

Re: Looking for beginner tutorial about turn based games

Posted: Wed Feb 10, 2016 6:36 am
by Davidobot

Re: Looking for beginner tutorial about turn based games

Posted: Fri Feb 12, 2016 12:57 pm
by rmcode
Sorry I didn't respond. I think I won't be able to give a step-by step tutorial anyway ... as the others said it includes a bit of more advanced stuff. When I have my own game in a more playable state and have figured out a few more things I'll try to write a more general article.

But at least I can recommend this to you:
http://journal.stuffwithstuff.com/2014/ ... game-loop/

Re: Looking for beginner tutorial about turn based games

Posted: Sat Feb 13, 2016 5:48 pm
by Tchey
The article is quite advanced for my skills, but it's still something. Your game is really really close to what i'm aiming for !

I don't spend much time learning programming, it's not on my top priority todo list, but i feel really interested about all that stuff anyway. I'd like a second life to focus on it and become a computer genius, but i guess i can't be focused everywhere at one given time...

I get the meaning of everything i read, but i don't get how to do it myself. I have to put my brain in function to understand it all now.

Thanks