• Advertisement


  • Content count

  • Joined

  • Last visited

  • Days Won


fastcall22 last won the day on March 28

fastcall22 had the most liked content!

Community Reputation

10876 Excellent


About fastcall22

  • Rank
    Web Developer

Personal Information

  • Interests

Recent Profile Visitors

30296 profile views
  1. Use a different character or split it out into two separate operations: char buf[1000]; int i = 123; // TODO: error checking, bounds checking, safe-versions of string functions char* ptr = buf; ptr += sprintf(ptr, "Text format, i=%d", i); strcpy(ptr, " and five (5) percent signs: %%%%%"); cout << buf << endl; https://ideone.com/fX8yfV
  2. What is the reasoning behind the use of placement new here? Is it related to your wanting to keep a pointer for future use? If so, then you may be better off reducing `pSet` to `std::set<int>` and using std::set::clear instead. This may (depending on the underlying implementation) give `std::set<int>` to reuse its allocated memory rather than freeing it and reallocating later as you are trying to do. As it stands, the example can be reduced to `std::set<int>* pSet = new std::set<int>;`. If you are attempting to localize where `std::set<int>` allocates its elements, then you must give it a different allocator, such as a linear allocator. And, most types have a destructor. In the example above, the destructor for `std::set<int>` can be called like so: `pSet->~set()`.
  3. Gamedev.net does not condone reverse engineering commercial games.
  4. Jumping The Same Height At All FPS

    Nothing, except perhaps integrating linearally. See also Riemann_sum integration. Using a shorter dt gives a more accurate total distance traveled in the jump compared to a longer dt. The “de facto” solution is Fix Your Timestep, where the simulation is integrated in fixed steps, and the state is tweened in between updates while rendering.
  5. C++ Problems with shift left (<<)

    This is due to signed integers and 2’s compliment. According to this answer in Arithmetic bit-shift on a signed integer, bit–shifting with negative numbers is undefined. Here’s a small demonstration: https://ideone.com/ddPyFy #include <iostream> using namespace std; int main() { char a = 0xFF; unsigned char b = 0xFF; cout << (int)(a << 1) << endl << (int)(b << 1) << endl; } -2 510
  6. C-Lesh - My Video Game Programming Language

    Please don’t. The forums are not an appropriate place for constant updates. Why not start a blog instead? https://www.gamedev.net/blogs/create/
  7. I would like to appeal my banjo

    You asked for it. Your ban will be removed tomorrow.
  8. Unifying Windows 10 Terminal Settings Again

    The issue appears to be within the default shortcuts themselves; the shortcuts to Windows Command Prompt, and Windows PowerShell copied from the default user’s start menu. Removing these and replacing them with hand created shortcuts, setting “Start in” to `%HOMEDRIVE%%HOMEPATH%`, and proceeding with the permissions adjustments above will fix the shortcuts disappearing form the start menu.
  9. Best Video Game

    Well, that escalated quickly. Locking. Yunus, you were previously warned about combative behavior on several accounts.
  10. Scrolling 2D Background

    Seamless textures is what you’re looking for. :^) According to the GIMP documentation, there’s already a built–in plugin. EDIT: And there’s a more advanced plugin here: http://registry.gimp.org/node/28112
  11. modeler looking to build a team

    Closing upon OP’s request.
  12. C++ Linker problem.

    Not exactly. See also How does the compilation/linking process work? and “Why can’t I separate the definition of my templates class from its declaration and put it inside a .cpp file?”. Headers declare existence of symbols, not their actual definition. Some of examples of such declarations are: Global variable `extern int my_global_int` Global function `bool is_equal(int,int,int)` Class methods `void Foobar::frobnicate(int)`. Source files provide the definitions of symbols: `int my_global_int = 123;` `bool is_equal(int a, int b, int c) { return a == b && a == c; }` `Foobar::frobnicate(int x) { std::cout << "this=" << this << "x=" << x; }` The source files are compiled into object code. Object code is assembly instructions or data with associated symbols. Headers allow others to know of these symbols’ existence, without having to compile those symbols themselves. It’s the job of the linker to find all of those external symbols and find their definitions, be it in object code you compiled yourself, in a static library provided elsewhere, or even in a dynamic library. Templates are a different kind of beast. They are more code–generating code than they are actual code. Their symbols and definitions aren’t known until it is used. For example: // is_equal.hpp: template<typename T> bool is_equal(T a, T b, T c); // is_equal.cpp: template<typename T> bool is_equal(T a, T b, T c) { return a == b && a == c; } // explicitly instantiate code for `int` and `float` template<> is_equal<int>(int,int,int); template<> is_equal<float>(float,float,float); // main.cpp: #include "is_equal.hpp" int main() { is_equal<int>(1,1,1); // ok is_equal<float>(1.f,1.f,1.f); // ok is_equal<double>(1.0,1.0,1.0); // Unresolved external symbol } Unless the definition of `is_equal` is known upfront, then it cannot be used, unless the object code for those types are provided elsewhere.
  13. Favorite game genres

    This thread is 13 years old (!) Closing.
  14. C++ C++ Custom Memory Allocation

    These types of questions are generally easy to search in your favorite search engine. For example, "C++ dynamic_cast static_cast" gave me this result: https://stackoverflow.com/questions/28002/regular-cast-vs-static-cast-vs-dynamic-cast Additionally, it would seem that the article is not formatted properly. The correct code should look something like: inline void* alignForward(void* address, u8 alignment) { return (void*)( (reinterpret_cast<u8*>(address) + static_cast<u8>(alignment-1)) & static_cast<u8>(~(alignment-1)) ); }
  15. C# How to reduce data sizes?

    What kind of precision do you need for your position coordinates? What are your limits on data? I imagine for something like this, a “snapshot frame” could send the full precision of state (X, Y, Z, rotation), while intermediary frames use less precise or fewer bits for changes between them. If possible, I’d look into gzip compression, but I suspect it won’t have too much of an effect. EDIT: Some rough guesses. Assuming some reference frame that has the full precision of the `(X, Y, Z, rotation)`, and for each frame, we use halffloat precision for deltas for a total of 27 bits/entity, then several million entities will be about 54 Mbits/update. Or perhaps, you could use a variable number of bits and only send the components that need updating: `(ID, (component, value), ...)`…
  • Advertisement