desocupado
Magister
- Joined
- Nov 17, 2008
- Messages
- 1,802
...it was machine gun fire.
START OF WALL OF TEXT, NOT NEEDED FOR HELP WITH THE ISSUE, SKIP IT IF YOU WANT
First shot was that I did not put all my units and abilities on paper before starting.
"Duh, that's so obvious, you moron!"
Well, it's obvious to me too. NOW, not before.
The second shot was that my functions got too big. They do not do a small simple thing, like it was preferable. The function to get a target, not only get's a target, but checks if it's a valid target, and ignores clicks on empty squares. At first, it looked good, and contained, but now I see it limits the functions usefulness. Halfway through where I am right now, I realized that, and started doing minimalistic functions, but the damage was done on the old ones.
The third shot was consequence of the first, I ended up not preparing the code for shit I would have to implement, so my attack code ended up a MESS, with checks for special cases, which would not be a problem if I had one or two, but noooooo... I had to give 2 weapons for almost all units, make some units ignore cover, make infantry do no damage to armored targets, ah, but anti-tank infantry DOES damage to armored targets, so what do I do?
A special check inside a special check? He, I did not do that, but solving the issue was not pretty.
Which leads me to the fourth and last shot, which is consequence of the second, my functions are not AI code friendly. The AI doesn't need to ignore clicks, nor it needs to receive a message when it tries to attack it's own units. But my attack and move functions already include that, so I need to write new functions for the AI.
Although I can barely look at the mess I made, I have right now, 8 working units, 1 pending to be implemented (troop transport), and it's not much trouble to implement more. The game already supports cover, I just need a way to put maps and cover info in it, shouldn't be a problem.
So, I want to finish it. And need help with the (not yet implemented) AI.
----------------------------END OF WALL OF TEXT----------------------------
How do I make an AI move in a vector direction?
Once the (future) AI picks one of it's units, it will move it in the direction of it's (the unit) preferred target. I can make the direction a vector, by subtracting the target position from the unit, and maybe make it a unitary vector (in math, it has no value, only a direction, has a special name, but I don't know it in english)
I want the AI to move in that direction but I can't think of a way to do that. Especially since the AI will not be able to choose exactly the direction of the vector, because of the square based map.
I'm using x + y = move_range, so I need to make the AI pick a position within range, but in the vector's direction, impassable terrain is not a problem, there's none.
Any thoughts? What those jap fuckers do to make their units move in those FFT or Tactics Ogre games, because that's exactly what I need, movement-wise.
START OF WALL OF TEXT, NOT NEEDED FOR HELP WITH THE ISSUE, SKIP IT IF YOU WANT
First shot was that I did not put all my units and abilities on paper before starting.
"Duh, that's so obvious, you moron!"
Well, it's obvious to me too. NOW, not before.
The second shot was that my functions got too big. They do not do a small simple thing, like it was preferable. The function to get a target, not only get's a target, but checks if it's a valid target, and ignores clicks on empty squares. At first, it looked good, and contained, but now I see it limits the functions usefulness. Halfway through where I am right now, I realized that, and started doing minimalistic functions, but the damage was done on the old ones.
The third shot was consequence of the first, I ended up not preparing the code for shit I would have to implement, so my attack code ended up a MESS, with checks for special cases, which would not be a problem if I had one or two, but noooooo... I had to give 2 weapons for almost all units, make some units ignore cover, make infantry do no damage to armored targets, ah, but anti-tank infantry DOES damage to armored targets, so what do I do?
A special check inside a special check? He, I did not do that, but solving the issue was not pretty.
Which leads me to the fourth and last shot, which is consequence of the second, my functions are not AI code friendly. The AI doesn't need to ignore clicks, nor it needs to receive a message when it tries to attack it's own units. But my attack and move functions already include that, so I need to write new functions for the AI.
Although I can barely look at the mess I made, I have right now, 8 working units, 1 pending to be implemented (troop transport), and it's not much trouble to implement more. The game already supports cover, I just need a way to put maps and cover info in it, shouldn't be a problem.
So, I want to finish it. And need help with the (not yet implemented) AI.
----------------------------END OF WALL OF TEXT----------------------------
How do I make an AI move in a vector direction?
Once the (future) AI picks one of it's units, it will move it in the direction of it's (the unit) preferred target. I can make the direction a vector, by subtracting the target position from the unit, and maybe make it a unitary vector (in math, it has no value, only a direction, has a special name, but I don't know it in english)
I want the AI to move in that direction but I can't think of a way to do that. Especially since the AI will not be able to choose exactly the direction of the vector, because of the square based map.
I'm using x + y = move_range, so I need to make the AI pick a position within range, but in the vector's direction, impassable terrain is not a problem, there's none.
Any thoughts? What those jap fuckers do to make their units move in those FFT or Tactics Ogre games, because that's exactly what I need, movement-wise.