Use y-down coordinate system for breakout example #22

Open
opened 2023-07-23 17:39:42 +00:00 by bvisness · 2 comments
Owner

The y-up coordinate system makes lots of logic more confusing and requires us to flip many things upside down in rendering. It's very strange. I don't think a simple example like this needs a different coordinate system anyway.

The y-up coordinate system makes lots of logic more confusing and requires us to flip many things upside down in rendering. It's very strange. I don't think a simple example like this needs a different coordinate system anyway.
bvisness self-assigned this 2023-07-23 17:39:42 +00:00
Collaborator

Does that hint to the need for better coordinate transform API, or is that only that it's simpler to use the default y-down in that specific example?

More generally what do you think about default top-left, y-down? I was using bottom-left, y-up before, and it does feel more natural to me when just drawing stuff, but then the top-left, y-down system is way more intuitive with UI layout stuff.

Does that hint to the need for better coordinate transform API, or is that only that it's simpler to use the default y-down in that specific example? More generally what do you think about default top-left, y-down? I was using bottom-left, y-up before, and it does feel more natural to me when just drawing stuff, but then the top-left, y-down system is way more intuitive with UI layout stuff.
Author
Owner

In general I prefer top-left, y-down for anything 2D or "UI-like". But I suppose it's worth thinking about how we might help with y-up use cases.

I can imagine for example that a 2D platformer would want to use y-up and have a world origin that translates around based on the camera. But such a 2D game would also want to be able to render images and text right side up without fussing.

I think the real issue is that the pong example uses the milepost graphics matrix stack as the means by which you implement "world coordinates". I don't think you actually want that. If I was making a 2D platformer I would probably do my game logic in "world coordinates", do a world space -> screen space position transformation entirely in my code, and then use the milepost graphics transforms to position things in screen space only.

I wonder how Raylib does this...

In general I prefer top-left, y-down for anything 2D or "UI-like". But I suppose it's worth thinking about how we might help with y-up use cases. I can imagine for example that a 2D platformer would want to use y-up and have a world origin that translates around based on the camera. But such a 2D game would also want to be able to render images and text right side up without fussing. I think the real issue is that the pong example uses the milepost graphics matrix stack as the means by which you implement "world coordinates". I don't think you actually want that. If I was making a 2D platformer I would probably do my game logic in "world coordinates", do a world space -> screen space position transformation entirely in my code, and then use the milepost graphics transforms to position things in screen space only. I wonder how Raylib does this...
bvisness added this to the Jam MVP milestone 2023-08-09 17:21:05 +00:00
Sign in to join this conversation.
No Label
macOS
windows
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hmn/orca#22
No description provided.