Wednesday 11 May 2016

Final Tweaking and Bug-Fixing, and Post-Mortem

This is my final blog post relating to my Final Project: Creating a Strategy RPG. This will include what tweaks have been made in the final day, and a Post-Mortem of the project.

Tweaks and Bug-Fixes

Terrain Implementation and Final Movement Issue
While sadly, neither of these components were resolved. I attempted to implement randomly generating forest tiles, and during this period it came to my attention that AI units were moving to tiles already taken by other units.

For the forest tiles, I implemented a method into the Grid class:

I realised that the above method would not guarantee that 1/6th of the map would be populated by forest tiles, as it would skip over any tiles that already were forest, and i would continue, the population would still remain dense enough to have an impact, and could potentially be refined later.

During this, as stated above, I discovered AI units moving onto already populated tiles, and decided to prioritize fixing this issue first. I realised this issue would also effect User units. I decided to first focus on removing this option for the user units, and created a method in the GameManager class:


I created a method separate for the User units because:

  • The AI do not have their moving bool set to true until they have already plotted their path.
  • The AI rely on the path target being set to the User unit they are attacking, but while a node is unwalkable, it is not detected properly by the target. 
This method seemed to work for the User units, until further play-testing. When a User unit died, the first if statement of the method started declaring that the argument was out of range. I attempted:
  • Placing the first half of the if statement into the update function, running the method only if true
  • Creating a temporary variable for the current unit
  • Ensuring the next User unit did not have moving set to true
For the AI's side of it, I created two methods; TurnOnBlock, and TurnOffBlock. They were the BlockUnitTiles method split into two, so they could be run at the beginning and end of functions or methods as necessary, but this is where I discovered the issue of unwalkable tiles not allowing the path target to draw a path to it. With User units, the path would select the last tile that was moused over, but as the target goes directly to a units tile when the AI is operating, it simply could not find a target.

I decided against pushing further into the issue, with time constraints in mind, as the final build of the game, while containing the above bug, has no other errors or issues. Due to the time spent on this, and minor attempted tweaks, I have also not pushed further with the terrain implementation, but in hindsight, believe that had I approached the issue sooner, I would have been able to implement it within a week or two.

Minor UI Tweak
To help understand the weapon system, I have now added the weapon types of the current unit, and any unit the mouse passes over.
The names appear in different colours:
  • Weapons coloured green will attack positively
  • Weapons coloured red will attack negatively
  • Weapons coloured black are the same type

Post-Mortem
In the academic year that I have spent working on this project, I feel I have come a long way from the start. I can definitely look back and say I was over-scoping based on my initial abilities and knowledge, but towards the end, it was more unjust fear holding me back. Taking that step into AI was terrifying for myself, believing I was going to feel far too out of my depth, but to the contrary, once I got stuck into it, it became an area I really enjoyed playing with, even if the AI I have implemented is still considered simple.

There were times during the project when I came to resent it. I looked at the progress I made at worse times, and judged my ability on that, rather than the periods where I managed to understand and grasp concepts much quicker than expected.

My stubbornness did not help at times. Early during the project, I attempted (Realising now, rather foolishly) to implement my own form of pathfinding, because I felt like a part of me was cheating, learning directly how to implement it, but I've come to realise that is how you need to start at times, and it's how you progress it yourself that really makes the change. I look back at the initial tutorials I watched, and while I see remnants of what I implemented then, I've also very much made those aspects I learnt into my own aspects.

Five Things I Think Went Well
  • Having only used array's in a rather ham-fisted manner before this project, what I have learnt now about array's and list's has helped me further myself so much more, and greatly improved my coding capabilities, as I also feel have been demonstrated not only in this project, but the group project we completed this year
  • My AI implementation, while having a few bumps in the road, has gone better than I could have expected. I was very nervous to tackle AI, but once I made that leap, I realised I'd been rather stupid for being nervous. As well as learning how to create basic AI using decision trees, this also helped me stop being so nervous about jumping into unknown aspects. I just wish I had learnt this sooner within the project.
  • My A* Pathfinding has also gone well. It was an area I had no real clue about, and was another area I was nervous to step into. Following a step-by-step guide, I quickly found myself getting to grasps with it, taking in the information at a steady pace. It led to the A* being implemented at a much more rapid rate than I'd expected, eventually.
  • I found myself starting to add personal tweaks to code I had recently learnt, such as the changes made to the initial tutorials, and adjustments to pathfinding. While I had minor help in areas, I do believe a lot of it has been self-driven.
  • I managed to find my own way, for the most part, with AI, after reading and understanding the basics of Decision Trees. The AI is my proudest point, having been created by myself from scratch. I have this silly sense of pride that pushes me to try and find my own path in coding, rather than relying on tutorials and guides, so being able to create this AI from nothing but a decision tree, it's meant an awful lot to me, and really helped me feel so much more confident about my coding capabilities.
Five Things I Think Went Not So Well
  • From the beginning, I believe my timeline was flawed. Before putting together my proposal, I should have dug further into some of the aspects of the code I would be undertaking, rather than researching the theory on constructing Strategy RPGs alone. This would have given me a much better idea of timescale, rather than simply applying a week or two for certain aspects.
  • Again, I had been nervous at multiple points of the project, when looking to move into new areas that appeared daunting. Had I worked up the gall to move into my AI and A* earlier, I believe I could have been much more on track with my initial timeline.
  • The self-created grid and pathfinding I attempt to implement. I spent the better part of a month or two working on this, when in the end I completely scrapped it, and went onto implementing A* Pathfinding. Had I done this sooner, again, I believe I would have been much more on track with the timeline
  • Terrain implementation. This was an area I ended up skipping over, following the wasted time pre-A* implementation. While I had initially planned for the terrain to be dealt with shortly after this, my attention turned to fully implementing the Rock-Paper-Scissor system, and that led onto the creation and implementation of AI.
  • Skill and levelling implementation. Another key area I hoped to tackle, this again got swamped over by the RPS and AI systems, due to poor time management.
Five Things I Will Take Away From This Experience
  • Throw myself into unknown depths. There is no point in me feeling fear towards new, unknown areas of code, simply because I am tackling them by myself. The time constraints put on by the fact this was a piece of university work that needed to be handed in did mildly hinder, and my timeline was always at the back of my mind, telling me to focus on other areas that I had not tackled. Moving forward, I intend to have no fear or nervousness towards new areas and aspects of code. The best way for me to learn them, is to simply get stuck in.
  • Don't let pride stop me from going to tutorials and guides. As much as I want to prove myself to be a self-efficient coder, that does not mean that every single line I write needs to be created myself. I must look at how others tackle problems I may come across, and adapt those methods to make them my own.
  • Seek out help when it's needed. I thank my lecturer Chris Janes a lot on this one. He really helped guide me when I felt lost, even when it was something simple, such as incorrect syntax. At many points, I again felt nervous, but this time seeking help, due to this being a self-driven project, I didn't want to come across as if I was still needing someone to hold my hand. But, the tit-bits of advice I recieved, the odd mistake pointed out to me, without this, I dread to think where this project would have ended. I have a terrible tendancy of getting myself wound up over issues I cannot see an answer to, but with this project, I did my best to overcome that, even when it meant asking for some external help for something I felt was so insignificantly silly I'd just make myself look like a fool asking for help.
  • Learn to judge timescales more efficiently. I have a terrible sense of time when it comes to long-term planning, and this project made that highly evident. Instead of making sure I understood the various components I would be using in my project, I skimmed over them, alloting what I believed at the time to be suitible gaps of time. In turn, I suffered for it, as evidenced by how far my project is compared to my original timeline. I believe the best way for me to do this in the future is:
  • Plan, plan, plan. While I did research into Strategy RPGs as a genre, as stated above, I did not do enough research into the various components that would go into creating one. Had I researched AI sooner, I believe I could have saved a lot of time, and the same with A*. I need to make sure I can grasp what I will need to tackle, so I can suitably set a reasonable, realistic time to it. I should have done much more in-depth research before my proposal, but, sadly, hindsight is 20/20. Now I intend to move onwards and upwards with this lesson learnt the hard way.
Overall, while the project has definitely had it's ups and downs, I truly believe that I have come out a much stronger, confident coder for it, who will take that much more time planning and researching, to ensure the outcome is that much more efficiently implemented, and solidly designed.

No comments:

Post a Comment