Game Dev - Work with screen coordinates and world coordinates

A friend and I are new to game development, and we had a discussion about world coordinates and screen coordinates.

We are following a great online tutorial series for libGDX, and they use a scaling factor of 100 PPM (pixels per meter). If you change the screen size, scaling of objects will stop working. My friend is convinced that this is not a problem, and he may be right. But I get the impression that when developing a game, developers usually have to work only with a given world coordinate system and allow the camera to convert it to the selected screen coordinates. I understand the need for reverse conversions when using mouseclicks, etc. But I believe that the placement and scaling of objects in world space.

I would like to contact this community for some professional feedback.

+4
source share
2 answers

This is one of the biggest problems with almost all Libgdx tutorials. They are great, but the conversation between pixels and meters is simply incorrect.
Libgdx offers an excellent solution for Cameraand an even better solution with new classes Viewport(which work under the hood with Camera).

/. Virtual_Width Virtual_Height ( ).
, , 2D- . , 2 , , ? , 1/10 , 10 * 2 = 20. , . , 16/9, 35.

, Viewport . Viewport, Virtual_Width Virtual_Heigth.
Viewport, ( ) (FitViewport), , Viewport (StretchViewport).

Viewport resize() width height.

, .

+3

, , )

.

.

, - . , , (1,8 243 ).

+1

All Articles