Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

1352 Excellent

About richardurich

  • Rank
  1. If one is encountered before zero at the interlockedmin statement, both the zero and one successfully pass your clip test, but you do not know which order they will return col. I don't know if that's the only issue, but it sure seems like something you didn't intend.
  2. Is your code so large it cannot be included in your post? The iPad I'm using right now isn't set up to see it, and I don't care enough to help that I'm going to change that. And I also prefer someone looking at this a year from now will be able to see the relevant details even if the file is removed from Dropbox or whatever. My blind guess would be you copied data to a local variable, and are just atomically operating on that local variable. But the odds of that blind guess being right aren't great.
  3. richardurich

    Upgrade Update: Forum Organization

    [quote name="Khawk" timestamp="1491246212"][quote name="Lactose" timestamp="1491241623"] With both the Audio and Visual Arts topics having only a single forum listed in each, maybe merge them as "Audio and Visual Arts" or something? [/quote]   There have been requests for us to split Visual Arts into 2D and 3D forums, so probably better to keep it split from Audio as a category. Audio can have Music and Sound FX as a forum I think.[/quote] Do you really need 2D and 3D as independent forums if you have tags and prefixes? I'd rather just have shader effects, textures, sprites, and 3D models as tags than try to figure out where various hacks fit (ex. billboard an effect into a 3D scene) I don't love the idea of menus with only two entries, and both audio and visual have that issue. Game design also feels light on entries, and has itself as an entry (always feels odd). But I feel like UX being there is an obvious headache waiting to happen, so assume that won't exist, leaving only the self-entry and one other.
  4. Correlation does not mean causation. Did you confirm the program switched threads, and that switch aligned with your issues? Are you using RDTSC or anything derived from it? Your issue is somewhere else, but I suspect you'd rather blame QPC than accept that fact. If QPC had the issues you seem to think it has, sfml would be breaking every single application that uses their clock. SDL would break anything using SDL_GetPerformanceCounter. Believe me or don't. It's really your call at this point, and I think you've gotten all the help you can receive until you provide more details that reveal where the actual bug is. On systems with invariant TSC, yes. It's an optimized call in those situations. A quick google search shows CPUID.80000007H:EDX[8] is what indicates invariant TSC. But on older systems, QPC will absolutely be a far more expensive call. You can even google about complaints on its performance.
  5. No it doesn't work. QPC is speeding up every time the window receives a message and slows down when it's got full focus. Is there anything useful anyone can contribute?Elaborate please. QPC does not change speeds. It's just an API call. Feel free to ignore everything I said, and just go with what Hodgman said in the first response to your original post. It is the correct advice (although TSC doesn't need adjustment for dynamic clocks, just synchronization logic between cores that is provided by QPC). Or google this stuff. You can find MSDN articles explaining why you should use QPC instead of RDTSC in multicore, why to use QPC instead of timeGetTime, etc.
  6. So Microsoft wants to tie people into their ecosystem with QPC. Why does it matter? The result is still any motherboard manufacturer (or whoever) with a bug in multicore access to QPC will feel immense pressure to fix it. You want that for any bugs in your code. Trust me. And we are far enough into multicore that I bet you will never see a major bug in this area again, unless Microsoft abandons their recommendation to use QPC. If you aren't actively seeing an issue, just use QPC with certainty that it will work how it is supposed to work. If you happen to run into a bug down the road (doubtful), it's easy enough to patch the code by replacing QPC calls with calls to read a timer you publish from a thread that doesn't change cores. But honestly, that will never happen. This theoretical bug you're wasting time trying to avoid just doesn't exist today. Sure it existed in the first multicore systems. But unless you have a time machine, don't worry about it.
  7. This is just incorrect. If you are getting different values from different cores, it is a bug with the hardware timer being accessed (or more likely the BIOS code providing access to that hardware timer). If you do anticipate such bugs, I'd still use QPC or RDTSC locked to a core and publish that value for other threads. They still would have the same problem since a single thread can and will change cores over time. And I advise against each thread having its own time. There is only disadvantages over publishing it from one thread (your highest resolution one) and having all others use that. You'd have sync issues since physics and animation and sound and everything else are all supposed to happen in a coordinated manner. There is a definitive answer from Microsoft. If you're using Windows, they tell you the best practice is using QPC. While that doesn't mean you can't hit bugs, it does mean those bugs are more likely to get fixed since they are breaking the preferred solution. (Edit) Minor clarification: I mention RDTSC, but only recommend it if you are locking on a specific core. And I don't particularly recommend doing that unless absolutely necessary (hint: it probably is not necessary!)
  8. Why are you locking to a single core for QueryPerformanceCounter? The whole reason you use QPC instead of RDTSC is so you don't have to lock it to a specific core. If there's a legit reason, you should probably just make a dumb thread for it and not much else since you don't want to rely on a specific core for your core game loop or something. Then just have a variable updated that the other threads read. Unless Microsoft changed the specification for TimeGetTime, it is entirely inappropriate for a high-resolution time counter. It used to update only 64 times per second.
  9. richardurich

    Getting back into C++

    Using Visual Studio to deploy for Linux isn't bad. It was a lot worse in the past. If you prefer Visual Studio, at least try it and see for yourself. It's purely an opinion, so I can't promise you will agree. Just jump in for content, but make sure you find resources using C++ 11 or 14. Do a threading tutorial if needed, then just play around for a while. Do the same for each topic. But never fear doing intro-level tutorials, no matter how much experience you have. They're super quick when you have experience. You can just skip a ton of it. I've been coding for almost twenty years, but if you looked at my browser history six months ago you'd think I was in high school. (I did the opposite transition, from C++ to C#)
  10. richardurich

    Upgrade Update and Site Organization

    I am all for updating to better reflect reality, but you need to keep it simple. Sure, you'd elevate obscure areas, but you'd also kill everything else. Why doesn't business have an entry for marketing? It feels like the top concern, not legal or management. Maybe rename creative to content creation? Sound, 3D modeling, sprites, level design, etc as subcategories? I'd probably support splitting technical since it's way too bloated (11 entries, and plenty missing even still). Maybe if you can figure out a way to describe building your own stuff versus using existing tools. It feels like they're mixed together even though they have zero overlap on an individual level. I absolutely do not need to know how to implement a game engine if I'm using Unity, for example. And someone making their own engine has no use for how to use Unity. Not that there is a good entry for using a game engine right now, but hopefully there will be. I have no idea what education means. If you're talking about educational game design, it doesn't feel different enough to need a category. You do the same stuff. If you're talking about tutorials and learning, I have to ask what aspect of the site is aimed anywhere else in the first place? I don't know what industry would be either. And devops feels like a subcategory or something relating to teams that should exist. But these are all random ideas without any real thought put into it. I'd just hate to see you make the equivalent of an awful UI where there's a hundred menus and you have to go six deep in sub menus before you can even find anything. Best of luck.
  11. Automation is hard. I've made a lot of money because of that, and on both sides. I've been paid healthy amounts to automate things, and I've been paid handsomely for things that only needed to be done because automation is hard. Not in games, just in general. If you want an example in games, look at Rimworld. You can watch videos if you don't want to buy it as it is very popular to post videos. It tries to automate a lot of stuff, and often this means a character will run fifteen seconds across the map to start X job, get there and decide to immediately run back for food, get there and eat, then run back to resume job, then decide its time for sleep, and basically never get much done. And your person might decide to eat raw food X, then get sick or complain they didn't like it, instead of eating a different food that was two spaces further away that they would have liked. Or your person might run into a gun fight trying to repair walls catching stray bullets. It is a game still actively in development, so these things might get fixed. But it should display the difficulty, especially how all these interacting systems make things harder because of those interactions. And on top of the difficulty, you are spending time developing code just to make sure the customer doesn't even get to play a certain aspect. That is often hard to justify. Imagine going into a meeting proposing you spend a week or two automating X, and the boss responds "but don't players enjoy doing that?" You better have proof they don't. RPGs being mentioned make me think of that. There is a perception, whether right or wrong, that players enjoy looking in their inventory and seeing awesome upgrade X and equipping it. The prevalence of loot boxes seems to imply the perception is correct for at least some players, and also seems to imply developers are more likely to add even more "let me see what I got" mechanics than automate them away.
  12. richardurich

    Compiler warning about missing ending '

    You can just put the entire string in double quotes, and it should be fine. \' should also work. Or '''. The issue is that technically ' is not a valid preprocessor token unless it is part of a character constant or part of a string literal. Some compilers ignore this restriction, so the code you provided may or may not cause an error.
  13. richardurich

    Understanding Game Loops

    Oh, what the heck. It's the weekend, and this could be fun... public void run() { //this lets the public say "run" and you respond long lastTime = System.nanoTime(); //last time sounds a lot like now, but it's not... trust me final double amountOfTicks = 60.0; //establishing you're using Java instead of languages with const double ns = 1000000000 / amountOfTicks; //apparently ns is 1/60th of a billion. double delta = 0; //Delta doesn't fly here int updates = 0; //no updates for you! int frames = 0; //no frames either! long timer = System.currentTimeMillis(); //what time is it? In Milliseconds! Called timer, because it's totally not! while(running) { //clearly the work of an inferior mortal who hasn't heard of "while (!done)" long now = System.nanoTime(); //now is like now, but in nanoseconds delta += (now - lastTime) / ns; //So now that we know when now is, let's figure out how many nanoseconds since last time we checked. Then divide by nanoseconds, which would give us a fraction of a second, except ns is really a billion over 60, so we've got some mess of what portion of 1/60th of a second has passed. Oh, and then we will add it to delta, because apparently delta isn't really the delta from last time, but a running total. So, sure it would make more sense to call it "fractionOfFixedUpdateTimeElapsedSinceLastFixedUpdate" or something, but we like flying with Delta. lastTime = now; //now that now isn't now any more, we'll call it lastTime. if(delta >= 1) { //oh, that's right... fractionOfFixedUpdateTimeElapsedSinceLastFixedUpdate. If that is greater than 1, it's kind of obvious what it means. But we fly with no comments and variable names that are brief even if they introduce needless ambiguity! tick(); //we don't know what tick is, but we can guess! updates++; //we have one more update now delta--; //showing off that your compiler isn't broken. That's right Microsoft, I went there! (don't tell anyone I'm going to stir up trouble later) } render(); //I bet this is when we render a frame. We better render faster than 60 fps or stuff isn't going to do what we think! frames++; //we have one more frame under our belts! if(System.currentTimeMillis() - timer > 1000) { //if current time is more than 1000 ms later than "timer" timer += 1000; // add a thousand to timer System.out.println("Ticks: " + updates + ", Frames: " + frames + "\n"); //show how many updates and frames we had updates = 0; //apparently we don't have any updates any more frames = 0; //or frames } } stop(); } This is mostly in jest. It's not hard to read or anything, although if you used the same names and such in a far more complicated program, I'd get frustrated because you'd be that guy that calls everything a timer, or any value you change to anything else delta. To me, delta is always exactly current minus old. No modifications. But I'm a jerk, so who cares? And for me, timer should be a timer. Like I'd expect timer.nextTriggerTime to be a thing, not timer to be an int. And I guess objects have gotten me used to explaining those ints in long variable names. But it's not entirely in jest. You seem to have already gotten caught forgetting what time units you're using where or something (I can't tell for sure since I can't see the old code) But the real bug waiting to happen in your code is if you constantly get 30fps. delta will grow and grow. You probably want it to be a while delta > 1 instead of if. And if it's good enough for Unity...
  14. richardurich

    Find and delete Vector element

    Does it fail because you're not including <algorithm> or does it give an error? When asking for help, it's pretty much always a good idea to give the exact error message you're receiving.
  15. richardurich

    What Programming Language Should I Tackle First?

    It depends what you want to do eventually. If you're aiming for level design or non-core game development, Lua, Python, etc are better than C++. If you want to strike out on your own, C# is best. It's what is easiest to use in Unity, and honestly a person's first game should probably be in Unity. Even if you graduate to Unreal and C++ before actually releasing a game, I'd do the learning of basics in Unity. Better tutorials. If you're hoping to land an internship with a AAA developer, and get hired by them, find out who does internships at your school, who you want to work for, etc. It's quite possible C++ will be the route to take for that as the people looking are usually people more impressed by C++ or even side projects in Assembler and such. My strongest recommendation, no matter which language you choose, is to finish projects. The likelihood of being hired skyrockets if you say you made a Tetris clone as part of your learning than if you say you tried to make a Tetris clone. Even if you go apply for a job in a different field, you're still more impressive when you say you start and finish things for fun, which is what you're doing when you do it without being told it is an assignment. Businesses want people who get things done, not who give up halfway through.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!