-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missiles #8
Comments
I have been putting projectiles off for a while. I never really liked 3D math, but I imagine there is a clean way to map a Cartesian plane with a Z height to an isometric texture index lookup. Looking at the arrows and spears with turtle pack it seems like a projectile has about roughly 16 directions (not including the mirroring) and each direction about 10 frames which rotates the arrow / spear skyward to ground ward. When I do figure it out I will write it in a generic way that easily popped into C++ for Free AOE to use |
The graphics actually store number of angles and frames per angle, so it can just be "dynamically" calculated (iirc all of them have the same amount, though). So to find the right frame just use the normal angle <-> orientation calculation (I don't remember if the frames start from angle 0 or 90°, but should be easy to test). The annoying part (for me) is calculating the correct initial velocity and then acceleration to make it travel the correct arc. The missile-unit-data also contains a value for the initial angle it should have from the originating unit (think e. g. mangonel vs. scorpion). fwiw, here's my current (incorrect) code for calculating velocity and acceleration: https://github.com/sandsmark/freeaoe/blob/master/src/mechanics/Missile.cpp#L85 and here's the frame calculation: https://github.com/sandsmark/freeaoe/blob/master/src/mechanics/Missile.cpp#L169 |
Interesting point about the angles. Also, your acceleration math looks right. The part I can't wrap my head around is projecting Z-height to a 2D isometric projection which is why I skipped out on land elevation as well ;P |
Have you started to look into how missiles work/should work? I. e. archers, mangonels, town centers and everything else that fires something.
(To be perfectly honest this is a sneaky way to try to avoid sitting down and figuring the math properly for freeaoe. :-)
The text was updated successfully, but these errors were encountered: