Skip to content
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

Configure camera boundaries based on map size #1722

Open
6 tasks
heinezen opened this issue Dec 3, 2024 · 3 comments
Open
6 tasks

Configure camera boundaries based on map size #1722

heinezen opened this issue Dec 3, 2024 · 3 comments
Labels
area: renderer Concerns our graphics renderer area: simulation Involved in the game mechanics and simulation improvement Enhancement of an existing component lang: c++ Done in C++ code

Comments

@heinezen
Copy link
Member

heinezen commented Dec 3, 2024

Required Skills: C++

Difficulty: Hard

Since the implementation of #1682, the area the camera can move in can be limited by boundary coordinates. Currently, the boundaries are hardcoded into the initialization of the camera manager to exactly match the (also hardcoded) map size of our demo game. However, for the future, it would be nice if the camera boundaries would adjust dynamically based on the current map size. This requires that we can transfer the map size and coordinates to the renderer thread and the camera manager.

Passing the information to the renderer should follow the exact same flow as the other simulation -> renderer communication in the level 2 renderer (see the associated architecture documentation).

Tasks:

  • Renderer thread:
    • Create a new render entity subclass for the camera that can receive updates from the game simulation. The only update the renderer entity needs to receive for now is the 4 coordinates of the terrain map.
    • Check for updates from the render entity in the camera manager and, if there are any, update the camera boundaries
  • Simulation thread:
    • Let the simulation thread create camera render entities via the RenderFactory
    • Update the render entity with information from the simulation, i.e. pass it the map coordinates. For now, this only has to be done once, when the map is initialized first. Later, we can make this update more dynamic, so that the render entity is updated if the map size changes

Further Reading

@heinezen heinezen added improvement Enhancement of an existing component area: renderer Concerns our graphics renderer lang: c++ Done in C++ code area: simulation Involved in the game mechanics and simulation labels Dec 3, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in openage renderer Dec 3, 2024
@jere8184
Copy link
Contributor

so the size of a map is given by a vector2? hence one of the points will always be zero, zero; or am I missing something. And if so wouldn't we only need to pass the vec2 and not the four points mentioned in this description, from game simulation to renderer?

@heinezen
Copy link
Member Author

heinezen commented Dec 12, 2024

Yes the map size is a vector2, but why would one of the points be (0,0)? Do you mean because it's the map origin? There is no guarantee that the origin of the map will be at (0,0) in the scene at all times. The map could move or shrink in physical space. Hence you should always pass 4 coordinates. You eventually need 4 points anyway, so no reason to not do that.

@jere8184
Copy link
Contributor

Do we currently store the four coordinates (or origin) anywhere? I couldn't find them when I originally looked into solving this, which led me to ask my first question :p.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: renderer Concerns our graphics renderer area: simulation Involved in the game mechanics and simulation improvement Enhancement of an existing component lang: c++ Done in C++ code
Projects
Status: 📋 Backlog
Status: 📋 Backlog
Development

No branches or pull requests

2 participants