Hot answers tagged

138

Just some quick additional suggestions, that sometimes complement what others have already said. 1) water solution: I never understood why killing the player with a shark or something. Just let him/her swim infinitely (like with a proceduraly generated infinite ocean). That alone would closer resemble the idea of how distant it would be in real life to ...


68

Different games have different requirements in how realistic they are to their genre, e.g. FPS games can constrain to a building, whereas RPG games like Rust / DayZ / Skyrim have larger and more open world maps to suit their style. Some common ones across games (and examples) include: Constrain to an Island and: Ruin the only bridge out (GTA 3, Vice City, ...


56

I am a bit hesitant to add this option, but it could work. Torus. When seen in 2D (neglect height for a moment) the inside AND the outside of a torus are endless. They simply wrap around on both axes. Placing your characters on a shape like that could be tricky. You could always go easy on yourself and get a less exact torus. (source) Now we're talking ...


54

Well now - what a simple but interesting question to tackle. When reloading a level there are so many factors that need to be taken into account that the answer can go many ways. If your level state contains a large list of assets it can be more practical to start from a clean slate when reloading a level back to a save/mission state as this maintains the ...


49

Basically, you just need to put something at the edge of the world that the player can't move past for some reason. Anything will work, as long as it stops the player from going any further in a particular direction while using the actions allowed by your game. You seem to be looking for a comprehensive list, so here you go; I think this covers all the ...


44

Depends on the game. In a obstacle course/parkour type game against a time limit it's common to add checkpoints that add to a time limit which is tight enough to that a big mistake will cause failure. In a puzzle game however like your example then just letting the time run out is a better idea. It's probably also a good idea to let them undo actions that ...


34

When working out the maths and solving for the Level conditional on experience XP, we obtain: $$Level = \frac{1 + \sqrt{1 + 8 \times XP \div 50}}{2}$$ For example, what is the player's level for \$XP = 300\$? $$ \frac{1 + \sqrt{1 + 8 \times 300 \div 50}}{2} = 4 $$ As requested. Or, what is the level for XP = 100000? $$ \frac{1 + \sqrt{1 + 8 \times ...


31

Flat Earth The Earth is flat, so why not border the world realistically; A cliff that falls into space.


27

Caves. No start, no end, no invisible walls. There will be no obvious 'walls designed to keep the player from leaving the playing area', since you're in a cave. All walls are the same.


26

To briefly answer your main question first, the main advantages of a procedurally generated game world are that: The world can be huge, much larger than any manually designed game world could possibly be. The world (or at least parts of it) can be regenerated for each game, potentially increasing replay value, since the player will always have something new ...


26

First of all, you should measure where exactly the bottleneck is so you don't waste time improving things which are already good enough. The bottleneck could be any of these: Reading the XML file from the hard drive Your XML parser parsing it Your code which interprets the output of the XML parser and converts it into your internal data structures The ...


25

The simple and generic solution, if you don't need to repeat this calculation millions of times per second (and if you do, you're probably doing something wrong), is just to use a loop: expLeft = playerExp level = 1 while level < levelCap and expLeft >= 0: expLeft = expLeft - expToAdvanceFrom(level) level = level + 1 if expLeft < 0: level =...


22

Kill the player Death is an easy way to tell the player they have made a big mistake. And you save them the trouble of restarting by restarting for them. An easy way to retro-fit death into a scenario is to introduce a deadly time-constraint, like water flooding, or walls closing-in. Your imagination is the limit!


21

A very interesting example is in the first scene of Fallout 4 : You are in your normal house during a normal day and suddenly there are news reports and alerts of nuclear bombs (the beginning of the nuclear war of 2077). You are then tasked to go to the nearby vault as soon as possible. But you can take a long time to do so if you wish. The relevant part is ...


14

To clarify the existing answers against your question about consoles: they don't have enough memory to store both the starting state and current state for larger complex games. A game could store the level and initial state separately so that just the state could be restreamed in, and this is very likely what many games do. Even streaming just that is ...


14

Include leaving the game area in your story. Perhaps those pesky guards wont let you leave the city. Perhaps the front door or gate is blocked/locked. It might not all be impossible, but still hard to leave the game area. What happens when the player does leave? You win the game! (but perhaps there is another better ending?) The point is the player need ...


13

A "you have no chance" message can be a pretty jarring break of immersion. If the user is really trying to figure out how to beat the level, his/her mind is deep in their mental model of what is going on. Such a message would be interrupting. If you do want to do this my advice would be one of: Bring the message up slowly, perhaps as just a warning blip ...


12

Asking how many levels to include in a game is sort of like asking how many paragraphs to include in your essay, or footsteps to take in your journey. Once you have a clear idea of your destination and your path, the question answers itself. But it is a question worth considering because it leads to some interesting observations about game design. What is ...


11

There are many terms for "level" nowadays, depending on the genre of the game and also the preference of its designer(s). Level typically means a secluded, in itself complete portion of the game, mostly independent of the rest; when I hear level, I think of 2D platformers exclusively. For the first or third person shooter genre, levels are more typically ...


11

The question has been answered with code, but I think it should be answered with math. Someone might want to understand instead of just copy and paste. Your system is easily described by a recurrence relation: $$ \text{XP}_{\text{Level}+1} = \text{XP}_{\text{Level}} + \text{Level} \cdot \text{Threshold} $$ Which offers a nice simple closed form solution ...


11

Tell the player, then save them. A good example how to do this well is the Portal series. Despite the very well thought out puzzle designs where most mistakes can either be fixed or results in immediate death, there are a few situations in the game where the players can trap themselves or screw up the puzzle in a way that it can not be solved. The ...


11

A neat trick I've seen in a game from the past (Ultima 7): make the entire world map seamless, namely once the player has reached an edge, (s)he gets teleported to the opposite side. This technique could work pretty well also if your map is surrounded by water, without the need of blocking the player o killing him/her.


10

Here's one approach to solving the problem using basic algebra. If you don't care about the steps, skip to the bottom. An easy thing to come up with is, given a level n, the total experience e needed to obtain that level: e = sum from k=1 to n of (t(k-1)) The t term stands for the increase in XP needed per level - 50, in the example. We can solve the ...


9

I can give more insights on this since I worked on it. We were indeed using a level editor similar to what's described in Tim Holt's answers: levels are built in 3D but all objects are flat, and the projection is orthographic. But there is more than "a set of 2D sprites". The way UBIart worked at that time (I'm sure it evolved quite a lot today with the ...


9

Your question is very general to being with, so a specific answer (like mountains, water, or caves) can't really be given as we don't know what specific setting you are talking about. A general answer would be to incorporate things from the environment into the border. Some examples would be: A city. Construction can block exits. The wilderness. As you ...


7

Advantages of Procedural Generation Can easily scale your maps / designs to truly large sizes, much larger than you could create by hand. By creating a system where chunks of terrain are created on the fly, you can avoid having to write pieces of code to load in chunks from permanent memory. Over the long term, you may be able to discover more viable ...


7

I disagree with much of Blue's answer, I do not believe there is a technical case for not resetting levels - I certainly never encountered one. Level loading is almost always slower than level resetting, in fact I find it difficult to conceive of an occasion when it wouldn't be. In most cases games could offer effectively instant level loading if the devs ...


7

Most games don't have a separate class for each level. The usual way is to store the layout of each level in a file. These map files contain the environment and the positions and properties of all objects in it. When a level starts, the map file is loaded and a Level object is initialized with the data from that file. When the player finishes the level, ...


7

Despite it being used for virtually everything, and despite it being used even in high-volume, low-latency applications, XML is an abysmal format for almost everything, but in particular for applications that have timely constraints, including games (except maybe for storing the game's settings). Even for live data, a simple binary tagged format which ...


6

There is another option. The player and the level are both members of the game object. However, I think the most common practice is to make the player an object inside the level. This has numerous benefits. For example, the level will process collisions between objects. Adding all the objects into the same level pool allows you to reuse the collision code ...


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