Rotonen wrote:For the sake of codebase sanity, I vote for first thoroughly designing and specifying what we want. Only after that writing it from scratch. We do not want to become Microsoftian here with our design choices. We do not have deadlines, we can take our time. Especially nothing is forcing us to use old bad code which was meant to support something which has become obsolete.
Yes, absolutely -- that is the way I usually start on any non-trivial task. The way I've gone about doing it so far is to understand exactly how the gameserver sees beings/MovingObjects. My best guess right now is that the gameserver is seeing the data one way, the client is seeing it another way, and instead of rewriting the client-side code to work with the server, it was just modified/adapted/whatever to kind of sort of work with the server. Clearly, it's not working anymore.
Second, after understanding exactly what it is that the gameserver is doing, it may be better to take a different approach. Instead of comparing the position of a being on the server and the client and synching it (as it's virtually impossible to do that realtime unless we're running the gameserver and client on the same computer and even then there's some lag), we could instead approach it by having the gameserver determine if a move from a client was within a reasonable range (e.g., if there was a 10 second gap between the last known position of the client and a client can take say, 2 steps per second, then it should not be any farther than 20 steps in any direction). If the move was within a reasonable range, leave it be, take a note of the current position and assume that there are no problems. If it's not within a reasonable range, attempt to synchronize. If it is regularly unreasonable, flag the behavior as possible cheating.
Rotonen wrote:Also AFAIK it has been our policy from the beginning to only produce quality code.
Please don't take this the wrong way because I do not claim to be an expert nor the most l337 programmer in the world nor do I look down upon anybody and their work, but, there are a number of cases in the throughout the code where policy does not dictate reality.
The global variables are a screaming example of what I (and thousands of others) would consider to be a classic case of bad/amature programming practices and poor design. In a well designed system, global variables are non existant. Especially since TMW's code is in C++, everything should be encapsulated within classes and data should be passed from module to module rather than defining global variables. This, of course, is my own humble opinion and it is a standard that I use in any project that I've ever worked on.
Additionally, there is a serious lack of proper commenting througout the code so trying to figure out what some of the more complex blocks of code does/means is no trivial task for an outsider trying to understand it. This also makes it very difficult to maintain code and has the side-effect of making it difficult to track down bugs -- if a programmer makes an assumption about the data they are expecting in a line of code, that needs to be documented. Large blocks of code really should be properlly commented so that it can be understood by others.
---
I really don't want it to sound like I'm coming in with a big head not having a clue what I'm talking about and throwing crap in everybody's face. That is not what I'm trying to do. I'm just trying to point why problems like the desynching may be occuring. I'm not an official TMW developer and so I don't know what discussions you all have so I have no idea what page you guys are on or if anybody even agrees with a single word I'm saying. I'm not a pompous ass and I don't want to cause controversy -- ultimately, I want to help and I want to contribute as much as I can. Perhaps I should just shut up and sit down, shut up and silently continue with my own life -- if this is the case, please tell me. I don't know... Am I even making any sense?