TUXDB - LINUX GAMING AGGREGATE
by NuSuey
NEWSFEED
▪️ GAMES
▪️ STEAM DECK ▪️ DEALS ▪️ CROWDFUNDING ▪️ COMMUNITY
tuxdb.com logo
Support tuxDB on Patreon
Currently supported by 8 awesome people!

🌟 Special thanks to our amazing supporters:


✨ $10 Tier: [Geeks Love Detail]
🌈 $5 Tier: [Benedikt][David Martínez Martí]

Steam ImageSteam ImageSteam ImageSteam ImageSteam ImageSteam Image
Blog post #6 - Map coordinates #2

Hello and welcome to part two of our blog post about map coordinates in Nebuchadnezzar. Today well go over the difference between screen space and world space, as well as how theyre converted into each other. Last post we discussed the map-tile coordinate systembut the coordinates described only represented an internal arrangement and didnt show outward appearance. So the user cant tell if the game is using the Staggered or Diamond coordinate systemor a completely different one. However, what we want from the game is for the player to see where all the tiles should be. Before we can show how its done, we have to explain a few concepts.

Screen space


The screen space is the area where the player can see whats on screen. Object positions in this space are in relation to the screen. Typically, this space has a screen resolution size and its units are pixels. The origin (zero) lies in the upper left corner. [x] coordinates move to the right. [y] coordinates move to the bottom. This differs from the typical space in mathematics, where the origin tends to be at the bottom left corner and [y] coordinates moves upwards.

World space


World space is the space of all objects in a game that describes their position in the world of a game. From the players point of view, its irrelevant where this space starts and what coordinate system it uses. An example would be the position of the place where the main character is standing. However, whether the player sees the hero depends on the positioning and setting of the world-sensing camera. Thats because the camera determines how the worlds objects are displayed on screen. This transfer between the world and the screen is called projection.
If we have an isometric game where each object is always on a specific tile or group of tiles, and its fixed to this positionthe coordinate system of the tiles described in the previous blog post would sufficiently represent the whole game. But this is not an example of a typical isometric game. Nor is it typical in Nebuchadnezzar. An example being: the movement of walkers moving smoothly from one tile to another. This requires walkers to sometimes be in the middle of a tile and sometimes to be between two tiles. Therefore in Nebuchadnezzar, as a world space, we must consider not only the individual tiles, but also the absolute position of each object. Yet the space of isometric tiles provides many advantagesabove all, legibility and clarity for players. Because Nebuchadnezzar is a 2D isometric game, the transformation between screen space and world space is relatively simple. The only transformations our camera applies are translations (the world will move around on the players screen) and scale (the world is rendered larger or smaller on the players screen). Whats a little more complex is figuring out which tiles belong to a given position in the world space. Of course, Nebuchadnezzar supports rotation, too, but its not done at the camera level (as is common in 3D games)but rather by rotating the entire world space and its coordinates. Well have more on this in another blog post.

Screen to world


Heres an example of a situation where we need to convert from screen space to a specific map tile: The player wants to make a building and clicks on a specific location on screen. The game must first determine the cursors position in the world coordinates. And so it applies inverted transformations (opposite to those used in rendering) to the cursors position in the screen. This will give us a position in the world space and from here we will then calculate a specific tile of the map. Again, the calculation is more complicated in the Staggered system than in the Diamond system. Now we have a specific tile and we can build the required building on itbut only if all the conditions for construction are met, of course.

World to screen


The conversion from world space to screen space is mostly applied in rendering the game, because for the player we need to depict the world as seen by the current camera. We hope you enjoyed the post. Feel free to share any thoughts, ideas or questions. Below you will again find some samples from our source code related to the operations described. Feel free to try them out in your projects. And as always, you can also read and discuss this blog post on our websites, forum or reddit. /** * @brief Get tile coordinates from world space coordinates. * * @param pos Coordinates in word space. */ N_Point Tile_Scene::pos2tile(const N_Point pos) { const int base_x = pos.x / TILE_WIDTH; const int base_y = (pos.y / TILE_HEIGHT) - (pos.y < 0); const int off_x = pos.x - ((base_x * TILE_WIDTH) + TILE_HALF_WIDTH); const int off_y = pos.y - ((base_y * TILE_HEIGHT) + TILE_HALF_HEIGHT); const bool inside = (std::abs(off_y) != TILE_HALF_HEIGHT) && ((std::abs(off_x) / (TILE_HALF_HEIGHT - std::abs(off_y))) < 2); if (inside) { return {base_x, base_y * 2}; } else { return {base_x - (off_x < 0), (2 * base_y) - 2 * (off_y < 0) + 1}; } } /** * @brief Get world space coordinates from screen space coordinates. * * @param pos Coordinates in screen space. */ inline N_Point screen2scene(const N_Point pos) const { return { (pos.x / scene_zoom_factor_inverted_) + scene_offset_.x, (pos.y / scene_zoom_factor_inverted_) + scene_offset_.y}; } /** * @brief Get screen space coordinates from world space coordinates. * * @param pos Coordinates in world space. */ inline N_Point scene2screen(const N_Point pos) const { return { (pos.x - scene_offset_.x) * scene_zoom_factor_inverted_, (pos.y - scene_offset_.y) * scene_zoom_factor_inverted_}; }


[ 2020-02-14 15:02:57 CET ] [ Original post ]

Nebuchadnezzar
Nepos Games Developer
Nepos Games Publisher
2021-02-17 Release
Game News Posts: 115
🎹🖱️Keyboard + Mouse
Very Positive (1310 reviews)
Public Linux Depots:
  • Linux Depot [24.74 M]
Nebuchadnezzar is a classic isometric city builder game inviting players to experience the mysterious history and culture of ancient Mesopotamia. In the campaign, players get to rule over influential historical cities filled with magnificent monuments.

Gameplay

From plowing fields to creating products, players must oversee the manufacturing of agriculture and goods for the city population. Players have an arsenal of tools to optimize their objectives. In addition, a maximum overview of their city helps players to solve problems and prevent population loss. Nebuchadnezzar’s gameplay is geared towards all types of players: from beginners of the genre to experienced strategists.

Campaign

Nebuchadnezzar’s main campaign contains 16 historical missions covering the colonization of ancient lands to the conquest of Babylon by Persians in 6th Century BC. Each mission summons a different time period in Ancient Mesopotamian history. Players must carry out tasks important to the specific time and place of each mission, including the construction of historical monuments.

Monuments

During the campaign players will not only build complex ancient monuments, but design them too. Nebuchadnezzar features an in-game “monument editor” giving players complete control over their buildings. From structural design to color scheme to final details: it’s in the hands of the player. Will you recreate history or make history? It’s up to you.

Mods & Localization

Nebuchadnezzar was created with mods and localization in mind. Modders will be able to create their own buildings, goods, and monuments. And in addition, they can invent new missions and campaigns. All definition files are written in the easy to read Lua language. Localizing mods will not be a problem. You can create mods in multiple languages and/or add languages to existing ones. This applies to the base game as well.

MINIMAL SETUP
  • OS: TBA
  • Processor: TBA
  • Graphics: TBA
RECOMMENDED SETUP
  • OS: TBA
  • Processor: TBA
  • Graphics: TBA
GAMEBILLET

[ 6107 ]

12.66$ (16%)
3.35$ (16%)
20.99$ (16%)
17.79$ (11%)
2.47$ (17%)
16.96$ (15%)
7.11$ (11%)
22.24$ (11%)
52.74$ (12%)
50.96$ (15%)
8.39$ (16%)
16.79$ (16%)
6.71$ (16%)
13.99$ (69%)
39.14$ (13%)
42.45$ (15%)
8.89$ (11%)
14.67$ (51%)
16.97$ (15%)
25.47$ (15%)
14.27$ (16%)
13.79$ (8%)
15.00$ (50%)
4.19$ (16%)
20.72$ (17%)
12.44$ (17%)
16.59$ (17%)
8.59$ (14%)
5.03$ (16%)
16.97$ (15%)
GAMERSGATE

[ 1061 ]

1.7$ (91%)
2.68$ (62%)
0.85$ (91%)
8.49$ (58%)
13.59$ (32%)
0.43$ (91%)
0.89$ (87%)
2.03$ (77%)
1.35$ (89%)
5.1$ (83%)
0.68$ (91%)
5.74$ (62%)
9.44$ (45%)
9.49$ (50%)
3.18$ (81%)
0.43$ (91%)
3.48$ (83%)
4.25$ (79%)
3.4$ (91%)
11.99$ (20%)
0.26$ (91%)
4.46$ (70%)
3.83$ (62%)
0.56$ (81%)
0.56$ (81%)
10.5$ (65%)
0.43$ (91%)
1.31$ (81%)
4.25$ (83%)
2.13$ (91%)

FANATICAL BUNDLES

Time left:

18 days, 9 hours, 26 minutes


Time left:

25 days, 9 hours, 26 minutes


Time left:

14 days, 9 hours, 26 minutes


Time left:

11 days, 9 hours, 26 minutes


Time left:

19 days, 9 hours, 26 minutes


Time left:

21 days, 9 hours, 26 minutes


Time left:

42 days, 9 hours, 26 minutes


Time left:

356467 days, 1 hours, 26 minutes


Time left:

24 days, 9 hours, 26 minutes


Time left:

53 days, 9 hours, 26 minutes


HUMBLE BUNDLES

Time left:

6 days, 3 hours, 26 minutes


Time left:

8 days, 3 hours, 26 minutes


Time left:

13 days, 3 hours, 26 minutes

by buying games/dlcs from affiliate links you are supporting tuxDB
🔴 LIVE