Jump to content
  • Advertisement

Bregma

GDNet+
  • Content Count

    3060
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Bregma

  1. Bregma

    Symbol lookup error on Linux

    Try playing with adding -Wl,--whole-archive to the LDFLAGS when building the bullet DSO. You're only doing partial linking when you're building your plugin, and the linker doesn't see the static object being used outside the library so it gets left behind in the static library. You need to tell the linker to put all of what's in the archive into the dynamic library. Creating shared libraries from static archives is tricky, that's why most build tools are a little goofy when dealing with that.
  2. Seems to me you changed your project from "multi-threaded" to "multi-threaded DLL" and now you need to change all the DLL binaries you supply to match, otherwise the linker will ignore them. No one ever said Microsoft Windows was easy on developers (and was telling the truth). All the binaries you link together in Microsoft Windows have to have the same [debug|multi-threaded|DLL] settings or you will get failure.
  3. Bregma

    calculating normal vectors

    Yes. It says the equation for the surface of the thing is f(p), and the equation for the normal to the surface f(p) is perpendiculart to grad f(p). The upside-down triangle thingie (nabla) is the symbol used to represent the gradient operator, and it refers to a vector-valued derivative. In other words it expresses how the normal is a parametric function of the surface equation in three variables in about as simple and precise a way as possible, in a way that only a mathematician would love.
  4. 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.
  5. Bregma

    Programming and Higher Mathematics

    All of it.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. 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.
  18. 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.
  19. 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.
  20. 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).
  21. 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.
  22. 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.
  23. 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.
  24. 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.
  • 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!