Bit and Bobs Devlog | Week 1


Basic Player Movement Devlog  

Bits and Bobs Devlog  

The focus of this week was basic character movement. However, my game doesn’t really have a single ‘player’ nor is the movement that basic to implement. Subsequently, I’ve decided to postpone the pain of tackling this task till next week.

This week’s NEW focus is random bits and bobs. The new agenda looked something like this…

  1. Creating a basic board co-ordinate system
  2. Setting up a RayCast which allows for clicked objects to be displayed in the Debug Console.
  3. Begin implementation of the Action UI.

Implementing the logic for a chess like game seems like an incredibly daunting task to approach for someone such as myself. After trying to consult some youtube videos for comfort, the difficulty was made even more apparent. 

In this series, chess is fully implemented through code/scripts in unity. 9 episodes later, many a tear and visits to Scripting API and blam you got chess. I didn’t really want to sign up for this especially for a 7 week project.

Co – ordinate System

I began looking for an easier solution. Putting full reliance on code seemed somewhat where the difficulty lies. I figured some corners could be cut by utilising some of the systems unity has in place. This includes the raycasting, collision and find systems. I decided that  a good foundation for simple coding could be built off using GameObjects to handle Co-ordinates. Co-ordinates of every square could be handled by an invisible GameObject with a collider. This serves multiple benefits.

Co-ordinate System
  • Raycasting click can detect and return the name and collider of which square has been hit.
  • Using OverlapAll on a given square gameobject will return all objects currently colliding with it. More importantly it can be determined if and which unit is currently on that square.
  • Find function: I can feel Ian cringing at me for using this…However, it is an incredibly useful function for this application. A square can be found and analysed purely off it’s name. Furthermore, arithmetic can be used on the name of a square in conjunction with find to analyse the surrounding squares.  

Time will tell if this method will actually be easier but we're off to a good start.

RayCast

 As showcased above, the RayCast can be used to analyse objects upon a click. The RayCast was made to return an array of collisions therefore it can analyse multiple GameObjects occupying a single space.  As seen below, both the unit and the square it is occupying is returned. 

RayCast Multiple Targets

Action UI

The role of the action UI is to manage the triggering of the Move, Ability Phases and the Unit information analysis. I was able to fully implement a system which instantiates the UI as a child of a correct selected target and moves it to the location of that target. This means that when an action is selected the target can be found as the parent of the object.

Action UI instantiation/Exiting

The implementation of all this has laid the framework for the movement phase to be tackled next week.  See ya there 😊

Leave a comment

Log in with itch.io to leave a comment.