1
General Discussion / Re: Optimizing the Conquest: a Mathematical Model of Space Combat
« on: January 17, 2023, 12:44:05 AM »
I am not saying doing things in the ship-fixed frame is inherently wrong, and I understand how to do it that way, I just don't see why you wouldn't do it in a stationary frame. If you ever want to do stuff like model shots as projectiles with travel time, or consider dynamic motion of ships during combat, using a rotation frame results in stuff like non-accelerating (moving in a straight line) projectiles following a curved path in your coordinate system if your ship is rotating. And it certainly seems like it would be more complicated computationally and unintuitive to have to update the states of every other object in the simulation whenever your own ship moves, rather than just updating the state of your ship.
The way I would do it is just make the ship class have x,y coordinates and an angle/orientation (defined wrt a stationary frame). Then the vector between ships is just the difference in their position coordinates, and the direction of a weapon arc center is just the the angle between it and 'forward' on the ship plus the rotation angle of the ship (and you can get a unit vector from that easily). That's all very simple, and extends naturally to having ships moving around, or having projectiles modeled etc.
The way I would do it is just make the ship class have x,y coordinates and an angle/orientation (defined wrt a stationary frame). Then the vector between ships is just the difference in their position coordinates, and the direction of a weapon arc center is just the the angle between it and 'forward' on the ship plus the rotation angle of the ship (and you can get a unit vector from that easily). That's all very simple, and extends naturally to having ships moving around, or having projectiles modeled etc.