Turn Based Game Idea

Hi all.

I’m new here and for the past few weeks i’ve been following the Tutorials on the Unity website as well as reading through Will Goldsmiths excellent “Unity Game Development Essentials” book.

I feel I now need to start to make my own games to learn more… But i’m not interested in an FPS or racing game, or any similar generic game that always crops up in tutorials… I’m interested in making a computer version of the classic ‘Games Workshop’ game, Necromunda (Necromunda | Board Game | BoardGameGeek)

I realise this is a LARGE project that may take YEARS to get down, but it’s a goal and i’m willing to learn :slight_smile:

As there are no tutorials on making such a turn based game, i’m having trouble getting started on the most important part of the game - Moving a character! Moving characters in FPSs or Racing games seems easy as you can simply detect for collisions between 2 objects, but in this Turn Based Strategy i’ll need to detect obstacles BEFORE moving.

Let me walk you through my thought process so far… Any comments and tips would be greatly appreciated.

– NOTE: Game will be in 3D. These reference images are in 2D, top down view –

  1. User selects the player on screen and is then able to “draw” the path they wish the model to move to.


2. If the path hits an obstacle it stops dead – I was thinking I could use a capsule collider for this and detect collisions between it and other objects


3. The user may click to place down a point (I’ll store in an array), and then continue drawing their path.


4. At the end of the path, the user can decide which direction the player will be facing in (Ready for the shooting phase)


5. When the user clicks the MOVE button, the player model transforms from one point to the next, and shouldn’t collide with any object.

Only problem I can forsee is drawing/ detecting collisions when the player is required to walk up stairs!?

Is this the best way to go about this? Are there better ways of achiveing this result? Maybe a better way of implimenting so that a model can walk upstairs to various levels?

I’d love to hear any suggestions, thanks in advance :slight_smile:

Obstacles are detected the same way as they are in a realtime game, just at a slower pace. If you want to see if a move is valid, without giving it all away, you have to check from your current position to the target position for obstacles.

I don’t know the rules to this game, but it looks like a miniatures game. So you have the current position and then need to measure if the object can squeeze by any obstacles in which case you need to know the geometry of the object as well.

I don’t have any suggestions, just thought I would be the first to welcome you to the forum.

Welcome here :slight_smile: I am also new so hello everyone!

Welcome to you as well.

note: Goldstone.

Good luck with the game dude!

Check out the A* path finding algorithm here on the forums. Free for noncommercial use I believe, It will do all that obstacle avoidance for you.

Also, welcome to the forums!

Edit:
http://www.arongranberg.com/unity/a-pathfinding/

Here’s a setup I used for a flash game about a year ago… I would imagine it could work for you.

You essentially have a raycast on each side of the character controller checking for collisions, and you also have a simulated end position for the player checking for collision.

If any of them hit at the desired move distance, then the player can’t move.

One thing to make sure of is that all your objects are bigger than the player, or add additional raycasts if you need smaller objects.

341564--11960--$raycast_hitcheck_851.jpg

Just stumbled onto this post and thought I would reply even though it is really old in case anyone else was thinking of the same thing.

There are different approaches that can be taken, I have done all of them. You can collision detect a rectangle, cube or rays which are created from your starting position to your ending position. If you don’t care too much about the 3D aspect you can remove the notion of “Y” in your models and just care about the 2D location - effectively you have flattened the models onto a plane - then it is very simple 2D collision detection routine. However, this will suffer from not calculating your distances properly if the terrain height changes a lot. I have also used an algorithm that effectively “walks” the model along the path at intervals and then stops when you hit something - this I found was the best when 3D mattered. This will allow your model to walk over and under objects such as bridges, tunnels, etc. You can also ray cast and look for the point of intersection. Ray casting can have problems though due to gaps between the rays. In other words you can walk through objects that should have blocked your path because your rays did not strike the obstruction. Unfortunately I did not do any of this in Unity so I don’t know how hard or easy it is. BTW, I was doing the same thing with the Games Workshop game “Legends of the Old West” which is basically the same rules as their “Lord of the Rings” game. I have also used the path arrary model you described which worked great.