Working on the Round Based System

  I want to preface this by first saying that I likely won't be making much progress this coming week on The Depths.  I have grown fond of the community here and have decided to set up a workshop.  But I will have to make the workshop so it will eat a little bit into my coding time.  Do not worry though I will continue to work on the game even through this week.  But it will be likely trying to figure out and fix some bugs and glitches in the turned based system that still persist.

So currently the turn based system cycles through four steps.  These steps are the player load AP turn, the player move turn, monster load AP turn, and the monster move turn.  These systems are built off of the systems that were currently in place so it was a little difficult adding a snippet of code here and a snippet of code there to make it all run properly.  There are still a few older systems that are not functioning properly in this and are currently coded around, but should be fixed where they first crop up instead.

So the player load AP turn does pretty much that.  Like the vision system or the screen update system it cycles through all the names of players currently in the dungeon.  It grabs their max AP total from the database then loads it into their AP left database data.  It is easier to do this with phoenix speak then trying to do this with variables.  At the same time it also adds that AP into a variable that contains the total AP of the entire party.  After it cycles through every player it passes on to the player turn.

The player turn code keeps track of all the AP used as well as a set countdown timer, as well as stopping a player from moving if they have used all of their action points.  Once all the AP has been used or the timer has reached its limit then it passes the turn onto the monster load AP turn.

The monster load AP turn was a little more difficult to accomplish and I may find an easier way to do it then I currently have.  What it does is go through all the timers to check to see if there is a monster associated with those timers.  If there is then it finds what that monsters max AP is and then loads it into its usable AP as well as a variable that holds the monsters total AP.  Because the timer cycle can enter this in the middle of a cycle I added a variable to keep track of how many times this triggered.  So once 100 timers have triggered it will know that it is done with this step.  The code that is written for this though does not work properly if there are no monsters and will load at least one monster AP even if there is nothing there.  A work around is currently in place to just pass the turn on any dungeons that do not load monsters.

The monsters turn just passes on to the wander AI that was currently in place.  Which at the moment takes one second for each AP the monster has.  This would like this fixed in the future so that they can perform more complex choices in the single second.  Such as choosing a five move path, instead of just one.  But that is all for another day, I still want the AI in this game to be flexible and one of the biggest parts of the game.

So that pretty much covers all that was accomplished over the week.  The code still isn't perfect but I will keep working on it try to make is smoother for fun gameplay.

if you are interested in the source code it can be found here

Comments