Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

1650 Excellent

About blutzeit

  • Rank

Personal Information

  • Interests
  1. blutzeit

    Getting rid of void*

    I don't see why you want to mix different types of event listeners in the same list, they are more different than similar.   For something almost, but not completely, different:
  2. blutzeit

    Getting rid of void*

    The std::function is really nice, code would be something like this:  void Event_Bus::Add_click_handler(std::function<void(Click_Event)> handler) { // save the handler somewhere } With no need for special interface classes that you need to derive from, code becomes much cleaner.  event_bus.Add_click_handler([](Click_Event event) { // handle the event here }); Note that you can capture variables between [ and ] if you need to. 
  3.   That's a bad idea. First, you would increase the bandwidth by two orders of magnitudes, which is not just a little bit. Second, today the majority of packet drops are caused by congestion, meaning that not just one but many packets are dropped, so if you send many at the same time you still risk losing them all.   Back to the original question, your solution is to not only send position but also velocity (and possibly acceleration, depending on the game), as well as a timestamp. On the other end you will then be able to calculate the expected position at any time from the last known values of these parameters. You can improve this further by using various techniques for interpolation and clock synchronization.
  4. C++ desperately needs conditional come-froms
  5. Most likely a firewall at the cloud provider that is blocking ICMP packets. Could be the university WiFi, try testing some random address, say, and see if it works.
  6. blutzeit

    Mobile multiplayer game

    Yes, that's a third problem to take care of. If you use UDP you need to detect missing messages and make sure to resend them, while TCP takes care of this and guarantees to deliver the message eventually. But note that even if you use TCP you don't actually know *when* the message will be delivered, only that it will. So if absolute wall-clock synchronization is a requirement, you're right, you need to wait for that acknowledgement. (For games this requirement is usually relaxed, consistency and responsiveness is usually more important than absolute synchronization.)
  7. blutzeit

    Mobile multiplayer game

    There are two problems here. One is to synchronize wall clock time, either by using a centralized reference (say ntp), or to guessing from the round-trip time between the clients. The other is synchronizing simulation time, which is solved by using a lookahead. If player 1 presses a button at simulation time T, the change is scheduled to take place at time T+D where D is sufficiently large to be sure that this information has been transmitted to player 2.
  8. blutzeit

    Multiple server architecture

    Sounds like a typical application level SDN, where the main server acts as a controller, servers as switches and clients doing host-to-host communication. Check out the following links for more info:
  9. blutzeit

    Linux c++ debugging

    I'm using CLion from JetBrains (the ReSharper folks), works great on all platforms, including Linux. Highly recommended for modern C++ development.
  10. Using std::function for lambdas is like using std::vector for arrays. I tend to use both heavily (except in cases where I don't).   The advice is to know what you are doing and to know what it will cost you (but that's true for everything in C++!!).
  11. blutzeit

    C++ duck typing with optional members

    Nice!!!   Some ideas: Put the FindMember classes inside a namespace, e.g. FindMember::Foo instead of FindMember_Foo. Instead of macro TRY_GET_MEMBER, overload operator ->* on these FindMember classes.  std::vector<DrawItem*>* zpass = view->*FindMember::zpass<std::vector<DrawItem*>();
  12. When choosing between different methods, it's important to consider which is more error prone. If I forget or add "this->" by mistake I would like to compiler to catch this. If I'm doing a text-based search for a parameter name I would like to find it in both declarations and definitions.
  13. @Oluseyi Good pst! If this was Stack Overflow it had to be marked as the officially *accepted* answer.     A minor clarification/update: iOS testflight betas are invitation only, and I also believe Apple recently removed the ability to rate/review beta versions.
  14. blutzeit

    Is O(0) equal to O(1) ?

      Not sure I agree with this at all.. that would be O(1). O(0) is only the empty algorithm. NOP is not O(0), an empty function that is actually a function is not O(0), ret 0 is not O(0), the only thing that is O(0) is nothing, the empty algorithm that is never started and never ends as it is nothing. Try to call it on the complete set of particles in the universe and it is never run, the algorithm is never started and never existed as it was erased on compile-time. If one source contains an algorithm and another does not and they yield identical bytecode after compilation, then that algorithm is O(0).   Leaf-methods on trees where only branches have code can reasonably be described as O(0), if they are expected to be optimized out for example. Can't think of an example where it would make a difference for the final O(..) .. but I somehow suspect there might be some example where a sub-algorithm that is expected to removed would give a theoretical answer closer to reality if it was designated O(0) rather than O(1) in the analysis.     I'm going to disagree slightly with both of these. To me the most coherent definition of O(0), at least based on the definition of O I've always used (which is the same as Wikipedia's) is to say that f(x) is O(0) if and only if f(x) is the empty algorithm for values of x larger than some (finite) x0.   Similar to what frob is saying, but I don't think saying that a function tends toward having no complexity is quite strong enough, as it permits that the function f(x) may still have non-zero complexity for all values of x.     Why a special definition of O(0)? It works well with the ordinary one:     if and only if    Set g(x) identical to zero and f(x) = 0 for all x >= x0. You could then either prove or define the empty algorithm to be precisely the algorithm that takes zero time. The empty algorithm doesn't depend on anything, and in particular it doesn't depend on x, so it would take no time regardless of input. No matter what angle you approach this the result should be the same.
  15. blutzeit

    Is O(0) equal to O(1) ?

      Is it? If you are discussing time complexity in terms of O(...) how can O(0) be any more moot than O(1)? The math is as you say rigorously well defined, even if the computational model not always is. Elided code (e.g. inlined empty function body) can be meaningful from a higher perspective but should reasonably have time complexity O(0).
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!