Einheri
08-27-2005, 05:35 AM
Hi, I've been working on a graphic adventure game in Java for a short while now, and I've just about botched together a working A* Algorithm that I intend to use for the point and click walking in the game. However, I'm still a bit unsure as to how to implement it. I've never seen any information on how these games are made, so I have no idea how the 'pros' do it, which means I've had to come up with a few guesses.... none of which seem like the best way to do it.
My main idea at the moment is to have a pre-defined network of nodes for each scene (perhaps detailed in an XML file, methinks) and then to dynamically create nodes at both the position where the player sprite is, and where the user has clicked. The only problem with this is, I'm unsure as to how I would determine the neighbour nodes of the two dynamic ones. I've thought about a system of finding the nearest nodes, but this is unsatisfactory, as those nodes could be behind an obstruction, or something.
Another Idea I had was to dynamically create a whole uniform grid of nodes every time the user clicks to walk anchored around the start and end positions, and putting nodes on the closed list based on an image with the no-go areas blacked off. This seems amazingly inefficient, though.
Right, so none of these seems quite right, so I'm hoping that someone here has a better head for these things than I do! does anyone have any suggestions as to how I'd go about doing this?
Thanks a lot.
My main idea at the moment is to have a pre-defined network of nodes for each scene (perhaps detailed in an XML file, methinks) and then to dynamically create nodes at both the position where the player sprite is, and where the user has clicked. The only problem with this is, I'm unsure as to how I would determine the neighbour nodes of the two dynamic ones. I've thought about a system of finding the nearest nodes, but this is unsatisfactory, as those nodes could be behind an obstruction, or something.
Another Idea I had was to dynamically create a whole uniform grid of nodes every time the user clicks to walk anchored around the start and end positions, and putting nodes on the closed list based on an image with the no-go areas blacked off. This seems amazingly inefficient, though.
Right, so none of these seems quite right, so I'm hoping that someone here has a better head for these things than I do! does anyone have any suggestions as to how I'd go about doing this?
Thanks a lot.