Looking for beginner tutorial about turn based games

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Tchey
Prole
Posts: 25
Joined: Sun Jan 10, 2016 10:44 am
Contact:

Looking for beginner tutorial about turn based games

Post 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
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Looking for beginner tutorial about turn based games

Post 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.
User avatar
Tchey
Prole
Posts: 25
Joined: Sun Jan 10, 2016 10:44 am
Contact:

Re: Looking for beginner tutorial about turn based games

Post 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.
0x29a
Prole
Posts: 27
Joined: Sun Jul 06, 2014 10:22 pm

Re: Looking for beginner tutorial about turn based games

Post 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
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

Re: Looking for beginner tutorial about turn based games

Post 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 :)
User avatar
Tchey
Prole
Posts: 25
Joined: Sun Jan 10, 2016 10:44 am
Contact:

Re: Looking for beginner tutorial about turn based games

Post 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.
fade
Prole
Posts: 9
Joined: Tue Jan 26, 2016 9:47 pm

Re: Looking for beginner tutorial about turn based games

Post 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.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Looking for beginner tutorial about turn based games

Post by Davidobot »

PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

Re: Looking for beginner tutorial about turn based games

Post 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/
Last edited by rmcode on Tue Jun 07, 2016 3:45 pm, edited 1 time in total.
User avatar
Tchey
Prole
Posts: 25
Joined: Sun Jan 10, 2016 10:44 am
Contact:

Re: Looking for beginner tutorial about turn based games

Post 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
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 13 guests