I'm designing a battle engine for a game I'm working on, and I'm having problems. It's kinda like in Fire Emblim, where you click on one of your characters, then little blue squares light up on the ground, to show you where you can move. It's kinda hard because you have to avoid walls and stuff. Right now I'm making a robot draw out every possible move your character can make, but that takes up a huge amount of memory. Anyone know of an easier way to do it?
Page 1 of 1
Movement Space (I have a headache)
#1
Posted 23 October 2007 - 01:22 AM
"I'm not superstitious, I'm just a little stitious." - Michael Scott
"I'm a victim of circumstance!" - Curly
"I reject your reality and substitute my own." - Adam Savage
"Why don't you cry me a river, build a bridge, and get over it."
"I see you're drinking 1%, is that because you think you're fat?" - Napoleon Dynamite
"War is Groovy" - some violent hippie
I have about 30 unfinished mzx games, and I plan to keep it that way.
"I'm a victim of circumstance!" - Curly
"I reject your reality and substitute my own." - Adam Savage
"Why don't you cry me a river, build a bridge, and get over it."
"I see you're drinking 1%, is that because you think you're fat?" - Napoleon Dynamite
"War is Groovy" - some violent hippie
I have about 30 unfinished mzx games, and I plan to keep it that way.
#2
Posted 23 October 2007 - 01:39 AM
Probably. Last Generation in the latest DoZ did essentially that. The code was buggy, but that was mostly for the AI (later, private releases fixed this); the movement routine was intact. Still, I have no doubt that Exo put some complex work into that engine that may be above you, and it's not like anyone ever comments their MZX code.
To know more about how to help improve your engine specifically, I'd have to see your engine. I don't feel like writing my own from scratch right now, and I know that if I did you'd probably get something from me that's about as complicated (but ultimately flexible) as what you'd find in Last Generation.
"Aim for the stars. Settle for Pittsburgh."
To know more about how to help improve your engine specifically, I'd have to see your engine. I don't feel like writing my own from scratch right now, and I know that if I did you'd probably get something from me that's about as complicated (but ultimately flexible) as what you'd find in Last Generation.
"Aim for the stars. Settle for Pittsburgh."
To lie is to change the truth.
..Ignorance is to be unaware of the truth.
....Incompetence is to be unable to grasp the truth.
......And escape is to run away from the truth.
It is useless to run, since the truth is right next to you.
-Wervyn
..Ignorance is to be unaware of the truth.
....Incompetence is to be unable to grasp the truth.
......And escape is to run away from the truth.
It is useless to run, since the truth is right next to you.
-Wervyn
#3
Posted 23 October 2007 - 01:58 AM
The worst part about those is AI. Good luck with that.
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#4
Posted 23 October 2007 - 02:09 AM
It's possible. The theory is fairly simple. It's not too processor-intensive either.
Basically, find an algorithm do do that first. Once you have that done, try to apply it to robotic.
Basically, find an algorithm do do that first. Once you have that done, try to apply it to robotic.
#5
Posted 23 October 2007 - 04:03 PM
For an 2N by 2N grid around the player, set up a graph (a set of nodes (places you can stand) and edges that connect these nodes) where walls are represented by edges with a higher cost than your maximal number of walking points and use the Floyd-Warshall algorithm. N is the number of squares you can walk. I think for the all pairs problem this is the fastest unless you want to use fancy optimizations.
This will get you the minimal pathlength to each square with a complexity of O(n^3). You can then threshold the result by the number of steps you can take.
As Exo said, AI will surely give you headaches... xD
This will get you the minimal pathlength to each square with a complexity of O(n^3). You can then threshold the result by the number of steps you can take.
As Exo said, AI will surely give you headaches... xD
Everything is a potato to a degree you do not realize till you have tried to make it into fries.
- Bertrand Potato
- Bertrand Potato
#6
Posted 23 October 2007 - 05:28 PM
The way I implemented movement in Last Generation is to recursively copy block the section until a new block for each of the four directions where not blocked, and then mark an arrow signifying which direction was picked. I expanded each one one at a time, so it was a list that grew recursively (potentially exponentially, but in reality most moves end up being blocked by barriers or old moves) at one end, then went through it linearly at the other end to perform the expansions. Eventually the linear iteration catches up with the expansion and you're done - all the blocks then contain valid movement paths. I also kept a master block which determines all valid movement destinations, for moving the player.
Now scoring these blocks (for AI) is another issue. I did that as I went and only kept the best scoring block (as opposed to all of them) on each iteration. How you determine score can depend on all sorts of things, but proximity to targets is a good one (near if you want to attack, far if you want to run away). A target can be a player or another enemy if you want to heal. You can throw in additional factors to weigh this about and you can make it dynamic. The important thing is having the means to score it in place, but coming up with good balanced scoring is actually really hard >_<
Now scoring these blocks (for AI) is another issue. I did that as I went and only kept the best scoring block (as opposed to all of them) on each iteration. How you determine score can depend on all sorts of things, but proximity to targets is a good one (near if you want to attack, far if you want to run away). A target can be a player or another enemy if you want to heal. You can throw in additional factors to weigh this about and you can make it dynamic. The important thing is having the means to score it in place, but coming up with good balanced scoring is actually really hard >_<
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#7
Posted 23 October 2007 - 09:48 PM
Have you considered making your battle engine an RTS instead of a TBS? The AI for the RTS would be far easier since the enemies would require much less foresight! 
Whatever fits the game better though
Whatever fits the game better though
Respond! Vibrate! Feed back! Resonate!
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
#8
Posted 24 October 2007 - 01:18 AM
Ok, that gives me some ideas. Thanks!
"I'm not superstitious, I'm just a little stitious." - Michael Scott
"I'm a victim of circumstance!" - Curly
"I reject your reality and substitute my own." - Adam Savage
"Why don't you cry me a river, build a bridge, and get over it."
"I see you're drinking 1%, is that because you think you're fat?" - Napoleon Dynamite
"War is Groovy" - some violent hippie
I have about 30 unfinished mzx games, and I plan to keep it that way.
"I'm a victim of circumstance!" - Curly
"I reject your reality and substitute my own." - Adam Savage
"Why don't you cry me a river, build a bridge, and get over it."
"I see you're drinking 1%, is that because you think you're fat?" - Napoleon Dynamite
"War is Groovy" - some violent hippie
I have about 30 unfinished mzx games, and I plan to keep it that way.
Share this topic:
Page 1 of 1

Help










