Its cool I did a partial rewrite and got it working, well lets just say 100% of the time it always gets there and say 96% of the time gets the shortest path. Theres a small glitch and I think its my gcost calculation, so what is gcost exactly is it just a simple count from the current square back to the original startsquare so e.g
<SRC> 0gc | 1gc | 2gc | 3gc | 4gc
As a very simple example?
so say current sqauare was square 3 that would have a gcost of 2? Then we add that to the HCOST which is manhatten distance e.g 1* (abs(x-destX) + (y-destY))
I do know about the breadth first algorithm and after experimenting with this one Im not too worried about using it in future. I want to learn A* inside out. I may well use breadth first but I like shortest path and want it working as well as possible because I have some unique ideas with it.
In my rl I have the following in place and its as far as I have ever been with it , however I am confident I will complete something although it wont be winning any awards
Its all win though as its for the learning:
basic mob AI - mob always gets to player (Its rough but its start)
a set of player and mob test attributes from which I will simulate some fights with the mobs adding items bit by bit(focus on tank enemy mob vs pc to start with)
a procedurally generated REALLY basic map system where all rooms are square but because of the way its done some dont always turn out that way, was unintentional but I understand exactly why its happening and it works out well so all good
The player can move in all directions and cannot move over a mob
I have detached all mob movements pc and npc from the screen array all together which has its benefits
I altered my code so I use screen handles rather than clear screen which eliminated all flickering (I am pleased with the result of this part as I just redraw the changed cells)
Ive been advised to use external librarys at certain points but I must stress this is purely for education and I would rather use libs once I have a real understanding of whats involved to really truely develop a rl from the ground up........I have taken out some pretty tough parts and I am determined at the momment. The key differance this time is I have stuck with my RL until theres a bit life about it, It is so neat seeing some little ai creation working! That has given me major incentive, also I am aware that you do not want to be giving all mobs the ability to shorrtest path to the pc but it will be good for running test fights
My development has went from ardous to fun and I can see why it is stated in one of the RL articles that what can happen is one becomes less of a gamer and more into development
I still have a HEAP to learn but I am not to bad at cutting through the layers of semantics to get to something that works in a basic fashion and I will build on that newbie base , bit by tiny bit.