Jump to content
  • Advertisement


GDNet+ Basic
  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by Bregma

  1. Bregma

    Can you make a Game Engine in Notepad++?

    Answer is yes. I wouldn't, because it's a wretched text editor that only runs on Microsoft Windows, but that's because I've got over 30 years using the vi text editor (lately as vim since it came along) and it's fast, has many useful extensions like source colouring, and runs on every machine I've even encountered. Every game I've written has been done using only a text editor and command-line tools. Then again my day job as an OS developer means I often don't have graphics and have remotely connected to a target, and knowing vi has saved my life may a time. What you should do is experiment. Try working with Notepad or vim. Try working with a lightweight IDE like Microsoft VS Code or Electron. Try working with a behemoth IDE like Microsoft Visual Studio or Eclipse. See which fits your mindset. Different strokes for different folks.
  2. 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.
  3. 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.
  4. 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.
  5. Bregma

    How much longer can Trump/Trumpism last?

    Can you explain the relationship between being American and being against the common good? Is 'E pluribus unum' really a despised concept to most Americans? I'm not American, have never lived in America, and have not studied American history, so please explain it like I'm a 5-year-old.
  6. Bregma

    UDP Confusion c++ sockets

    Well, unless the link layer is relying on a human morse code operator, TCP should be able to handle the kind of data throughput you're playing with without blinking. TCP over IP over 802.11n is about 150 megabits per second, divided by the number of devices on your AP. That means you can send on the order of megabytes every second using TCP. If you're experiencing delays on the order of seconds to send 20 bytes, the problem is not the underlying network protocol. Switching to UDP will not alter that fact. Setting TCP_NODELAY on the TCP channel means the driver won't wait for a full packet to send, which if you're streaming 20 bytes is what you want otherwise you will get, like the name says, delay. You may want to dump timestamps of operations into a log file and analyse them. It sounds more like you have inadvertent serialization in your multi-threaded application. Also, make sure your sockets are read and written in O_NONBLOCK mode. Your server should be waiting for events and dispatching them to worker threads and never waiting for read or write completion. You should hold locks only as long as it takes to push or pull data from a queue (and the "data" should be about the size of a pointer or index). Sequence diagrams are an indispensible tool for analysing flow in this situation. You can even annotate them with expected timings and then match against the actual timings from your log file. Certainly, blindly fumbling in the dark by switching session protocols on the network is unlikely to get you to where you want to be.
  7. The compiler knows the offset of a function address in the vtable the same way it knows the offset of a local variable address in the stack or the address of a non-virtual function in memory. If you change the order of virtual functions in a class (for example, adding a new virtual function in the middle) and recompile only part of the program that used that object but not others, you will probably get a crash. That's called an "ABI mismatch" because the vtable offsets are hard-coded, and it's the bane of C++ developers. It's a frequent problem using Microsoft Visual Studio, which does a poor job of dependency tracking (and it only has one job, so go figure) and the fix is to force-rebuild the entire project. It's also a problem with .so files on Linux when developers do not follow best practices (and many believe they know better, so go figure).
  8. Bregma

    How much longer can Trump/Trumpism last?

    US President Richard M. Nixon was actively looking for ways around the term limit provisions of 25th Amendment to the Constitution of the United States of America so he could run for a third term when he was caught red-handed in active involvement in election-related criminal activities. While it's unlikely to succeed, manipulating things to gain more than two terms is a scenario with recent historic precedent and in keeping with Trump's proudly displayed ethos. My guess is that as soon as his last mandated term is up, he's going to run like hell away from the presidency. Constantly swimming in the shark talk has got to be exhausting. It's the spooks behind his administration I'd be more concerned with: the presidency is not a one-man show (despite popular belief) and it's the off-camera puppet masters that are the sinister forces people should be worried about.
  9. The C++ standard library provides a pointer proxy object that does pretty much what you're describing, so you might want to pattern your smart pointer on that. You can even take advantage of the allocator and deleter of the referent pointer object if you're doing your own pool allocation or fortification algorithms.
  10. Bregma

    How much longer can Trump/Trumpism last?

    The longest it can last is about 6 more years. That's assuming he can get re-elected at the end of his current term, and that he can't garner enough vote in state legislatures to get a two-thirds supermajority to pass a constitutional amendment to allow a president to serve more than 2 terms. Or maybe figure out how to pass a presidential decree to invalidate the constitution, because I wouldn't put it past him to try. It can last a shorter time (no re-election, impeachment and removal, resignation, assassination, spontaneous human combustion), but that's the hard upper limit not subject to spin or propaganda.
  11. Bregma

    Font readability across devices?

    You're forgetting viewing distance. It's the important thing when it comes to apparent type size, pixel density is only important when it comes to rendering. The goal is to render at a size such that 12-point type appears to be 12 points tall subtending the view arc. There are 72.27 points to the inch (hey, the 12th century CE was pre-metric), so traditionally what gets done in the size of an inch gets stretched or shrunk appropriately so everything fits. The general rule of thumb is handheld devices are viewed at about 30 cm, a computer monitor at about 60 cm, and a TV at about 300 cm. If you were rendering text on a 72 DPI standard computer monitor (until recently modern monitors were 96 DPI because Apple held patents on subpixel rendering and Microsoft compensated by requiring larger monitors so their text would look better, long sad story) you want to render a 12-point font 12 pixels high. On a 300 DPI phone screen, you would want it about 25 pixels high, except it's half the distance from your eye so it need to be less. What I'm trying to say is you need to take viewing distance into account, not pixel density of the display.
  12. In the real world it has never been the case that as you travel farther from you home there is less and less civilization, it's just that the civilization increasingly differs from your own. The local civilizations are more adapted to their local harsher conditions than you, as a foreigner, would be. Consider how the European migrants almost died in Massachusetts until the Pawtuxet demonstrated their more advanced technology to allow survival in local conditions. The local technology for addressing the harsher local conditions would work better than the stuff you brought with you: for all intents and purposes it is "more advanced" equipment. So, it makes sense that as you go deeper into the "unknown" the more advanced local trade goods would be. As you travel into Orcischland, the available Orc slaying and defense equipment works better against Orcs than the suff from Home otherwise the Folk there wouldn't be surviving. Past that in High Blorghia, your shiny Orcslayer won't work well against the Blorgh and you'll want to trade it in for a brand new Blorghbasher. Maybe even with some friendly Orc traders in a villiage just across the frontier.
  13. Bregma

    Custom size_t

    <stdint.h> was introduced in C99. That's when size_t, uintptr_t, and all the sized integer types were introduced to the C language. The concept of type size_t was adopted from C++. With C++11 the C++ language became based on C99 instead of C89 (ie. the C++ standard includes the C99 standard "by inference" and itemizes the differences between languages from that document in appendixes C and D). <cstdint> was introduced in the C++11 standard, and std::uintptr_t and all the sized integer types were introduced into the C++ language at that time. std::size_t was a part of the original C++98 standard. My guess is the UE code predates the standardization of fixed-width integer types in C++ in at least one target toolchain.
  14. Bregma

    Custom size_t

    I imagine the root of this redundancy is the fact that Microsoft's toolchain does (did?) not support C99, and by inference standard C++. C99 introduced size_t and uintptr_t, and C++ has always provided std::size_t and since C++11 (where is moved to C99 instead of C89) std::uintptr_t. If you want cross-platform portability you often have to work around the non-conforming platforms or else give in and lock in. Always good for party conversation, that Microsoft toolchain. They try.
  15. Bregma

    Defining AAA

    Certainly. Just like other popular human undertakings. Consider the classic examples of the music industry: it has gone through many corporate/independent waves, each usually driven by technological developments in which the independent creators push the edge with their art and then the international corporatists move in and take control in their borg-like fashion flooding the market with mediocre but popular product and milk the bottom line on their quarterly reports to shareholders. Or even consider religion: it starts with the One True Religion and as the usual crowd of organizers and controllers take over and interpret things in their favour until schisms develop and there are many One True Religions splintered off. It's human nature. Nowadays AAA just means a release by a large corporation, probably with multinational ties, which spends a significant if not majority of the budget on marketing and distribution and possibly franchise and intellectual property fees or other things involving rooms full of high-paid lawyers (quick! they're all in one place! it's an opportunity to one-shot the mob!). It does not refer to the technical qualities of the assets, programming, or storytelling or even the generated revenue. Perhaps I'm a cynic but I would speculate that it might be possible to correlate the popular perception of what makes an AAA title and the proportion of the total budget that was not spent directly on development. It would make an interesting paper, if there was someone willing to fund such research.
  16. My answer is: sometimes. I had plenty of surgeries for amblyopia when I was young. Those worked, mostly, although I'm incapable of crossing my eyes they way my friends always could (which, I guess, was kind of the point). As an adult, the results of tests at the ophthalmologist is "limited 3D vision." That means I can drive OK, but I still can't catch something that gets thrown at me (at least I have an excuse for why I was always last against the wall when they were picking teams in grade school). Consider the problem to be a form of input lag with the feedback control on my EM-spectrum sensors. So sad, I'm, sure you're all shedding tears for me at this point as the violin music swells. End result: 3D movies make my eyes ache and just mostly look flat (except may once in a while, a big cheesy effect will "pop", gosh wow). That 3D TV tech that did not use glasses just didn't work for me, it just looked blurry. I haven't tried VR because I can feel my eyes ache just looking at the headset. That, and I'm a cheap little beggar (those things cost many beers). It doesn't bother me since it's a privilege I've never had, but it is annoying that I have to pay a premium for first-run movies when the only screens are in 3D when its effect is lost on me.
  17. If it's really the case that you need to store a value that must be parameterized, then it's necessary to have a constructor in your template that will accept the parameters. You need a "perfect forwarding of parameter packs" template template constructor. That's how templates like std::function and std::make_unique work. If it's absolutely imperative that you be able to construct an object that depends on parameters in a place where you can not give it parameters, your design is wrong and no amount of code magic can fix it.
  18. Bregma

    Market Confussion, Video Game Industry?

    (1) Computer games is hardly an emerging industry. I was buying indie games for my TI-99/4A 35 years ago -- they came on cassette because indies could not afford the manufacturing or license fees for the carts that the big mega corporations used (ah, Burger Time, I haven't though about you in years). Heck, the rich kids in my neighbourhood had a Pong hooked up to their TV 45 years ago. Three generations of developers is enough to start calling it a mature market. (2) Computer games is not a special industry. You're not going to make a full-time living as an indie musician, or an indie film maker, or an indie sports league, or an indie car maker (unless you product line is featured in a series of science fiction films as some kind of time machine). Yet there are still plenty of those around. The very nature of being an indie means you're a small fish in a big ocean and you better be doing it for the love of the art, and be able to pay your rent in "exposure." (3) There are already plenty of laws protecting the market. Unfortunately, an unregulated free-market economy always leads to a plutocracy and a regulated market, where the regulations are in favour of the folks at the same exclusive country club where the lawmakers spend time. In other words, the existing laws, regulations, and justice system in most places is designed and operated to favour the richer among us, whether that's corporations in a capitalist society or elite families and individuals everywhere. You want to make computer games as an indie? Do it. Do it out of love for the craft. Make the best games you can. Put your games on the market. Keep your expectations in line and don't bet the rent money.
  19. I've been hearing the same thing since the 1960s. Of course, we were all going to starve by the year 2000 because of the overpopulation and the impending ice age, but it hardly mattered because of the nuclear apocalypse that would end it all in a single bright flash. Then came the acid rain that was going to eutrophy all our lakes and the GMO frankencrops that would extinguish all our biodiversity. Only now the same Club of Rome folks are telling us we're going to roast on a waterworld as we starve due to the overpopulation by the year 2100, but it'll be OK because the frankenstorms will wipe us all out with the great plastic supertides. For a good background, read a lot of history about how doomsayer predictions have always been with us. Plagues of frogs and rivers of blood, cats lying down with dogs, that sort of thing. Ohhhh, it's going to be bad.
  20. Bregma

    Communism 2.0

    How could the "who" not be relevant? We don;t have true AI yet, so if you;re using the simple linear algebra currently dubbed "AI" it would need to be trained by selecting and feeding data sets. Someone needs to choose those data sets. If history has anything to tell us, and it definitely does, those data sets will be pretty much exclusively based on what's important to a small extra-privileged set of white men. The who is very, very important. If you deny entitlements to those with their hands in the till, well, it's pretty clear how that will end up. Why do you think the most valuable careers we have today is those in control of other people's money? Economic systems do not control human nature, it's the other way around. The minute you have inequity through the uneven distribution of perqs, you have a classist social structure and history has show that that does not end well. Oh, I'm all in agreement that with our current technology we could all live better lives without the need for constant labour or, outside of the population of the incapable due to physical or mental disability, without poverty. I also have enough faith in human nature to recognize that any system will be subverted and corrupted by individuals to bring themselves excess of what they need at the expense of others. I think that's one of the strongest human drives, and once the other fundamental needs are met it will be the one single focus of most individuals. Picture Cnut standing in the tide of human nature.
  21. Start by writing unit tests. I mean: write the tests first, then write your code (TDD). You'll find that in order to make your code unit-testable, you need it organized. You will find that having plenty of unit tests makes it easier to refactor your code as you organize it, or reorganize it, but the biggest benefit of TDD is you end up doing a certain amount of design up front instead of just jumping in to coding, and the sequela of design is organization. Then, move on to BDD, which helps you find and organize your unit tests and helps you avoid the trap of writing tests to the implementation instead of the interface.
  22. Bregma

    Communism 2.0

    Well, it's an interesting thought exercise. The first question that comes up is "who gets to assign point value to tasks?" Obviously that particular job will be worth the most points and earn you immediate top-caste privileges. You would get the best living spaces and are entitled to a fleet of limos, if only there were enough people volunteering to drive you limos. That brings us to the second-most valuable job, the people who assign scare resources. They would, of course, also be entitled to the top tier, otherwise those already in the top tier would not get first pick of the scarce resources they need to indulge their lavish lifestyle. It would become necessary for lower-ranked individuals to trade non-currency resources with each other and members of higher ranks in order to obtain access to the top tier to get some of the scarce resources they're going to need to do their work, or survive, or whatever. The black market will probably end up being the largest part of the economy. What about the market for non-tangible goods? Which god and religion will be the one true religion? Which scientific observations and theories will be allowed to be published? Are points assigned or removed for expressing ideas counter to those deemed correct by the top-tier points allocators? What if I publish ideas counter to the system advocating for a currency-based free-market system of allocating scarce resources? What if I make games that depict non-SWMoPs in a European historic context -- do I gain or lose points? Lots of food for thought there (although how that food gets distributed is unclear).
  23. Dependencies need to be a directed acyclic graph (ie. a tree with no circles). This is true for classes and for header files. Perhaps start by refactoring each class into its own header file, and then only include those header files you need where you need them. If that fails to work because you have logical circular dependencies, try using members by reference (which confusingly usually means by pointer type as described above) instead of by value.
  24. Bregma

    The Battlefield V "Historical Accuracy" Controversy

    Well, as long as they get other games playing as blacks, females, or people without privilege, I don't see the issue? Separate but equal. Now, why the Jim Crow does that sound familiar? I can see it now. Go in to the FC Games boutique at the mall, go past the merchandise for regular normal people, past the pink aisle for the girl games (ponies! unicorns! dating sims! unicorn dating sims!) to find the broken rack at the back with the sign marked "coloreds" for the crime syndicate sims? Hold that tiki torch high in the name of making gaming great again.
  • 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!