Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

268 Neutral

About Wolfdog

  • Rank
  1. I recently had to move to a system much like this and would like to disagree with you on this point. I will agree though that until the game has enough traffic to actually require it, it is overkill, but that design does have some benefits. Database engine vendors ( i.e. MySQL, MSSQL, Oracle, etc. ) spend millions of man hours working on caching algorithms, data integrity, query optimizations, etc. Don't defeat that work by trying to write your own cache in front of the database. Odds are pretty good that whatever you write will not be as good as what the database engine itself can do. [/quote] Although very true that databases have a low level caching system and it is very effective. The problem is that it is usually not enough. These low level caches are flushed very easily. For example a database caching the result of a query for data related to a user's character. After the first query subsequent queries will be cached only for as long as the table that the data resides in is not changed. The second a new user signs up the cache is flushed for all characters because that query could potentially return different results. Although at a high level these two operations are not related at all. There's also the case that the low level database cache is keeping all data related to a query cached when you may only need a small portion thus allowing more space to cache more results. Having your services connect to the database directly is also less work in the long run. Instead of having to write code in the service, that sends a special command to the db front end, which has special code to convert this command into SQL, which then gets the result and has to handle buffering it back to the caller, which then has to interpret and use it; you just issue the SQL command directly from the requesting service and handle the result. This also simplifies debugging as you have simplified the system, making it much easier to trace. You've also made it easier to maintain since you no longer have to change two services to make one change. [/quote] Although arguing the other way having a database application can simplify as you scale out your database. Not only does it manage caching but i can also manage connecting to a horizontally partitioned database and any master or slave servers that each may have. This allows you to only mange these connections in one application when scaling the database. In my own case we have an application layer acting as the database that communicates with multiple MySQL and Memcached servers. This database application is used both for the game and the website so caching is the same between the two. Of course the game servers do their own in memory caching as well. For example, collecting gold on the ground as you're running is not immediately committed to the database layer as you pick them up but added together and updated a small time later as one transaction.
  2. Wolfdog

    finding angle between two vector

    I'm not sure if I fully understand your question but the arccos of the dot product of the two normalized vectors will give you the angle between them. The cross product will give you the axis of rotation. You can then build a general rotation matrix using your rotation axis to apply the rotation to any other vector or transformation matrix.
  3. Wolfdog

    reversing vertex transform

    You will want to multiply the vertex by the inverse of the world space transform to get the vertex back into object space. I assume you combine your quaternion and position into a single transformation matrix. You could invert that matrix or I believe you can invert the position and quaternion separately.
  4. Wolfdog

    linux get Cpu Count?

    You can read /proc/cpuinfo. This will have one entry for each core. If the processor has Hyper Threading you will see two for each core. Although I think the file has values that could be used to determine actual physical processors.
  5. Wolfdog

    Unique Client Identifier

    Quote:Original post by hplus0603 Another option is to let user prefer/vote on other users, and users who are troublesome simply don't end up playing with people who don't like them. Along the same lines. Some volunteer players that can act as mini moderators. Allowing them to suspend and recommend banning can be useful to keep the peace.
  6. It's there you just need to look carefully or setup just the right test case. Usually these corrections are very small so they can be corrected by smoothly nudging the player over a few frames. In some larger cases though you will need to snap the player back. Information about the Source Engine's networking
  7. Wolfdog

    Wrong port #?

    That is correct behavior. The client needs a port to communicate through as well. Usually the client application allows the OS to choose that port for it. Say your server is listening on port 80 and you're connecting on the same machine using Your server would have the socket and your client would get a pseudo random port of say 1234. The client would be sending data to and the server would respond with data to You would not want your client socket to use the same port as the server because then you could not have two connections to a server using that port 80. You also could not have the server and client on one machine because they both cannot create a socket for port 80.
  8. Wolfdog

    When inheriting how do you..... C++

    Quote:Original post by chadsxe Does this still occur when you are not creating the object dynamically via new? Regards Chad If you mean do you need a virtual destructor then no. FAQ Lite
  9. Wolfdog

    timeGetTime problem

    Looks fine, you're not applying any forces anywhere else? Otherwise, next step would be exactly what Aardvajk said.
  10. Wolfdog

    std::Map Performance hit

    You're going to want to profile your code to best answer this type of question. It's also usually best to code first optimize later. You really should have no problem pulling a single item from a map with hundreds of items once per frame, but if you start searching through the map thousands of times per frame it could add up. Your key comparison function could also have an effect on the performance.
  11. Wolfdog

    timeGetTime problem

    Do you have some sort of physics system? How are you calculating and when do you apply your jumping force? Or, is it an animation and/or translation over time?
  12. Wolfdog

    Multithreading Win32

    Quote:Original post by MadMax1992 1. Never access the same function at the same time.Multiple separate threads executing the same function concurrently is not an issue, actually it's very common. It works because each thread has its own stack.
  13. I see, the crash was not the problem you were interested in but more so why the map was unable to find your key. Either way I would at least recommend changing your item == _settings.end() into an assertion. If you leave your code how it is you may end up crashing in the future and may not know the exact cause.
  14. const std::string &UserDefaults::get(const std::string &key) const { SettingsMap::const_iterator item = _settings.find(key); if(item == _settings.end()) { std::cout << "oh noes!" << std::endl; // Quick hack static std::string empty = ""; return empty; } // You cannot do this if item == _settings.end() return (*item).second; } The problem is that you cannot use the iterator if it is equal to _settings.end(). You need to handle that case yourself. With the added constraint of the function as const you cannot insert a default value into the _settings map and return a reference to that. I have written a quick hack for you that will work though. Not sure if you want your default value be an empty string.
  15. Wolfdog

    Memory address and platforms

    Memory is indexed by the byte, picture: --------------------- | Address | Byte | --------------------- | 0x00000001 | 0x01 | --------------------- | 0x00000002 | 0x04 | --------------------- | 0x00000003 | 0xCF | --------------------- | 0x00000004 | 0xFF | --------------------- | 0x00000005 | 0xAB | --------------------- | 0x00000006 | 0xAC | --------------------- | 0x00000007 | 0xAD | --------------------- | 0x00000008 | 0xAE | --------------------- Reading one byte of memory: char *byte2 = 0x00000002; char *byte3 = 0x00000003 char val = *byte2; // val = 0x04 val = *byte3; // val = 0xCF Reading four bytes at once: int *dword1 = 0x00000002; int *dword2 = 0x00000003; int val = *dword1; // val = 0xABFFCF04 val = *dword2; // val = 0xACABFFCF Note: The four bytes are backwards, assuming little-endian. You can't actually get memory at those addresses in user mode and you also probably want to avoid the unaligned reading in reality.
  • 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!