# Leaderboard

Moderators

26

14551

Moderators

14

10979

Members

10

1142

Moderators

9

8536

## Popular Content

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

1. 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...
2. 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.
3. 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 :
4. 3 points

## specular aliasing bc5 textures

That is the approach suggested in the original Toksvig whitepaper, but it's not the only way to do it. These days it's quite common to pre-compute the modified roughness value, and "bake" that into your roughness map. Since roughness maps are fairly ubiquitous now that almost everyone has moved to microfacet specular models, you can basically get your specular AA for free by baking into the roughness map.
5. 3 points

## 22_racing_series_video_game_future_physics_racer_09_sm[1].jpg

From the album Screenshots 2016

6. 3 points

## A good key list for User Rebindability

Windows actually provides an API for retrieving the names of keys - GetKeyNameText(). A quick search found some old C++ example code at: http://www.setnode.com/blog/mapvirtualkey-getkeynametext-and-a-story-of-how-to/ - you probably don't need to worry about XP compatibility any more. To use it from C# you'll probably want something like the example code at: https://stackoverflow.com/questions/38584015/using-getkeynametext-with-special-keys
7. 3 points

## Yet Another Pong

* Moderator hat on* This is a gentle reminder that we are in the For Beginners forum, discussing a project being implemented by a beginner asking for help with is code. Discussion on the poorly-defined meanings of object oriented-ness are not appropriate. Discussions in For Beginners should be focused on the actual problem the beginner is having. * Moderator hat off* Now, on to the updated code. I think that code is much more readable, even though it takes up more lines. Hopefully you agree, as it is your code and you're the one who gets to live with it. If I use the code-collapse feature of my IDE, the code is broken up into easily understood blocks: main(), Initialize(), Move_ball(), AI_Movement(), Player2_Movement(), and Reset_all(). I can look at that and understand your game. Expanding any one of those gives me logic that I can easily understand. For example Player2_Movement() opens to keypressed up and keypressed down. Each of those actions is easily understood when I expand them. Those are good, especially in beginner code. If I were looking to improve it -- even though what you've got in there looks like a runnable game -- I would next try to simplify by merging duplicate functionality. Moving up and moving down seem like the same operation, the only difference is that one is positive and the other negative, you can use a clamp function to limit movement both at the top and the bottom. That's 7 lines removed. The AI has different logic controlling if they move the paddle up or down, but the actual logic of moving of a paddle is the same as you're only modifying the y value. Extract the duplicate paddle-moving logic to a new function that accepts both a reference to a paddle and the direction it moves, and you remove another 10 or so lines of duplication. Moving the ball also has a lot of duplicate math that depends on ballsp_x is positive or negative. That duplicate math can probably also be merged. I'd also look at more consistent naming conventions. Sometimes they start with uppercase or lowercase, sometimes they have underscores, sometimes they have abbreviations. There are automated ways to rename all variable instances in most IDEs, so it is usually an easy thing to clean up. Games are shipped but never really done. There are always improvements developers want to see and bugs that could be fixed. Players don't normally dig through the source code, and if they did often they'd encounter nightmare fuel. If your code does the things you want to do and fits whatever performance criteria you've been given, you can call it good enough, even when it could be better.
8. 3 points

## Calculating shot hit percentage based on tile distance

min(100.0, 12800.0 / (x*x*x))
9. 3 points

## ANL Editor, GC Editor, The Future

Following along from the previous post about the node graphs, I have lately pulled the node graph stuff out and have started work also on a standalone editor for noise functions. https://github.com/JTippetts/ANLEditor The editor uses the node graph functionality, along with an output node that provides various functions, to allow one to create graphs of noise that can be used to create textures. The output node allows you to map either a Grayscale or RGBA image output (the Volume button currently does nothing, for now). It can analyze a connected grayscale function to give you a histogram graph of how the function output is distributed, and calculates a set of scale/add factors that could be used to remap the output of the function to the 0,1 range. It allows you to specify seamless mapping settings, and to export images to file. It's all still fairly rudimentary and I still haven't settled on a final save/load format, but all that is in progress. I have also started creating an editor of sorts for Goblinson Crusoe, using some of this editor functionality. It's still in its infancy, but eventually it will allow me to create areas and area pieces for use in randomly generating maps. Lately, I've been doing some thinking about what I want to do with Goblinson Crusoe. It has become clear to me that it will probably never be a commercial release. It will probably never be on Steam or anything like that. I just don't have the time. I wasted a LOT of my early years spinning my wheels and going nowhere, and now I have so many other things that have to come first (family, full-time job, home-ownership, etc...) that I just don't think I'd ever realistically finish this thing. If I could work on it full-time, perhaps, but mortgage, bills, and the necessity of providing insurance and safety nets for my wife and kids means that isn't feasible. However, I do enjoy working on it, and don't want to just abandon it. Nor do I want it to never see some kind of release. And I would like to see some kind of return on my huge time investment over the years. So I've been thinking of making GC a free and open-source project, linked with a Patreon and/or PayPal for goodwill donations. At least that way, if I die or life gets in the way of further development, at the very least it wouldn't disappear completely. Plus, I might get at least a few dollars from appreciative people along the way. What do you all think? Any advice on how to structure such a thing? Good idea/bad idea?
10. 3 points

## A good way to avoid extermination in RTS?

Most competetive RTSes end in "gg" and one team surrendering rather than playing until every single building is dead. That's the gaming equivalent of this. Whether this happens for an entire match (ala StarCraft) or if there is a higher level 'campaign' or 'war' layer wrapped on top of it doesn't matter.
11. 3 points

## November 2017 GameDev Challenge: Pong!

Hi everybody! I decided to use this challenge as an excuse for learning to use Game Maker (or I wanted to learn Game Maker and decided to do it while participating in this challenge; pick one :P). My project is called "Power Word: Pong". It's available for Windows here: https://racso.itch.io/power-word-pong I still want to improve the AI, as it's still quite dumb, and I want to give some variety to the ball (angle and speed changes), but I'm almost done with the game. Still, as always, feedback is appreciated! I hope you like the twist of the game. You may find the game source in this repository. I'll create a post-mortem after I finish working in the project. Regards! O.
12. 3 points

## Recursion Quick Sort

Try walking through a visualization (like https://visualgo.net/en/sorting - click QUI on the top bar to switch to QuickSort).
13. 2 points

## Shader4ComponentMapping explain?

Lemme give you an example: A block compressed format, such as BC5, which only has R+G, will by default return B=0 and A=1 (I hope). You can force 1 or 0 into any channel, you can shuffle channels around, you can use some of them 1-4 times and you can drop any of them or all of them (replacing them by 0 or 1). I can't think of too many uses for this though.
14. 2 points

## Shader4ComponentMapping explain?

In older API's there were some formats that, when fetched in the shader as a float4 value, you'd get (Red, Red, Red, 1), or (Red, Green, Blue, 1) or (Blue, Green, Red, Alpha), or (Red, Green, 0, 1), etc... In Dx12, you're given control over this behaviour yourself. If you want the shader's float4 'x' value to contain the data from the texture's green channel, you can do that. If you want to hard-code the alpha result to 0 or 1, you can do that. Typically though you set it to return (Red, Green, Blue, Alpha) / a.k.a. (component 0, component 1, component 2, component 3)
15. 2 points

## How to add tactical depth to rock paper scissor?

Situational advantage's and combined arms effects can go a long way to adding depth and strategy to a game. IE: -Cavalry can rule open fields against everything, but require flanking advantage to win against pikes. Heavy lancers rule against light cavalry, but are more costly and not as effective at running down broken infantry or at scouting. -Pikes can hold a position effectively, but are less effective at advancing. -Heavy infantry are resistant to ranged weapons, but can't close on enemies as effectively as lighter troops. -etc. Things like these, rather than straight up Rock-Papers-Scissors win/loss mechanics, add up to more emergent game play. Pulling an enemy's heavy cavalry away with a unit of light cavalry, and drawing them into a wooded trap of pikes and archers, but they may be vulnerable to a push by enemy light infantry driving into the woods. (Where both pike and ranged units have negative debuffs to their effectiveness.)
16. 2 points

## Using GPU Profiling to find bottlenecks

One other suggestion I have is to make sure that you use a sync interval of 0 when performing GPU profiling. When VSYNC is enabled, the driver will always wait until the next sync interval (every 16.6ms for a 60Hz monitor) before presenting the next buffer in the swap chain. Because of this, the GPU will typically have to stall so that it can wait until a swap chain buffer is finished being used for presenting, and can therefore be re-used as a render target. This still can show up in your timestamp queries, which will give you misleading results. You may be able to avoid capturing that stall in your timings by excluding the first draw or copy operation that touches the back buffer, but it's easier to just disable VSYNC.
17. 2 points

## Video Game Writing Preferences?

The important thing is that when something really great pops into your head, that you write it down somewhere... anywhere... to put into your primary documentation later. Having worked on the same universe for over 20 years now, it has become a part of my life to drop whatever I am doing, wherever I am, to write any good ideas down that come too me. No matter where I am, and what I am doing. I learned that lesson the hard way many, many years ago after having thought of things during the day that I thought were really important and then not being able to remember them later that night when I got home. I call this "percolating". A primary document has to exist so that it can "percolate" over time. Little by little, it builds up into something great over time by all the little details that get added in this way. The more of it that exists, the more there is to inspire such ideas to begin with. So you want always want to keep the main document as complete as possible. Until you write it down, you are still thinking about it. Once it's written down you can move on to thinking about other aspects of it, and the depth of it all just keeps "percolating" over time. Eventually you get to the point that you are working out the types of minor little details that other stories just don't have because they were written "all at once" and that person didn't have time to contemplate the minor details, or realize relationships between existing elements of the story that weren't immediately obvious when you first wrote it. Most people probably don't have 20 years to let their story "percolate", but even over a period of 6 months to a year this would still wind up adding a lot, or changing a lot for the better that otherwise would never have changed. And this process never ends until it is published.
18. 2 points

## Ambitious game looking for an ambitious team

This summer I started working on a "subterfuge MMO" game called Spycursion, which I've written about here and on my blog. It draws inspiration from EVE Online, Uplink, and Street Hacker, so if you've been into any of those games then you may find it very interesting. Right now the team is just me, but that is hopefully about to change! I'm looking for a couple of people to fill some expertise gaps. Most importantly: Graphics, particularly SDL2/OpenGL Marketing (or, more likely since this is a game dev forum, connections to people who can do game marketing) Art. See this post; the first two images there are concept art representing the style direction I'm planning on launching a crowdfunding campaign ideally in January, and am pursuing additional funding options. Spycursion is a game that I think is very unique and has a lot of potential -- but I need your help to realize that potential! If interested, please send me a private message detailing your experience/qualifications. Thanks, -Scott
19. 2 points

## Using GPU Profiling to find bottlenecks

No problem, Infinisearch. I used the information from the posts above to write my own GPU profiler using the links provided by MJP. I wrote two classes. The class GPUInterval is an interval you are interested in, e.g. the time that is used to render a scene. The class GPUProfiler is a container for a set of GPUIntervals and does all calculations. namespace Engine.Game.Profiler { public class GPUInterval { private readonly SharpDX.Direct3D11.Device _device; private readonly SharpDX.Direct3D11.DeviceContext _deviceContext; private SharpDX.Direct3D11.Query _startQuery; private SharpDX.Direct3D11.Query _endQuery; public string Name { get; private set; } public double Duration { get; private set; } public GPUInterval(SharpDX.Direct3D11.Device device, SharpDX.Direct3D11.DeviceContext deviceContext, string name) { _device = device; _deviceContext = deviceContext; Name = name; // Create timestamp query. _startQuery = new SharpDX.Direct3D11.Query(_device, new SharpDX.Direct3D11.QueryDescription() { Type = SharpDX.Direct3D11.QueryType.Timestamp, Flags = SharpDX.Direct3D11.QueryFlags.None }); _endQuery = new SharpDX.Direct3D11.Query(_device, new SharpDX.Direct3D11.QueryDescription() { Type = SharpDX.Direct3D11.QueryType.Timestamp, Flags = SharpDX.Direct3D11.QueryFlags.None }); } public void Start() { _deviceContext.End(_startQuery); } public void Stop() { _deviceContext.End(_endQuery); } public void Calculate(long frequency) { long startTime; while (!_deviceContext.GetData(_startQuery, out startTime)) System.Threading.Thread.Sleep(1); long endTime; while (!_deviceContext.GetData(_endQuery, out endTime)) System.Threading.Thread.Sleep(1); Duration = ((endTime - startTime) * 1000.0) / frequency; } } } namespace Engine.Game.Profiler { public class GPUProfiler { private readonly SharpDX.Direct3D11.Device _device; private readonly SharpDX.Direct3D11.DeviceContext _deviceContext; private SharpDX.Direct3D11.Query _disjointQuery; public List<GPUInterval> Intervals { get; private set; } public GPUProfiler(SharpDX.Direct3D11.Device device, SharpDX.Direct3D11.DeviceContext deviceContext) { _device = device; _deviceContext = deviceContext; // Create disjoint query. _disjointQuery = new SharpDX.Direct3D11.Query(_device, new SharpDX.Direct3D11.QueryDescription() { Type = SharpDX.Direct3D11.QueryType.TimestampDisjoint, Flags = SharpDX.Direct3D11.QueryFlags.None }); // Create intervals list Intervals = new List<GPUInterval>(); } public void StartFrame() { _deviceContext.Begin(_disjointQuery); } public void EndFrame() { _deviceContext.End(_disjointQuery); // Retrieve frequency. SharpDX.Direct3D11.QueryDataTimestampDisjoint queryDataTimestampDisjoint; while (!_deviceContext.GetData(_disjointQuery, out queryDataTimestampDisjoint)) System.Threading.Thread.Sleep(1); // Calculate the duration of all intervals. if (!queryDataTimestampDisjoint.Disjoint) { foreach (var interval in Intervals) interval.Calculate(queryDataTimestampDisjoint.Frequency); } } } } I created four GPUIntervals to check the same regions I mentioned in my initial post: The entire render function Rendering the scene (drawing models, setting constant shaders, ...) Rendering UI Calling SwapChain.Present Here are the numbers for a random frame while the game is idling: Entire render function = 16.35 ms Render scene = 15.00 ms Render UI = 0.26 ms SwapChain.Present = 1.08 ms These numbers are no big surprise, because the render scene does all the work. However, it is interesting that rendering the UI (which has A LOT of elements) and presenting the Swap Chain is fine. Tomorrow, I will investigate the different parts of my scene rendering. I will keep you updated!
20. 2 points

## Using GPU Profiling to find bottlenecks

GPU profiling generally needs to be intrusive on your app. For CPU profiling there is usually metadata that can be leveraged (in PDB files for native code, or from the assembly itself in managed code), but there isn't anything for GPU profiling aside from the D3D calls that you issue. Nsight can give you timing breakdowns per-draw (if you can get it working), but that's usually not super helpful for getting a broader view of your game's performance. For that you need to add some annotations to your code that bracket your draws and dispatches into logical goups. Different profiling tools having different ways for doing this, some of them involving custom API's specifically for that tool. For instance, the new PIX for windows has the WinPixEventRuntime lib. Many tools (such as RenderDoc and Nsight) that support D3D11 still recognize the old D3DPERF_BeginEvent/D3DPERF_EndEvent functions from D3D9. You may want to consider adding your own basic profiling to your game, which you can do by using timestamp queries. Unfortunately I don't have any C#/SharpDX code that you can look at, but if you're okay with looking at some C++ you can look at my basic D3D11 Profiler class that I have here and here as a reference. I would also consider adding some debug UI to your game so that you can output this data right to the screen in development builds. I was thinking the same thing when I first read the OP, but then I realized that it says that those timings were accumulated over a single second. So basically 79% of the frame time is spent in Present, which sounds normal for a heavily GPU-bound game.
21. 2 points

## Using GPU Profiling to find bottlenecks

So your GPU is running at 1fps, but your CPU is also only running at 4fps!? How does your CPU drawing take 170ms? How many draw calls do you make? It could be that you're doing something wrong on the CPU which is causing both CPU and GPU to run slowly. To profile your GPU workload it's pretty easy to do it yourself. You can use D3Ds timestamp queries / events to read the GPUs clock at different points in a frame. You can then just read the clock before/after a group of commands, subtract the difference, divide by the clock frequency and you know how long that group of commands took.
22. 2 points

## Tips on Building Portfolio

Your portfolio should show off your skills, so use whatever game engine you work in best to show them off. Also, you don't have to make a game from scratch if you can't, find a team that needs your skills and help them. Any game you make is experience and something you can put in your portfolio.
23. 2 points

## Debate: Proper Time For Microtransactions?

I'm tired of this point of view. Why should developers not be concerned with profits? Developing games, especially AAA titles require a large amount of Capital. If you are going to put forth the time, the effort, the many many late nights developing a game, does that mean you should not be concerned with profits? Consumers, specifically like Jim Sterling, demonize any company that doesn't play the Robin Hood mentality. Suddenly the dev is greedy, evil, and is concerned with nothing more than profit margins. The game industry is competitive, hard, and ultimately AN INDUSTRY. Games are and INDUSTRIAL product. If a dev is trying to feed their family by making a game, that is their right, their business, and their choice. They shouldn't be seen as greedy. Pay to win microtransactions are very unethical, and is basically a big middle finger to players. But, if a $60 AAA game wants to add a balanced and reasonably priced microtransaction to a game for people to save time, they shouldn't be castrated for doing so, regardless of whether they are charging$60 for the game or \$20.
24. 2 points

## Yet Another Pong

Thank you very much for your help I reworked the variables moving most of the "magic numbers" in to const as both of you suggested. I also moved the multiple statements per line. As for the classes I started working on that but as predictable I had trouble doing it now since I would need to redo most of the entire thing. So now I'm working on a different version for the contest (if I manage to finish it in time) and I'm working with objects from the start. Here's the upgraded .cpp Pong.cpp
25. 2 points

## A good key list for User Rebindability

Just FYI, in my code I allow every single key to be assigned. This includes the famous media keys and things like that, as long as they are found as part of the 256(technically less) possible keycodes. Now, I of course don't have actual descriptions for all those keys, and I won't ever be able to because I'm sure the more rare ones are going to be different for different keyboards. The solution is to have a sort of "default" text that works for any undefined descriptions. The words "Unknown Key" work for me. This way, the player can still bind any key they want. I don't think any players are going to care if you don't have a proper description for that really rare key they want to use for whatever reason.
26. 2 points

## Debate: Proper Time For Microtransactions?

Non-free mobile games don't sell. It's either micro transactions or advertising, or both in that part of the industry. Preferably both in a way that meshes with the game design and doesn't piss off the players. Note that when run as a business, a successful model *will* piss off the perfect percentage of players. Pissing off players loses you money, but obnoxious micro transactions makes you money. The balance is in the middle where you monetise the crap out of it and piss off some people, but not too many. The best way to make money isn't going to be pretty. You can ask individual people to be nice and not try to make the most money possible, but you can't ask a publicly traded corporation not to to that! Pay to win micro transactions in a full priced PC game is always going to piss off your players, and IMHO will completely undermine your gameplay too. I actually don't know how EA thought this would work... Cosmetic micro transactions are pretty much forgiveable in any game though...
27. 2 points

## Material for game developing

Luckily, for 90% of the code in any programming language, efficiency is a non-issue. Many people are so focused on maximum speed that they forget about this rule, and become horribly inefficient with their own time by writing loads of trivial non-speed-critical code in some low-level language, to gain pretty much nothing in performance of the program. Python doesn't position itself as as a number-crunching language. It aims to be a glue-language, connecting blobs of fast C etc code with each other. It's also a great prototyping language, quickly trying an idea. I often find the Python implementation fast enough, and leave it at that. If you want more speed, the simple trick is then to rewrite the speed-critical part in a language tuned for such problems, connect that to Python, et voila, it all runs near the speed you'd get by writing everything in that low level language, but at a fraction of the time, and where most of the code is much easier to maintain. Note that Python itself is moving towards faster execution too; we've had cython for several years now, the faster sister of our favorite snake language. In Python 3.5 type-hinting has become part of the language, so I expect major improvements in speed the next years.
28. 2 points

## A good way to avoid extermination in RTS?

Yeah, watch some starcraft 2 esports matches. If two armies engage 100%, one will get wiped out, which leaves the loser defenceless, leading to a loss... So that simply doesn't happen because it's bad strategy. Instead, players identify whether they can decisively win the battle or not, and if not, they retreat. Often neither side can decisively win, so there's lots of small skirmishes and hit and run attacks where both sides retreat. While retreating, your time to receive reinforcements reduces and your proximity to defensive buildings increases, which often tips the scales in your favour enough that now your opponent must stop chasing you and themselves retreat. This swings back and forth until a tactical slight of hand disrupts the balance. Often, there's an eventual large battle that decides the match, which usually doesn't eliminate a player's army, but puts them into a situation that they know is unwinnable, (due to economic/industry/technology supremacy of their opposition - e.g. Knowledge that their tank production rate is not high enough to survive the *next* battle) so they type "gg wp" and concede defeat. Its only at lower ranked levels of play where people don't understand the game where anyone actually loses via elimination.
29. 2 points

## __declspec(selectany)

Take a look at this for a quick refresher on linkage in C++. It's a good reference that covers all the relevant details, including how the compiler determines default linkage in the absence of a storage class specifier and the difference between a declaration versus a definition for both functions and variables. Perhaps you wouldn't, but there are a handful of constructs in C++ that produce multiple definitions as a matter of course, and they need special mechanisms (such as COMDAT) to support them properly. See vague linking for some additional insight and information (I also found Where's The Template? to be a rather interesting read on the related template instantiation problem). One thing it does is allow read-only global data items to participate in COMDAT folding and elimination. So if you had two (or more) read-only global variables with the same value: __declspec(selectany) extern const int x = 5; __declspec(selectany) extern const int y = 5; __declspec(selectany) extern const int z = 5; And you used the /OPT:ICF option, those variables would be collapsed into one in the final EXE/DLL, saving space. The /OPT:REF option would also allow the linker to eliminate unreferenced global variables completely, although be careful when doing this on objects since the initialization code will be removed as well! I suppose a secondary "benefit" is being able to define variables in header files, since the linker will just pick one instead of complaining, but I wouldn't use it for that reason alone.
30. 2 points

## __declspec(selectany)

Extern does not guarantee that at all. It only says that the definition for the given symbol can also exist in another compilation unit, which typically prevents complaints from the compiler that some variable is not initialized before usage. Extern nor static say anything about in which file either should be present. Note that the following is completely valid when written in the same file: extern int x; int x = 5; What static, for a static member, does say is that initialization needs to be done outside of the class body, with the below being valid when written in the same file once again: class Foo { static int x; }; int Foo::x = 5; Don't forget how includes work; once preprocessing is done the above scenario will be in some file regardless ;). Extern in the end just indicates that the definition may be in some other compilation unit (static on a member too, actually). It is simply externally linked, but does not disallow you from having the definition inside the same compilation unit as one of its declarations. As for why you would want multiple definitions, you might want to read a little more about the entirety of the COMDAT folding story in this series, though in this specific case with __declspec(selectany), I've only seen it used in some convoluted way to mimic weak linking, which is only supported by Microsoft's linker in undocumented fashion, apparently.
31. 2 points

## _declspec(align(16)) vs alignas(16)

Well you mostly point it out yourself: __declspec(align(x)) (note the double underscore, by the way) has largely been superseded by alignas. If you really need to support older versions of C++ where it was not present, it might be of use, though I'd use something like this myself #if ... #define ALIGNAS(x) alignas(x) #else #define ALGINAS(x) __declspec(align(x)) #endif But it is, of course, not necessary and you can stick with the pre-c++11 version if you want to ensure that backwards compatibility. Note that GCC/Clang typically require __attribute__((aligned(x)) instead, if you were planning to support either by any chance.
32. 2 points

## Hi, everybody!

Hi! We are Evil Corporation Games, an indie studio, which was founded in 2016. In April 2017 our first game project - Star Story: The Horizon Escape (a text turn-based adventure RPG with 24+ alternative endings) was released on Steam. We are currently working on our next game - TERRORHYTHM. That will be rhythm + beat'em up action in the style of cyberpunk. In this blog we will inform you about our game projects and the latest news about it. First post we would like to dedicate to our first project call "Star Story: The Horizon Escape". It was released on Steam 05.09.2017 (http://store.steampowered.com/app/610310/), then it was published on itch.io, g2a.com and gamersgate.com. Was a work experience with chrono.gg. Soon Star Story will be available on kinguin.net and greenmangaming.com also. It’s a text turn-based adventure game with elements of RPG. The plot is developing in accordance with the actions of the player; there are 24+ alternative endings of an exciting adventure. Trailer: A spaceship of archeologist Van Click crashes, and he finds himself on the last unexplored planet in the whole galaxy called “Horizon”. As the Hero is trying to get out from this planet, he meets various inhabitants of unknown locations; he has to struggle for life encountering extremely aggressive species of Fauna and resolving various puzzles. The end of this eventful flee from the Horizon planet depends only on the player’ choice. In this game we have mixed the mechanics of dialogues, choices, turn-based battles, puzzles, crafting and technology researches. Work on this game lasted 1 year. And before an official release Star Story took the first prize in the nomination «Best PC game» according to Indie Cup 2017 and got the first place in the Deconstruction Workshop at the White Nights St. Petersburg 2017 conference. As it our first post, in honor of it we would like to share 5 STEAM keys to Star Story for our very first readers and friends here: FZGMK-9HVVZ-R6HY4 6RYY4-VBX2Z-67X2B 3VGHH-Q8YY9-LTW73 J4CRJ-ZAZFT-X8FIV HG8RV-IQ8Y4-IEH8A Very soon we will post the early details of our new project making, that will be released Spring 2018.
33. 2 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.
34. 2 points

## Why can it be safe to sell an open-source game library?

Don't be paranoid. Assuming you see yourself as C, if you catch copyright and/or license infringement, you are welcome to unleash the lawyers (if it's worth the expense); if you don't, remember that your business is selling a game engine to the largest possible number of well-behaved B's, not wasting effort on quantitatively unimportant and/or imaginary pirates like B1 and D.
35. 2 points

## A good way to avoid extermination in RTS?

As others have mentioned, this isn't a particularly hard problem at first glance. Institute systems to model what makes this true for the real world - morale and retreat. As a bonus, this also opens up opportunities for players turning big losses (route) into smaller ones (orderly retreat with rear-guard). As for how this makes something grindy? If you're looking to history, then simply follow the same - most enemy armies were not "completely destroyed" before their parent state offered terms of peace. If you want to change the tactical concerns, then you're going to have to revise the strategic ones as well.
36. 2 points

## What would you change about my main scene ?

To make it pop out, i originally had in mind an outer glow, to make it more christic, but there is a selected/highlight side to it that may be confusing. Plus, a drop shadow looks good to me also, i'll see which decision i make. Zarloo, none taken. I see and understand your point and most of the art your recommanded looks pretty, i can't argue with that. But it's not really what i prefer neither what would fit the best for game i think (even if it would do the job for sure). I also personally find it a bit generic/classical/theorical, even if very beautiful. I'll not say i'm making the most beautiful game ever, i'm not even a game artist in the first place. But as you can see above, work, reflections and patience do improve my artworks (even if your suggested process would imply some as well, on a different scale). And that's what i'm really looking for. I managed to make it cohesive somehow, and that's a huge step for me. I'm not afraid of having a not-visually-perfect-first-game, if it takes me 3 games before i do a slightly beautiful one, so be it. I don't want to drop/copy style-prefab on it, just to secure the quality of the visual part. I'm not looking for "anything to make it look good!". I'm confident in my approach leading to a more unique style (even if less perfect) in the end, even if it means more struggling in the beginning. I hope practice will lead me to control, and i like trying my own things better than copying someone who already found his formula, i'll find mine.
37. 1 point

## [Survey] What is the difference between a 'wannabe' and a professional GameDev?

This was posted on the site about 15 years ago, along with several other articles. Seems it was taken down along the way of various site updates. Some of the names have been changed, but the information is still accurate.
38. 1 point

## Artworks for feedback (Cows VS Vikings)

Hello! Not so many time has left till the release of Cows VS Vikings - and here it starts, this magic journey through the milky chaos and horned mess. This is the start screen of the first level (divided, in turn, for several battles) and I want to ask - is it quite comprehensible from the point of view of the player? I mean all the UI elements. Thanks. More info about this game you can find on our official website: http://cowsvsvikings.com/contest/ Please subscribe if you don't want to miss a thing.
39. 1 point

## [Resolved]ZLib compression from UE4 to Boost ?

The problem is not with the zlib, and not with UE4; you are quite likely using it wrong. And why would you be base-64 encoding anything when you're using raw C++ boost sockets? Without knowing exactly how you're using it, and exactly what the problems are that you're seeing, there's no chance of giving you any better help. Print out how many bytes you send in each "go" and when you send them. Print out how many bytes are received in each "go" and when they are received. Correlate with failures in decompression. For example, do you initialize the zlib stream for each thing you send? If so, how do you separate each individual packet sent; is there a length prefix field of some sort that you send? There are so many things that could be going wrong, that you need to take a step back, and figure out each individual small piece of what you want to do, and then do only that one thing. Verify it works. Then add one more thing, and verify that the combination works. If it doesn't, debug that one thing. Repeat, until you've gotten to where you want to go.
40. 1 point

## How to influence auto-resolved matches in a football management sim?

You might find an old copy of Front Page Sports: Football, made by Sierra in the mid-1990s. That game had playbooks and coaching profiles. The playbook allowed you to establish which plays your team used, and the coaching profile (which was very extensive), allowed you to essentially create your own AI for how the plays would be called. We played it online, in coach mode, but sometimes when two players wouldn't be able to arrange to actually play that week they would just send in playbooks and coaching profiles and allow the AI to resolve their game for them.
41. 1 point

## Looking for more sharpDX examples and tutorials

Hello, Do you know this site: https://github.com/Dan6040/SharpDX-Rastertek-Tutorials? This guy converted all Tutorials from Rastertek to SharpDX. I found them very useful when learning DirectX. I use SharpDX with DirectX 11, but you might find something useful for you!
42. 1 point

## Gamma correction - sanity check

No. When you read from R8G8B8A8_unorm_srgb HW automatically does sRGB->linear conversion for you. Similar case with writes - you get linear->sRGB at the end. Basically, this means that you can use either R10G10B10A2_unorm or R8G8B8A8_unorm_srgb as your intermediate main color target without any observable difference in case of outputting that directly to the screen. If you don't need HDR then you don't have to use a fp render target - you can use R8G8B8A8_unorm_srgb or R10G10B10A2_unorm. EDIT: BTW custom gamma is usually done on top of HW sRGB, as sRGB is more complicated than simple x^1/2.2.
43. 1 point

## Does buffer number matter in ID3D11DeviceContext::PSSetConstantBuffers()?

Well, I don't know why it worked for you with so little knowledge about your specific app. For me, I like to be very explicit about bind slot IDs for buffers and resources. I declare them in a shared header between C++ app code and HLSL shaders. Then the application uses SetConstantBuffers() with that ID and the shaders are specifying bind locations with that ID as well. HLSL is tricky because you have to concatenate the number with a string, like this: cbuffer MyCBuffer : register(b4) For that I am using a macro like this: #define CBUFFER(name, slot) cbuffer name : register(b ## slot) Regarding the padding, you are right, HLSL does automatically pad your structs when needed, but I like to keep that explicit as well, so I insert dummy data members where padding would occur. This makes it easier to share structs with the C++ application which you should also do in a shared header in my opinion.
44. 1 point

## Ground work complete!

I like the sense of belonging you are trying to recreate in your game, it is very important for immersion and emotional/intellectual investment by the player. In Stardew Valleythey they made the player drink a concoction brewed by a wizard which granted the player the ability to be one with the spirit of the forest. In Neverwinter (among others) players are asked to belong to a religion, or worship a god. This deepens the players' attachment/investment in the game world. You mention that you are looking to develop an economy in your world. Maybe religion or Elemental spirits might not be what would work for you, yet the formula that a notion/philosophy (or an item/landmark) establishes a code of conventions which grants importance to the actions/decisions the player makes in the game world. When I saw the snapshot of the space you programmed, the first thing that popped into my mind was, "what's under that mountain range", what kind of resources are in those mountains. That might be an interesting avenue to consider for giving substance to the economy in your game. Cheers, best of luck.
45. 1 point

## Just another beginer story

Thanks for the help, we are reducing the scope a lot and it actually looks doable now. Thanks for taking your time and answering.
46. 1 point

## Nested namespaces useless typing?

You mean, is it better to use an in-language namespace mechanic or an extra-lingual one (ie. prefixes)? Consider Koenig lookup.
47. 1 point

## Cant find how to do this asm code in c++...

You do realize that mov [ebx], eax will move the value IN eax to the block of memory ebx points to, right? Meanwhile, memcpy will copy the memory pointed at by f into the memory pointed at by p. Lastly, your integer solution has the same problem as the memcpy one. I'm not going to give you the solution, because figuring this out is an important step in understanding pointers.
48. 1 point

## Rigging and Animating

I would think you could run a bone right along the bottom of the piston, where I think it would compress up into the top. You can do bone translation for the animation, allowing it to move up into the shaft. You would likely parent that bone to another bone for the top section, which then parents to what appears to be the part above the leg. I don't know what software you are using for the modelling, but there may indeed be some sort of IK constraint that could help with making the piston animating bones automatic as you "bend the knee" but that is dependent on your software. Of course, you would then have to make sure that those constraints get baked into the keyframes before you can use them in UE4.
49. 1 point

## Game in development: Chronicles of cyberpunk

Keep up, looks great and you are making progress. Not many people can claim that :).
50. 1 point

## my SIMD implementation is very slow :(

have you profiled your code _before_ you've started your low level SIMD optimizations? you're indeed totally memory bound and your SIMD code seems to have no effect on that area. based on your assembly code, your compiler decided to load "indice1" first, then "indice2" and then "indices0". the profiler shows that it mostly spend time in line 602, as this line waits (read: stalls) for the previous load command to finish (loading the "indice1") which simply means cache miss. if you look at the assembly, there are 3 more stalls right after "movaps" which are the loads for your 3 vertices. so, overall, your SIMD code doesn't really do anything useful, as it is probably executed out of order while the CPU is waiting for some load instructions to complete. the proper way to optimize this would be: -improve data structures (e.g. pad them to make them always fit into cache lines) -enforce alignment (64byte) to make them really be in cache lines after the first access -pool data (you should NEVER call 'new' that goes into system for every single vertex/triangle/boundingbox/...) but allocate from pools e.g. 4kb block chunks -compress data (e.g. do you really need 32bit indices? are maybe 16bit enough? can you use one big index and two 8bit offsets maybe? could you compress your vertices? e.g. float16 instead of float32? could you maybe even quantitize those into int8_t ? ... -pool work in a meaningful way e.g. trace rays not scanline by scanline, but e.g. zig-zack ordered or tile based, as near by rays touch most likely similar nodes of your acceleration tree -make the same kind of work across all cores, if one core is texturing and another core is traversing the hierarchy, both will effectively have just half the cache and even worse, both will evict data that is useful for the other core, you might end up slower than with less threads. so all threads should work on the same data. if your amount of data is insanely high, use maybe an LOD, visual quality might not be hurt but performance could rise a lot. and check out Intel's Embree http://embree.github.io/ it's like the best practice guide of path tracing (or tracing in general). they also have some presentations on the net, talking what optimizations they've removed to avoid quality issues, which might save you some headache.

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

• Total Members
239383
• Most Online
6110

Newest Member

Joined