Jump to content
  • Advertisement


GDNet+ Basic
  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by Bregma

  1. Bregma

    Why are member variables called out?

    Since global variables are for the most part a bad idea, you should probably call them out where necessary by namespacing them. Maybe prefixing a "g_" (or if in C++, using their fully-qualified name) is a good practice. The case for namespacing member variable inside a member function comes more from distinguishing the object state from the local state. If you qualify the member variables with a prefix (eg. m_, this->) or suffix (_) you know when you're mutating object state as opposed to local function state. That's the fundamental argument for obfuscating your variables this way. Fewer warts in your code is better. Sure, it satisfies the CDOP (ie. OCPD in proper alphabetical order) in many developers to categorize and neatly label their variables, but if it makes it harder for someone else to comprehend the logic, you're not doing yourself any real favours.
  2. Bregma

    How Do I run garageband on Windows 10 ?

    Garage Band is a nice toy but it doesn't hold a candle to production-quality audio creation software. It would be illegal in most Western jurisdictions to run Garage Band under an emulator on Windows. We can't help you with that here.
  3. There will always be shrinkage, so take that into account in your economic models. People are, by and large, willing to exchange their time and effort (measured in currency) for a quality product. Some will always try to steal. Your best recourse for maximizing the former and minimizing the latter is to provide a really good quality product people are willing to pay for. If you decrease the quality by adding all kinds of copy protection and anti-theft measures, you end up decreasing the paying demand. There are well-documented cases of copy protection killing products throughout the history of the commercial computer game industry. A consumer owns their computer, and despite the efforts of lawerly salepeople with their shrink-wrap EULAs and ideas about technical protection measures and "intellectual property ownership", the consumer owns every single bit sitting on their hard drive and in their RAM and if you try to control what way they flip those bits and when (which is what copy protection effective does), you're going to fail. You can not control what someone does with their own computer no matter how many laws your industry lobby groups get passed. Seriously, just write really good games, control what you can, and accept what you can't control. That, and some random luck, is how you make a living creating computer games.
  4. When it comes to getting a (good) job, the most important thing isn't what you know or who you know, it's who knows you. The college offers you a good opportunity to network, starting with classes full of fellow students and professors. The institution is not going to help you make friends or build a reputation: that's solely your job. By all means, attend conferences, join and contribute to open source projects, make and publish your own games. Those are all excellent ways to network. Remember that in the end, it's people who make hiring decisions and they hire people, not portfolios or educations.
  5. If it's running in the browser, I can see it. If it's running in the browser, it needs a server, or what's the point of running in a thin client like a browser? If it's running on the server, you can prevent people from seeing it. If you're worried about piracy, keep important parts of your game on the server. Let people copy the stuff on the browser, it's useless without the non-copyable server code. Folks these days get confused by modern JavaScript "frameworks" because they end up obscuring what runs on the server and what runs on the client browser. You just have to deep-learn your any-idiot-can-now-program tools to understand what's really going on under the hood.
  6. Well, while I didn't work in the games industry, I did work for non-Canadian software firms that employed Algonquin grads, and their bona fides were respected as much as anyone's. I also personally know Algonquin (and other CCAC) grads who work in the games industry in Ottawa. You might want to start by questioning your assumptions. Then, pursue your interests, because working all day on something that doesn't interest you is what really sucks and you'll do a crappy job at it and get fired. Take the courses that interest you most and build your portfolio following you passion. Build contacts through those efforts. The jobs will follow.
  7. Bregma

    Advice Simple Windows C++ IDE

    I agree Microsoft Visual Studio is complex, hard to learn, and confusing. In fact, if you're coming from the command line, it gets in your way in ways that reduce your productivity over all. If you want an IDE, I'd recommend Microsoft Visual Studio Code. It has a lit of the fun features of MSVS, like code highlighting and GUI representation of the filesystem, but it's much simpler and comes between you and the computer a lot less. Also, it runs on Linux and has some git integration.
  8. Looks like an XY problem to me. Rather than asking for help with your solution, ask for help with your problem and you might get a more useful answer. Are you having problems with ctypes bindings for a function returning an array of pointers to float as an out parameter, or are you having problems writing a C function that returns an array of pointers to float as an out parameter, or do you actually just want an array of float passed between C and Python? Maybe something else entirely?
  9. QFE. Formatting a format string is a bad bad thing to do. If you include any user input at all, you're opening a gaping hole (imagine a username of "%s"). It's as if you've said to yourself "how can I take one of the most insecure, error-prone, dangerous parts of the language and make it more error-prone, dangerous, and insecure?" Then, of course you come here asking "I've made the most error-prone part of the language more error-prone and now I have an error, can I keep digging until I find my way out?" Modifying format strings that get used elsewhere at some unknown time is implicitly modifying global state as a side-effect of your functions. Instead, make your functions pure and have them returns already-formatted strings, only assembling them into larger strings when you have control and not as a global variable.
  10. On the other hand, if your tool fails to do what you need, you shouldn't adjust yourself to your tool's limitations. You should get a better tool. There are many alternatives to Visual Studio available. Try Microsoft's VS Code for example.
  11. (1) Why are you copying to a temporary buffer and then leaking it? (2) Have you double-checked what GetText() returns (eg. using a debugger)?
  12. Passing a C++ object through C '...' (varargs) is completely undefined behaviour. Avoid undefined behaviour, you never know what you're going to get. Follow Kylotan's advice.
  13. The name resolution rules in C++ are sensible and if they weren't the way they are it would cause many many more problems than one obscure corner case caused by unfortunate variable name selection. What is the restriction on namespaces in your struct that you aren't allowed to use the fully qualified name of a variable to fully qualify its name? Logically, you want the variable at namespace scope, so saying you're not allowed by the logic do do the logic seems mysterious to me. It doesn't sound like the design fault is in the language to me.
  14. One catch is that a number of popular user environments tie operating system evens to the windowing system, and for a very good reason (a multi-tasking OS requires user focus to know the target of many kinds of events, like input, and focus is dependent on the windowing system).
  15. Bregma

    C++ need more randomization

    Store a random generator and use a uniform distribution object to provide your values. It only takes the storage space of one additional integer. Two extra lines of code.
  16. Bregma

    Problems with starting out on linux

    Considering it was first released in 2015, quite some time I would guess. We had a serious effort at Canonical before that helping her to get it to work well. Ironically, the people who did a lot of that work are now working at Epic making the Unreal engine work better on Linux. It's a small and specialized developer pool. You might also consider evaluating the worthy Godot.
  17. Bregma

    std::make_shared vs. new

    You seem a little confused by what a weak_ptr is and how it relates to a shared_ptr?
  18. Bregma

    C++ Invalid read of size 8

    If you don't allocate memory for the pvtElements member, you're going to get an "invalid read" error when you try to read from that memory.
  19. Bregma

    Coding moods

    Full-time programmers probably spend more of their time in meetings, clicking on online time trackers and bug trackers, moving cards around on kanban boards, "researching" on the web, and doing code reviews than they do actual writing code.
  20. Bregma

    Is there a doctor in the house?

    Just a point of order, but "obsession" refers to repetitive thoughts. The term "compulsion" refers to repetitive actions. So, it would be Button Pressing Compulsion Disorder (BPCD) if anything. Doesn't play as nicely as an acronym but could still get you sympathy at parties ("My wife was diagnosed with BPCD and she keeps pushing for a cure...").
  21. Bregma

    initialize std::thread

    Unless of course the compiler decides to reorder the instructions in your code, or the CPU is superscalar and performs out-of-order and/or speculative execution, and you end up using the results of your interlocked add before actually calling that instruction: a locked processor instruction does not affect that but a fence does. Then again, you're using this in a multi-threaded application, so you're going to get pre-empted right after your InterlockAdd and the value gets changed by the other thread after you've obtained it, and you're left scratching your head why things don't work, sometimes, maybe.
  22. listen() is a system call: it will block the thread briefly while it switches to the kernel and performs some setup operations. It gets called once (per server socket, so generally once per application) during startup, and is fairly resource-lean and fast. You call accept() to wait for connection attempts on a socket that you have previously called listen() on. The accept() call is also a system call (requires a switch to kernel mode to perform its operations, which means it steps out of the ready-thread queue and go on the IO-wait queue), and whether it performs a blocking wait on the socket or not depends on if the socket is in blocking mode or not.
  23. Well, yes, you could use blocking sockets and have a thread listen on the socket, accepting client connections as they come, and go back to blocking on the accept call. That's all it would do. It's a very sensible way to program sockets and easy to reason about. You could also use non-blocking sockets and use a multiplexor like select/poll/epoll/kqueue to combine all of your socket waits onto a single thread, and dispatch them via callbacks to a worker thread pool. Again, not too difficult to reason about, but targeted towards a POSIX I/O model rather than a Windows I/O model. If you're using an Windows-based system, you could use IOCP and overlapped I/O to handle everything, including dispatching commands to a thread queue if you really want.
  24. Bregma

    Python Interest in Python

    Yes. Python is one of the main languages that runs the internet. It is widely support. It is worthwhile to be familiar with and a joy to use to program in. The Python standard library has support for RDBMs and key-value databases. I can't recommend an IDE (because I don't recommend using an IDE) but the one that ships with Python itself is IDLE.
  25. The mechanism they introducd into C++11 to do exactly this was the template parameter pack (AKA variadic templates). Prior to that, you could use Alexandrescu's typelists or something similar. It's pretty much an academic exercise: processing a regex at compile time gives you the benefit of incredible and error-time complexity at the cost of massive code bloat. But it's nevertheless an interesting academic exercise, so carry on.
  • 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!