Moderators

89

14555

Moderators

64

14092

Moderators

63

10985

Moderators

40

11197

## Popular Content

Showing content with the highest reputation since 10/25/17 in all areas

1. 9 points

## Do you think game development costs will eventually go back down again?

If you think about it cost of games has gone down a lot. You can make Pack Man for the fraction of the cost when it was first released. A small home team could make a full GTA 1 clone for much less than it first cost to make. The problem is that the ambitions of developers and the expectation of players is always driving up cost. So I think making games will always be expensive. No matter how good we get at it.
2. 7 points

## System that casts base class to derived class

Generally speaking this is a bad idea. If you need to render each of these objects in a different way, there's not much point having them all in the same container, which in turn brings into question whether it's worthwhile having them derive from Renderable at all. (Deriving from a base class so that you can avoid typing out those 2 buffers for each derived class is not a good reason to do it.)
3. 6 points

4. 6 points

5. 6 points

## Game data container

No, you don't. And that is how you solve the problem. Don't try to look for one magical pattern or process to solve this issue. What you need to do is look at each of these things, and find ways to refactor to the code so that you don't need to pass them. Keep doing that until you're happy with the state of the code. An example to get you started: an Enemy class may need to be able to know where the nearest Player is, to attack it. And it might need to know about all other world objects, so it can walk around them. Instead of passing in "list of all world objects" and "list of all players", pass in a GameWorld object, and ensure that GameWorld has functions like "FindNearestPlayer" or "FindNearbyWorldObjects" so the Enemy can query for what it needs from one single object that represents the environment.
6. 5 points

## What do you think can help stop cheating in PUBG

Why can't it be? What are you basing that on? It sounds like you're just repeating things that you've heard rather than basing this on development experience? It's currently lagging because they don't have a dedicated server, so you're relying on other players on vastly different connections to share game-state instead of having a single reliable connection to a data centre. If 100 players all simultaneously fire a 600RPM rifle at a target that's 3km away, then after three seconds there will be 3000 projectiles in the air. If the server ticks at 20Hz it needs a ray-tracer capable of 60K rays/s, which isn't much - it would only consume a tiny fraction of the server's CPU budget. If every bullet needs to be seen by every client (e.g. To draw tracers) then this would cause a burst of about 72kbit/s in bandwidth, which is fine for anyone on DSL, and a 7mbit/s burst on the server, which is fine for a machine in a gigabit data centre. None of this impacts latency because that's not how that works... And if not every bullet has visible tracers then these numbers go down drastically.  I quickly googled and apparently PUBG does already run on dedicated servers in data centres? Maybe they still do client side hit detection for some reason though...
7. 5 points

## How to reduce data sizes?

Particles might number in the millions, but we don't try to send them across the network. The amount of objects you can send is proportional to the amount of data each one needs. Sorry for such a flippant answer but there's no trick or magic here. You can send as much data as your network bandwidth allows (nothing much to do with packet size, incidentally) and the less data you need per entity, and the less frequently you want to update them, the more entities you can update. To get transmission sizes down, you need to think in terms of information, not in terms of data. You're not trying to copy memory locations across the wire, you're trying to send whatever information is necessary so that the recipient can reconstruct the information you have locally. e.g. If I want to send the Bible or the Koran to another computer, that's hundreds of thousands of letters I need to transmit. But if that computer knows in advance that I will be sending either the Bible or the Koran, it can pre-store copies of those locally and I only have to transmit a single bit to tell it which one to use, as there are only 2 possible values of interest here. Similarly, if I want to send a value that has 8 possible values - i.e. the directions we talked about - that's just 3 bits. I could pack 2 such directions into a single byte, and leave 2 bits spare. Or I could send 8 directions and pack them into 3 bytes (3 bytes at 8 bits per byte is 24 bits to play with). If you're not comfortable with bitpacking, maybe read this: https://gafferongames.com/post/reading_and_writing_packets/
8. 5 points

## Will it cast?

Yes, read IEEE 754 for more detail. The range of integers that can be exactly represented by a single precision float is from -0x01000000 to 0x01000000.
9. 5 points

## When/How often should I be using forward declaration?

My personal preference is to forward declare only what I need to use, and then promote to a full dependency as infrequently as possible. So if you need to use another type, forward declare when you can, but don't just throw around declarations for the fun of it.
10. 5 points

## Weird behavior for a function with optimizations turned on

I'ma just leave this here: https://godbolt.org Also, your code has a lot of improvement to be made. Your API for GetProcessorName() is bad. Please don't ever write a function like that. You should either return a string object or fill a string buffer, but not both in one function. As you are discovering this is a recipe for confusion and unhappiness. Please don't use C-strings. You have a number of issues in this code that indicate (1) you are not familiar with how C-strings work, (2) you aren't thinking carefully enough about how you manipulate C-strings, or (3) both. For example, you confuse allocation size with string length in a couple places, and your attempts to account for NULL terminators look wrong to me. The loop style invocation of __cpuid is overly complex and needlessly busy if the CPU returns a huge number of capabilities/extended IDs. You can write this simply as a single if check and 3 successive __cpuid calls with no loop.
11. 5 points

## Is Phil Fish a Jerk?

From watching those films, I could see him as a dick but also really empathise with him and see him as someone who's under too much stress and not aware of how other people are going to interpret and twist what they say. I think he's the perfect example of consumers enjoying hating a creator, which is terrible phenomenon. I don't know him personally so I can't judge
12. 5 points

## Variadic templates and tuples of wrapped types

Off the top of my head (untested): std::tuple<TypedMap<Ts>...> Storage;
13. 5 points

## Is it possible to get STL vector like debugging features for a non STL vector class

^That^ Also as a tip for the 'watch' debugging window - say you've got something like: struct MyVec { int* begin; int* end; } MyVec v = ...; In the watch window you can type "v.begin" but it will only show the first element... So, instead you can type "v.end-v.begin" to see the size -- and let's say it's 42 -- then you can type "v.begin,42" and Visual Studio will display the entire array in the watch window.
14. 5 points

## Is it possible to get STL vector like debugging features for a non STL vector class

Yes, you can use the 'Natvis' system to customise how any type is displayed in the Visual Studio debugger. https://docs.microsoft.com/en-gb/visualstudio/debugger/create-custom-views-of-native-objects
15. 5 points

## How do people make games without a commercial engine?

Obviously it is viable - if it possible to write an engine, and it is possible to write a game using an engine, it is possible to do both. Whatever the engine-makers deemed important to create, you can create yourself. Libraries help, because they are basically pre-packaged bits of code that other people wrote, which you can use. For example, you might use a library to load 3D model formats, or to play back audio. There are many of these, and most are available for the popular programming languages like C++, C#, Java, and Python. Another word you might hear is a 'framework' - this is usually a big library, or a collection of libraries, that does lots of different things, but which works well as a whole. SDL and SFML are frameworks for C++ which give you a lot of game-making functionality for free. An engine is basically just the logical extension of this idea - it's typically a framework that is very fully-featured and which comes with its own editor which lets you create and test levels. Unity is an example of an engine that uses C# for its code, and Unreal is an engine that uses C++. If your main aim is to be productive at making games in the short to medium term, then starting with an engine is probably a good idea. Some people prefer to learn the fundamentals and like starting with a more primitive programming environment and a simpler framework - Python and Pygame is a popular pairing, for example. Each route has pros and cons. It would be a very tough job to make a game in a 24 hour jam without using at least one game framework or a bunch of good libraries, but that's not to say it isn't possible for the right person.
16. 5 points

17. 4 points

18. 4 points

## Calculating shot hit percentage based on tile distance

In order to see how quickly the value decreases with distance, I divided the value at 10 by the value at 20, and their ratio was exactly 8. So if a factor of 2 increase in distance results in a factor of 8 reduction in the value, it suggests a dependence with 1/(x*x*x). 12800.0 came from fitting a single point at distance 10. Then I saw all the other points match exactly.
19. 4 points

## Marching cubes

I have had difficulties recently with the Marching Cubes algorithm, mainly because the principal source of information on the subject was kinda vague and incomplete to me. I need a lot of precision to understand something complicated Anyhow, after a lot of struggles, I have been able to code in Java a less hardcoded program than the given source because who doesn't like the cuteness of Java compared to the mean looking C++? Oh and by hardcoding, I mean something like this : cubeindex = 0; if (grid.val[0] < isolevel) cubeindex |= 1; if (grid.val[1] < isolevel) cubeindex |= 2; if (grid.val[2] < isolevel) cubeindex |= 4; if (grid.val[3] < isolevel) cubeindex |= 8; if (grid.val[4] < isolevel) cubeindex |= 16; if (grid.val[5] < isolevel) cubeindex |= 32; if (grid.val[6] < isolevel) cubeindex |= 64; if (grid.val[7] < isolevel) cubeindex |= 128; By no mean I am saying that my code is better or more performant. It's actually ugly. However, I absolutely loathe hardcoding. Here's the result with a scalar field generated using the coherent noise library joise :
20. 4 points

## Virtuals hide information on the implementation

Are you sure this matches in your code? You need to store pointers to the objects rather than the base objects themselves. The way the language usually enforces this is for your code make the base class abstract so it cannot be instantiated. They are commonly called an ABC, or Abstract Base Class, because of this. Except in rare cases, only the endmost leaf classes should be concrete, everything below it in the hierarchy should be abstract. In that case, are you certain you are following LSP? Are the sub-objects TRULY able to be substituted for each other? Code should be able to move back up the hierarchy to base class pointers, but should never need to move back out the hierarchy, instead using functions in the interface to do whatever work needs to be done. As a code example: for( BaseThing* theThing : AllTheThings ) { theThing->DoStuff(); } versus: for( BaseThing* theThing : AllTheThings ) { // Might also be a dynamic cast, or RTTI ID, or similar auto thingType = theThing->GetType(); if( thingType == ThingType.Wizard ) { theThing->DoWizardStuff(); } else if( thingType == ThingType.Warrior ) { theThing->DoWarriorStuff(); } else ... ... // Variations for each type of thing } Also, in general it is a bad idea to have public virtual function. Here is some reading on that by one of the most expert among C++ experts. This is different from languages like Java where interface types are created through a virtual public interface. Some people who jump between languages forget this important detail. As the code grows those public virtual functions end up causing breakages as people implement non-substitutable code in leaf classes, as it appears you have done here.
21. 4 points

43. 3 points

## How to learn from Quake source code

Michael Abrashs book has a lot about quake in final chapters: http://www.jagregory.com/abrash-black-book/ It delivers a good impression of the problems at that time, what has been tried to solve them, and what finally worked good enough. The book might be better to learn than the code, and it should make it a lot easier to understand the code (i agree with others there is little value to do this in depth, but understanding the ideas behind it still makes sense.)
44. 3 points

## Is Phil Fish a Jerk?

Yes. The people putting together the documentary get to choose what lines to include, what clips to exclude, and how to edit it all together. All documentaries, news reports, and stories have bias like that. Learning to recognize them is an important skill. As for the people saying "deal with it", or "set some boundaries", I think those are the unhealthy reactions. While these situations happen in the community far too often, recognize that they are serious crimes. If you happen to live in a crime-ridden community you do need a proverbially thick skin to survive there, but that doesn't mean you should ignore the crime, do nothing to fix it, or ignore victims.
45. 3 points

Some GCN hardware have a halfed wave spawn rate if you use the Z dimension, not sure if it is still true or not. GCN again, there is an input vgpr per dimension and no combined one, at least on PS4 ( taken from a compute ISA s14 = s_tgid_x s15 = s_tgid_y v0 = v_thread_id_x v1 = v_thread_id_y ). You could look at the ISA in Pix for AMD to confirm all that on PC.
46. 3 points

## Game data container

Sounds like you're doing something wrong. I mean, sometimes I do have a need for a constructor with a bunch of parameters, but most of the time I just have 1 or 2 at most. If I do find myself with that many, then I refactor it to get rid of them. If you post an example of a constructor where you're passing in this many parameters, we can get a better idea of what we're dealing with here. It's hard to give advice about code without seeing the code.
47. 3 points

## Octagon-Square tiling for world map

Well, the good thing about 3D is that you can use as much geometry as you need to. In this case, to add a river you could simply subdivide the ground tile mesh to a proper detail level, then displace the 'river' parts downward. Then add a water tile for the water surface: You can even scatter a few doodad meshes as in the above, to 'dress up' the water's edge. Again, that tile is drawn in 3 passes: ground, then water, then rocks. (Although, in a 3D engine, if the water material is partially transparent it would typically be drawn in an alpha pass after the solids.) No complicated stitching required, just 3 meshes. (Or, 3 batches, anyway; the clutter could be built as a batch using instanced meshes.)
48. 3 points

## Game names inside of game engine

It would probably bring up trademark issues rather than copyright. This is also true if you have names that are similar but still different. It is easiest to avoid it if possible rather than have lawyers figure out if they are cleared for use, get permission, or try to defend your self in a legal fight where you would probably be forced to change it as well as pay for damages. Why are you using the name in the first place? Any reasons against changing it to something new and creative?
49. 3 points

## Steam vs. Itch.io - The industry contradiction question

There are several logical errors in your initial idea. "I am hearing that it is suicide to release your game without any marketing and that’s fine, that makes perfect sense. However, I am also hearing people who have released games saying that their sales on Steam were much much better than Itch.io. This doesn’t make much sense to me and it is a contradiction in terms of the necessity of Indie Game Marketing." No, this is purely a statement about the quantity of people that use each marketplace. If I do no marketing, sell 50 copies on Steam, and 1 copy on Itch.io, it is true that my Steam sales were much much better, but it says nothing about how valuable marketing would have been, if I'd done it. I could have sold 500, 5000, or 50,000 copies on one or either platform with marketing. It's a completely separate issue. "If my game will only go as far as my marketing efforts" Again, it's a mistake to try and draw a direct logical comparison between marketing and success. A few games do well without marketing. A few games almost entirely rely on marketing. But most games that do well have at least some marketing, and a ton of the failed games are from developers who put their game up on Steam, then said "so, how do I market my game with zero budget?" Marketing correlates with sales, because it increases your audience and your sales can only ever be a subset of your audience. It's not a guarantee, but it's not worthless either. "If Steam does, in fact, boost sales simply because it is Steam, then that implies that marketing is not 100% important." To reiterate, the fact that one factor (in this case, 'being on Steam') increases sales does not necessarily mean that (a) it always increases sales sufficiently to be worthwhile, or (b) it increases sales so much that extra marketing wouldn't help. "If I am bringing the customers to my game's storefront....if I am the only one putting all the marketing effort and marketing work into selling my game, why should I give 30% away to Steam?" Because it's not a binary situation of one extreme or the other. Sure, your marketing might drive some people to Itch and you get the full benefits. Some people however, will only buy their games from Steam, so you might have them as an interested customer but never make a sale. Wouldn't you have preferred 70% of their money than none at all? "If releasing a game on Steam, with no marketing at all, will result in $0 sales, why bother with Steam at all?" Again, it's not an extreme, or a yes/no situation. Being on Steam means several extra opportunities to access customers. Some of those customers would use Itch.io. Some would not. Sometimes being on Steam means you get on the front page and reach thousands more people. Sometimes it doesn't. "So which is true here? Releasing a game with no market is guaranteed to bring in$0 sales or does releasing a game on Steam mean that some sales will come in with no marketing effort at all, simply because you are on Steam?" Obviously I'm repeating myself but neither is true. It's not black and white. These things all interact. There reason you can read almost contradictory reports because everything is on a sliding scale and because it differs from one game to the next. All you can do is maximise your chances, and that means doing whatever marketing you can, and considering whether the 30% cost of Steam is worth it. (P.S. Please don't launch at \$4.99 unless your game is shovelware. Price higher to begin with, reduce in the sales later.)
50. 3 points

## Writing api agnostic rendering layer. How to design and where to start?

The cost of virtual functions are usually greatly exaggerated in many posts on the subject. That is not to say they are free but assuming they are evil is simply short sighted. Basically you should only concern yourself with the overhead if you think the function in question is going to be called >10000 times a frame for instance. An example, say I have the two API calls: "virtual void AddVertex(Vector3& v);" & "virtual void AddVertices(Vector<Vector3>& vs);" If you add 100000 vertices with the first call the overhead of the indirection and lack of inlining is going to kill your performance. On the other hand, if you fill the vector with the vertices (where the addition is able to be inlined and optimized by the compiler) and then use the second call, there is very little overhead to be concerned with. So, given that the 3D API's do not supply individual vertex get/set functions anymore and everything is in bulk containers such as vertex buffers and index buffers, there is almost nothing to be worried about regarding usage of virtual functions. My API wrapper around DX12, Vulkan & Metal is behind a bunch of pure virtual interfaces and performance does not change when I compile the DX12 lib statically and remove the interface layer. As such, I'm fairly confident that you should have no problems unless you do something silly like the above example. Just keep in mind there are many caveats involved in this due to CPU variations, memory speed, cache hit/miss based on usage patterns etc and the only true way to get numbers is to profile something working. I would consider my comments as rule of thumb safety in most cases though.

1. 1
2. 2
frob
15
3. 3
4. 4
MJP
9
5. 5
• ### Member Statistics

• Total Members
239400
• Most Online
6110