Oleksii-Kshenskyi / runger

A hunger games style genetic simulation/game/research in Rust + Bevy.
The Unlicense
1 stars 0 forks source link

Implement line of sight (field of vision) mechanics #10

Closed Oleksii-Kshenskyi closed 6 months ago

Oleksii-Kshenskyi commented 3 years ago

Each player can see what's happening in the direction it's looking. They see in a line directly in front of them, and they see the very first thing in the direction they're looking. For example, if there is another player in the direction they're looking at, but 3 tiles away, the thing they see is that player. If there is nothing but a wall in that direction, effectively they see nothing. If there's food 7 tiles away in that direction, then they see food etc.

Effectively, for now walls only serve as an entity blocking the vision of a player. In the future, they can potentially be used by players for something more useful.

Oleksii-Kshenskyi commented 6 months ago

This is blocking both #31 and #21. For now, it just needs to be the most basic thing possible: players only see in a straight line (although it could be long, like 4 or 5 tiles forward). This is the easiest thing to implement and lets the player have basic mechanics based on line of sight already.

In the future, I should consider implementing different types of line of sight, like a cone shape or even a circle/square all around the player. For now this is the very basics to get me started on implementing genetics in #21.

Oleksii-Kshenskyi commented 6 months ago

SPECIAL NOTE: As there are no mechanics that depend on line of sight in the simulation yet (obviously, as line of sight itself is not implemented yet), there are going to be issues with reliably testing this. For now, I should set both the looker and the looked at players' colors to something different for a single turn, just to indicate that a line of sight action has been triggered. In the future, instead of just flashing a different color, this mechanic is going to be used in various decision making by the players, like in #31 for disengaging if a player is afraid of being killed.