New answers tagged

1

Your first problem can be solved by implementing a custom list object or (as you only need three items) a custom tuple object instead of the default List<>. This way when you insert tiles you can do a quick sanity check to make sure the tiles are at a 120 degree angle. Something like: public class NeighbourTuple { private Node city1, city2, city3; ...


1

This code appears to be JavaScript. Since ECMA-262, JavaScript has a native BigInt class. It works with all the basic math operators +, -, *, /, % and ** (division will round to 0). It also works with the comparison operators like ==, >, <= etc. It can be expressed as a literal by using the suffix n. (const ONE_NONILLION = ...


1

I managed to solve the triangle rendering problem via changing ClearDepthStencilView() 0u to 1u const FLOAT clr[] = { 0.0f, 0.5f, 0.5f, 0.0f }; pContext->ClearRenderTargetView(pRenderTexture->GetRenderView().Get(), clr); pContext->ClearDepthStencilView(pRenderTexture->GetDepthView().Get(), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1u, 0u)...


0

Games like Dark Souls save your inventory each time it changes. I don't know how they deal with app closing or crashing during a write, but I have tried randoms ALT+F4 and the system look robust to me. So the idea isn't new. I, personally, prefer to keep everything in RAM and write to disk on save game, until that proves to be too inefficient (never happens)...


1

Usually games and game engines will upload vertices, textures and other render-relevant data to the graphic card once by putting it into buffers. Those then stay in the GPU RAM until the game tells the GPU it won't need that data anymore. This is the reason why graphic cards require several GB or RAM: So games do not need to pass all the vertices through the ...


1

Pombal gives a very good answer, but I'd just like to add a note to it. Like your textures, sounds, and other game-related data, strings are also a resource. Lots of game engines allow you to load and unload resources in groups... that is, you can have a global group (this stuff is alive for the duration of a play session), and then more specific groups ...


2

To address your initial concern, unless you are targeting older generation consoles or embedded devices, you probably don't need to worry about fragmentation. With that said, one way you can address the problem is to have a dedicated memory pool for strings which are then interned. With string interning in C, you create a hash table where the keys are ids ...


-1

Positive angles of rotation follow the “Right Hand Rule.” Place your right hand with palm at origin and fingers along positive x-axis. Curl your fingers toward the positive y-axis. The direction your fingers curl is a positive angle by convention.


1

While this depends a lot on the amount of your items and the data associated, I do not see much issue with using an EAV solution - anything currently in use will be stored in RAM as regular old objects, all the "heavy" database interaction happening only whenever inventory is loaded/unloaded as the player enters/leaves the game. If you insist on more ...


38

When you are comming from non-game application development, then you need to be aware of a couple things. Relational databases have a niche role in game development. You really only need them when you have a massive multiplayer game where most of your players are offline most of the time. There are also some niche applications like online scoreboards or ...


1

As I understood it, i would make a table "Inventory" this table would contain just things like "ID", "Reference to the item" and then also additional columns like "durability", "attribute1", "attribute2".


2

Why have we arrived at the convention that rotations should be counter-clockwise then, even in engines where positive y is down? Have we? Let us try CSS: const box = document.getElementById("box"); function step(timestamp) { let deg = timestamp/10; box.style.transform = "rotate(" + deg + "deg)"; window.requestAnimationFrame(step); } ...


Top 50 recent answers are included