crazy2be/buildblast — pull request #125 by yeerkkiller1 (2013-09-22 06:19:18+00:00)
Title: Entity refactor

I refactored a LOT of code, hopefully this will allow things to be much easier to code.

The main intent was making entities treated right, so making the player (now playerUI) just watch the entity, and making the entity store it's position history properly (instead of having the player store one).

To do this I moved a bunch of stuff around, I still want to refactor more stuff, but for now I think I should just submit this.

Also I added entityViews, in the future I will add playerViews also. This works really well, as our view logic is relatively complex, and this completely seperates it from the data (which is fairly simple, or at least well contained).

File Summary:
- Bloated the readme.
- Rewrote box.js, now it doesn't hook to a position which makes it easier to pass around.
- manager -> chunkManager, etc. I really really really want this.
First of all if I search for manager.js multiple hits come up, and I have to actually look at them. Second of all I have to always parse the file path to figure out what it means. Third it matches the name of the class it exposes.
- Made shared folder, this is for stuff which a lot of stuff uses, but doesn't depend on much. I like shared as it implies it needs to have no dependencies, or else those would have to be shared too.
- All of entity is changed, hence the branch name!
- I added beautiful debug stuff, which is controlled with localStorage.qDebug, this will give you a really nice bar above your player (use localStorage.thirdPerson to see it) and other's so you can SEE THEIR LAG.
- Position history works with HistoryBuffer (similar to server stuff, but uses binary searches), then ContextBuffer which adds the prediction capability, then MovementSimulation which adds the specific player related stuff, and deals with getting the right time out of clock.
- Refactored main and stuff directly under it, fairly straight forward stuff, feel free to comment a lot on this, as I am not convinced it is perfect as I pass around a lot of objects.

It's big, but doesn't have the amount of changes git thinks, it didn't get all the files I moved, or the files I split into 2.

I will turn it into a require format, but I think that is better done all at once.