Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

  • Days Won


Bregma last won the day on April 22

Bregma had the most liked content!

Community Reputation

9316 Excellent

1 Follower

About Bregma

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. If you XOR the string with itself byte--by-byte, it will consist of only 0 bytes. Since it's all a known length of zeroes, you just need to store the length. Then, at runtime, you just need to allocate the length amount of space on the stack and XOR it once again with the original string, and voila, no need to store the string in the DATA segment, it can go in the BSS segment instead. It's called the "turtles all the way down" method.
  2. Bregma

    Programming and Higher Mathematics

    All of it.
  3. How to reinvent virtual dispatch using C++? There are many ways, all of them wrong. Perhaps you should just simplify instead. Have an Item class. Store objects of the Item class in your inventory. Give items properties, such as `is_wearable` and `melee_damage`. Use them as appropriate. RInse and repeat.
  4. Bregma

    Overengeneering Modularity

    Of course, rewriting is an opportunity to learn from experience and make things better in many ways. Just be aware of second system syndrome. Don't worry too much though, your third attempt is usually that much better again.
  5. Maybe it's because you're using a GUI, but you seem to be overcomplicating things. Git was made by a very lazy developer for what he considered idiots; don't second guess it. If you were on the command line, you would use two commands. First, add a remote repo named 'github'. git remote add github https://www.github.com/Joshei/MyGolfRepo.git. Them push to it. git push github master The git command line is verb-object-subject, which is a little confusing for native English speakers, but these days is fairly consistent. Other than setting your name and email, you generally never have to mess with git internals, like anything using 'git config'. I guess you'll have to spend a lot of time playing with the GUI to figure out which 1000 words of picture it takes to do the action of two command, though. Good luck.
  6. Bregma

    Size of enum class? (c++)

    QFE. If you care at all about size, offset, or marshalling/unmarshalling, an enum is inappropriate. You need an integer of known fixed size, and you need to be able to convert between the two. I've just been dealing with a customer who lost a (multi-million-dollar-valued) safety certification because they thought they knew what they were doing by using enums in a hardware interface (this is obviously not in the game development industry). Do not treat enums as integers. If you treat enums as integers, you don't know what you're doing. If you don't know what you;re doing when you're writing software, you're going to end up sad sooner or later.
  7. Bregma

    Is this OpenGL Modern Enough?

    Another data point to consider is that OpenGL 3 is not API-compatible with OpenGL ES. OpenGL ES is considerably more widespread: it's used on mobile and embedded devices rather than Linux PCs and a few Microsoft Windows PCs. OpenGL ES 3 is pretty much a proper subset of OpenGL 4, so your best bet for a "modern" OpenGL is to learn OpenGL ES 3 -- but that said, starting with OpenGL 3 tutorials will not hurt because it sets up the programmable-pipeline concept. It's mostly that the API to set up the data transfer between CPU and GPU, and how the shader receives and processes those data, became much more generic with the newer versions.
  8. Great. Now I have the Gnomoria theme song running through my head. Again. Anyway, I would take a look at what they did in that game, see what they got right (most stuff) and what could be improved on (cursor control, more than cursor location). Have the current selection anchor stick to the "surface" of the current view and follow the cursor as a view-cursor-taget projection -- the "surface" may be the top of the current Z-slice in cutaway mode. Have the selection anchor glow around the edges of the square for feedback. I don't think people today have a lower IQ or are generally more incapable of grasping ideas than folks of years gone by. Why do you think they'd be confused by an isometric view? Heck, if there's a sustainable market for Dwarf Fortress and its UI (and there apparently is; I know I've gratefully sent them my money), you may want to revise your judgement of humanity.
  9. Bregma

    How common are non competes?

    In most jurisdictions these have repeatedly been thrown out by the courts based on the notion that you have a right to earn a living with your skills and knowledge (note: this is not the "right to work" popular in some places). Of course if you sign such a promise, they'd have to take you to court to enforce the contract and you'd end up paying out of pocket even if you'd inevitably win. On the other hand, companies with deep enough pockets to sue tend to know the case law and not bother with such an unenforceable clause in a contract. What's easier to enforce is the idea that you can't take your work with you. That means client lists (for salepeople) or skunkworks/hobby projects developed while an employee (if you're a developer). There are plenty of precedents where an engineer left to hit the ground running with a startup and their former employer claimed ownership and won in court. Declarations of interests in existing intellectual property protect everyone, not just the employer.
  10. Bregma

    How much longer can Trump/Trumpism last?

    Well, I live in a country with first-past-the-post electoral system and traditionally multiple significant political parties. All I need is a single counter-example to disprove the proposition that first-past-the-post always leads to two parties. I had the opportunity last weekend to view some US television. I was aghast. My observation is that there is definitely a pathological culture at the heart of the current political situation. I don't know if it's been intelligently designed that way or it simply evolved, but there's definitely a life-threatening disease at play. I mean, all the ads were either weight-loss-related targeted at (always young and slim appearing) women, hair loss prevention for men, medications to ask your doctor for, or insurance of some description or another. If I were to be bombarded with that every day, I'd believe the sky is falling and I'll be too fat, bald, and undermedicated to do anything about it too. Then I switch to Fox News. Holy flocking sheep, I now understand why the press can sometimes be described as 'enemy of the people'. I don't know the solution, but it's definitely a symptom of an underlying pathology that gets expressed in the voting booth as well.
  11. Bregma

    C++ Common Runtime

    Interestingly, p-code systems like this were first implemented in the 1960s and OSes based on it became one of the competing alternatives to native compilation in the heady early days of the microcomputer (Microsoft's CP/M clone MS-DOS won that competition, but for non-technical reasons). The solution for the platform-portability problem has been resolved in recent implementations, such as Google's Go, by statically embedding the OS runtime in the application at final compile time so they can run alongside native applications on non-pcode OSes.
  12. Bregma

    Array arithmetic

    Nope. You stumbled onto pointer arithmetic and went into denial. In C and C++, arrays are really just pointers (with a few extra properties, not relevant to the discussion). Pointers are really just integers (with some extra properties, not relevant to the discussion). In the algebra of integers, addition is a commutative operation. Indexing an array using its operator[] is just adding an integer index to an integer pointer. It makes perfect sense that you can also add an integer pointer to an integer index and get the same result.
  13. Undefined behaviour may or may align with the programmer's expectations, until or except when it doesn't. Anyway, OP's concern was that the lifetime variables declared with automatic storage duration was a misnomer because it doesn't correspond exactly to the lifetime of the automatic storage. His assumption was the two lifetimes should align: the only actual requirement is that the lifetime of a storage class needs to be at least as long as the variables stored therein (a variable that lasts beyond the lifetime of the free store, for example, is a memory leak). It's not a misnomer, it's an incomplete understanding on OP's part.
  14. Bregma

    UDP Confusion c++ sockets

    I've been writing socket-based networking applications for maybe 20 years or more, including high-throughput servers that process many thousands of connections simultaneously, and I have never witnessed anything but full duplexing (ie. reading and writing are independent) and have generally always used non-blocking mode. EPIPE has always meant the write buffer is full: either the client end has closed (but not shut down, so the connection is in TIMED_WAIT state -- see shutdown(2)), I've accidentally shut down the ephemeral server socket (bug in my code), or I've tried to write more bytes than the write buffer will hold because I haven't checked to make sure the socket is available for writing. Yes, you have to check to see that the socket is available for writing, and you have to track how much was actually written so you know to start the send from on the next write() call. That's why that API is the way it is, it's not just to fatten the documentation. When read() returns 0, it means there is nothing left to read on that fd. Go back to waiting on select(). Of source, read() returning 0 does not mean the message was completely received using TCP, you need your own protocol on top of the TCP stream to know when your message is complete (send bytecount, add a termination marker, hard-coded sizes, whatever). You still need to check if the socket is ready for UDP, but sending or receiving part of a message makes no sense: either you get/send the whole thing or it gets discarded. You probably also want to use recv*()/send*() for UDP instead of read()/write(). Anyway, good luck.
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!