Hot answers tagged

48 votes

How can bays and straits be determined in a procedurally generated map?

Here's a rough idea using image processing transformations to isolate the features of interest: Apply a flood fill from an ocean cell to make a mask of all ocean cells. Depending on how your rivers ...
DMGregory's user avatar
  • 134k
37 votes
Accepted

Best practice for map coordinate system

Most games place the map origin in a corner. The main reason for this is that tilemaps are often internally stored in two-dimensional arrays, and most programming languages don't allow negative array ...
Philipp's user avatar
  • 119k
36 votes
Accepted

From a game design point of view, what are the implications of using realistic distances in an open world map?

Almost no game uses realistically scaled maps for cities. The problem with creating cities which are even close to the size of real cities is: Maps become difficult for the player to navigate. They ...
Philipp's user avatar
  • 119k
30 votes
Accepted

How can bays and straits be determined in a procedurally generated map?

The way Dragons Abound identifies bays is to walk along the coastline and find two spots on the coastline where the straight-line distance between the spots is less than the distance along the ...
Dr. Pain's user avatar
  • 416
18 votes
Accepted

What are good algorithms to generate borders / state areas on 2d star maps?

I think the Voronoi idea is a good one. Each star becomes a seed point for Voronoi, and then the Voronoi regions show the areas owned by each faction. However, there are some changes that will make it ...
amitp's user avatar
  • 6,036
15 votes
Accepted

How can I generate a (relatively) linear dungeon path?

Requirements You want multiple paths from A to B. You want to work in grid space, presumably this is tile space for your side-scroller. You don't want paths to cross, or it will spoil game ...
Engineer's user avatar
  • 29.4k
12 votes

Best practice for map coordinate system

In theory the location of the origin doesn't matter. All math operations you do when the map is rendered or when objects move on the map work fine regardless of where the origin actually. However in ...
Alan Wolfe's user avatar
  • 2,353
12 votes

Why are spherical worlds so rare?

Because spherical maps, compared to rectangular ones, create a lot of additional complexities regarding the technical implementation and the UI design while usually offering very little gameplay ...
Philipp's user avatar
  • 119k
11 votes
Accepted

How to use the SDL viewport properly?

My guess is you're trying to implement a camera, and should not be using SDL Viewports. The viewports are for UI elements like menus, minimaps, etc. It's a way of dividing up the screen into multiple ...
amitp's user avatar
  • 6,036
11 votes
Accepted

Efficient Algorithm for the boundary of a set of tiles

Finding an algorithm is usually best done with a data structure that makes the algorithm easy. In this case, your territory. The territory should be an unordered (O(1) hash) set of borders and ...
Yakk's user avatar
  • 371
9 votes

Efficient Algorithm for the boundary of a set of tiles

If you need to find edges of holes in the middle of your territory too, then your linear in the area of the territory bound is the best we can do. Any tile on the interior could potentially be a hole ...
DMGregory's user avatar
  • 134k
8 votes

From a game design point of view, what are the implications of using realistic distances in an open world map?

You've already removed the main negative of a 1:1 scale map by focusing it on a small area instead of an entire city or countryside, but a citadel is still on the large side. The biggest issue here is ...
user3757614's user avatar
7 votes

How to make a map (game world) based on a real world place or city?

Here is the map of Chicago from Watch_Dogs: And here is the map of Chicago from Google Maps: As you see, these maps don't have much in common. When seen from a birds-eye perspective there isn't even ...
Philipp's user avatar
  • 119k
7 votes

Efficient Algorithm for the boundary of a set of tiles

Notice: Whether or not a tile is on the boundary only depends on it and its neighbors. Because of that: It is easy to run this query lazily. For instance: You do not need to search for the boundary ...
Theraot's user avatar
  • 26.2k
7 votes

Elegantly transition from 4-grid to 6-grid and back

This is most intuitive way that I can think of.
Shadows In Rain's user avatar
6 votes
Accepted

Procedural terrain generation in cylindrical (2D) world

As mentioned in the comment, I figured what you required was wrappable noise. With wrappable noise, you can generate seamless textures and game worlds. You are probably familiar with generating 2D ...
jgallant's user avatar
  • 8,394
6 votes

zoom to cursor calculation

I couldn't figure out what Konrad's variables were supposed to mean in my game (map width? My map is infinite, so... that's the same as the screen width then maybe? It didn't work out), so I figured ...
Luc's user avatar
  • 172
6 votes
Accepted

Finding all hexagonal grid coordinates inside cover arc

I prefer to do hex-cell coordinate math in what Amit calls cubical coordinates on your linked page. For the rest of this answer, (X, Y, Z) will refer to cubical coordinates. Basically, for any of ...
Jimmy's user avatar
  • 9,029
6 votes

How can bays and straits be determined in a procedurally generated map?

Basically, you need to think about what you mean, precisely, by a bay or strait, and why you want to differentiate them (is it for AI calculations, or to label landmarks, or something else?). Play ...
Autolykos's user avatar
  • 161
5 votes
Accepted

How do I create a custom collision map for clickable areas on a map?

Convert your image to grey-scale. Make sure you have no two states that have the same grey. (You have to tweak the image.) Have an infrastructure that maps the grey colour to a state. Then when you ...
Vaillancourt's user avatar
  • 16.3k
5 votes

Big maps with deep zoom and pan

If you have access to shaders, you can invert the drawing logic. Normally you loop through tiles and draw each one. When you're zoomed out there are a lot of tiles to draw. Zooming out is slower. ...
amitp's user avatar
  • 6,036
5 votes

I need a map generation algorithm for towerdefense

Recently I worked on the map generation algorithm for a tower defense game. The approach I took was to take a maze generation algorithm and use the solution path as the path that creeps follow. This ...
congusbongus's user avatar
  • 14.8k
5 votes

Are huge, static objects like environment transmitted from server to client in modern multiplayer games?

Depends on several factors, including the kind of game (I'll assume RTS here, though open world MMO also comes to mind). A base, local-to-player terrain state is either sent on connect, or is part of ...
Engineer's user avatar
  • 29.4k
4 votes

Are huge, static objects like environment transmitted from server to client in modern multiplayer games?

As to your exact question as asked, I do not know how League of Legends specifically handles it. I have never played that game, so I cannot suggest whether or not it needs to. But the answer to your ...
Aaron's user avatar
  • 143
4 votes

What are good algorithms to generate borders / state areas on 2d star maps?

One of many methods is an influence map. You can search for specific code implementations, but the basic algorithm is fairly simple. For each faction object (e.g. star system), assign a positive (hot)...
J'Eight's user avatar
  • 41
4 votes
Accepted

Level design / lore writing - how to compel player to go through all locations in a star-shaped level

If you want to make sure the player must go through several locations, then each of those locations must have something that is required to progress in some way (abilities, keys, knowledge, etc). If ...
Ed Marty's user avatar
  • 5,229
4 votes

How can I correctly map a texture onto a sphere?

The default sphere in Unity has its UV coordinates mapped like this: You can see that the "v" coordinate (green) acts like a latitude, increasing from 0 at the bottom of the sphere (black/...
DMGregory's user avatar
  • 134k
3 votes

Big maps with deep zoom and pan

You can create something like level of details for this. There are three ways you can handle this: I. Create tiles that will cover the same amount of screen but have smaller resolution. You stay with ...
user81986's user avatar
  • 173
3 votes
Accepted

ScreenSize vs. WorldSize

The difference between ScreenSize and WorldSize is part of the brilliance of graphics systems like OpenGL. ...
spectacularbob's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible