Hello! How can I make a 3D Turn Based Battle System?

Godot Version

4.2.2

Question

Hello! I’ve been at it for some time trying to recreate the 2d battle system I’ve had in my game, For the Godot game engine! But I’ve had the most trouble trying to make it work for 3d. Especially since I don’t know what to do besides the basics! Could someone help me? Please

3D Turn Based Prototype

The repo being hyperlinked shows all my current progress fyi, I also wanted to set this up with castledb/json for faster iteration.

Anyone?

You’ll probably get more people willing to help if you post a little more info. Having to look through a whole project in order to figure out where you’re at and what it is you want is quite a lot to ask.
I suggest focusing on the next small-ish thing you want to get working, and then posting a description of that, what you’ve tried, maybe some relevant screenshots/code excerpts and so on.

3 Likes

I’ll really just go through it now. I’m stuck on both implementing turn based logic to each player and enemy placed on a board :sweat_smile:, And I don’t exactly get how I’ll register the damage they’ll be able to do or take via my database. The code I’m working with really doesn’t seem like the best for the logic, Especially since I wanted to be able to call a function to skip turns of someone up coming, Like most games use when they wanna flood the player with attacks…

1 Like

More people are willing to help with specific questions than they are with “write my game for me” postings.

3 Likes

ATM nobody is saying that. And if what I am saying concludes that, It’s easy to explain that majority of the game is setup and ready to be used as a base the make the game. But it’s overall gonna be missing this part of its puzzle, Because nobody has documented how to create one, Hell. Even contributing atleasts gives future people these solutions for when they need a mechanic like this in their game.

1 Like

You need to ask a specific question. What, precisely, are you having problems with?

2 Likes

as a programmer, if a puzzle is missing pieces, creating the missing pieces is YOUR job. tutorials/prototypes serve as starting points for new programmers. that is it. from there you have to figure out the rest.

please look at the thread below. in this thread, the specific question asked is: how do i avoid particle flicker when changing a node’s parent. this is what we expect from you.

2 Likes

If you know how to move 3d models in godot with the use of variables youre good to go. Then you need to learn how to make an attack system.

1 Like

At least explain how you want your turn-based system to work. How does the player interact with it? What can be done on a turn? When does the turn end? Is the opponent AI-controlled, or is it another player? etc etc.

1 Like

I don’t know how to move characters with a variable. Or by just using code :sweat_smile:, That’s something I’ll have to read documentation for

1 Like

The opponent ai controlled, Having given all allies on you’re party a chance to attack until before you can go. And also having skills with special parameters to skip all ally attacks.

1 Like

An issue like that feels like it would be heavily documented or atleast given GitHub issues to me… But I’ll have to read that forum in my spare time, I know Godot has a bunch of random bugs or issues I encountered during using it. You definitely can’t make or do everything with the engine and have it just work :sweat_smile:, And everything you wanna make. Won’t be stuff as easy as other people at the end of the day.

1 Like

Making a turn-based battle system is a general knowledge issue which is not specific to a particular game engine.

2 Likes

creating a battle system is many problems. you need to think about what the problems are and solve them one at a time, for example:

  • how is decided who has their turn, and how should this be programmed
  • what can anyone do on their turn, and how should these actions be programmed
  • how does the camera decide where to point
  • when and how to add visual effects like particles and hit stop and screen shake
  • how to select an opponent or a tile
  • probably more problems i can’t think of
1 Like

That’s exactly why it’s being put on hold. Because there’s no clear guidelines, Especially updated for godot 4 :sweat_smile:, So it’s best I give it some dedicated time before tackling

1 Like

Just remembered I worked on a turn based game for a game jam around a year ago.
The code is not super clean as it was a two day jam, but feel free to draw some inspiration from how the board, player turns and the units are handled:

2 Likes

General tips for the turn based battle system:

  • make things signal driven, since usually you have to wait for user input or AI events before proceeding
  • create a TurnManager or BoardManager node with a script attached
  • add turn_order array that has a list of characters (player, enemies, world hazards etc.) in the order they are supposed to take their turns in
  • add a current_turn_index varianble that starts at 0 and is the position in the turn_order array that the character whose turn it currently is is at
  • give it a method next_turn() gets the current character (turn_order[current_turn_index]), calls a method on the character (e.g. act(), can be async to allow you perform animations before finishing the turn) and then increments current_turn_index by one, checking that you’re not going over the length of the turn_order array - 1 by resetting back to 0 in that case
  • add a button that is only enabled if it’s the player’s turn and calls next_turn() on the TurnManager node

You can insert things like tweens to move the characters, using await get_tree.create_timer(1.5).timeout to wait between turns etc., so the AI turns don’t finish immediately and the player has a chance to see what’s going on.

Good luck with your game! :sparkles:

2 Likes

I’ll definitely check out the code provided! :eyes:, Thank you for sharing it over here alghost! :purple_heart:

1 Like