Refactoring the 317 client

The current source code can be found here: https://github.com/rixftw/client

A few days ago I started to refactor the 317 client, something which should have been done by now. This is primarily for myself to get a better understanding of how the RuneScape client works in general. I’ll look into the newer-engine clients eventually. Unfortunately, I can’t do it myself without having slow progress.

Instead of beating around the bush, I simply need your help (in whatever way). I’m not asking anyone to refactor the whole client for me. If you will, share tips or hints about what a certain method does, etc. At the same time, I’ll share my findings (be it interesting or otherwise) for others.

p/s: Mind the naming conventions.

I’d like to thank a few people for (indirectly) contributing to the project. There are probably others whose names I don’t remember.

[ul][li]c`p - made a very informative post about certain classes and gave me an old copy of his refactored client[/li]
[li]super_ - has numerous code snippets lying around which I made use of[/li]
[li]Jacmob - gave me a better name for “CullingCluster”, it is actually a clipping box used in the ray-box intersection algorithm[/li]
[li]Metho D - his refactored 578 client is a good reference[/li][/ul]

tl;dr The goal is to have a fully refactored and documented client, will you help?

gl with sounds

I wont help, but this is pretty neat.
I support you, thanks for doing this.

And please don’t quit. :confused:

Mind the naming conventions in a refactor… XD

So what have you done to it besides what was already there from c`p’s? I cba looking through the entire thing

I think it would be better if you refactored a newer client revision so that the community can better move forward.

But nonetheless, its a good project no matter which revision.
GL

Hopefully I can speak with Metho D about it. By now, I’m sure he would be a great resource!
Edit: I just spoke to him.
<&Method> it’s way over my head unless there’s some great resource out there

The client was based off moparisthebest’s deob. I am merely using c`p’s as a reference. I’ve renamed (probably inaccurately) quite a few classes.

[ul][li]Animable -> SceneModel[/li]
[li]Class47 -> ClippingBox[/li]
[li]Decompressor -> ResourceCaches[/li]
[li]MRUNodes -> Cache[/li]
[li]NodeCache -> Hashtable[/li]
[li]NodeList -> Deque[/li]
[li]NodeSub -> CacheableNode[/li]
[li]NodeSubList -> Queue[/li]
[li]OnDemandData -> Resource[/li]
[li]OnDemandFetcher -> ResourceProvider[/li]
[li]OnDemandFetcherParent -> ModelProvider[/li][/ul]

There are (fortunately :P) many more which I’ll add as comments.

[quote=“boomer216, post:5, topic:409054”]I think it would be better if you refactored a newer client revision so that the community can better move forward.

But nonetheless, its a good project no matter which revision.
GL[/quote]
Yes, it would but it’s going to take a longer time if I do so. Majority of the newer deobfuscated clients released, put bluntly, suck (unless I’ve not been really looking around). This client, once fully refactored, will make it easier for the newer ones. Time to get working on some bytecode patterns, eh?

p/s: I don’t plan on quitting this project.

[quote=“Rix_, post:6, topic:409054”][quote author=Davidi2 link=topic=510338.msg3703761#msg3703761 date=1312911809]
So what have you done to it besides what was already there from cp's? I cba looking through the entire thing [/quote] The client was based off moparisthebest's deob. I am [i]merely[/i] using cp’s as a reference.[/quote]Oh gotcha, didn’t understand the OP.

Anywho, I agree with Boomer. People already customize enough stuff in 317’s, we need more higher revisions :smiley: (Plus it changed so much from 317, I disagree that refactoring the 317 will help that much)

Meh, I am actually working on this for myself as a stepping stone to the higher-revision clients. It will be released once it’s completed, so I guess this is worthwhile for the community and I. Talk about killing two birds with one stone! :rolleyes:

Refactoring the newer clients, on the other hand, is honestly a “moparisthebest-esque” work. I wouldn’t try embarking on such a project.

I didn’t really have time to look at all the names and compare them, but which deob did you base this on exactly? The latest 317 thing I did was this:
http://www.moparisthebest.com/downloads/srcPackaged.tar.gz

Which was based on a combo Aryan’s and PD’s renaming after Aryan died, which was the most complete renaming of the 3XX versions that I’ve ever seen.

So I’m thinking you didn’t base it off mine, since I see you don’t have any packages at all, not even signlink (which was original).

http://www.moparisthebest.com/downloads/srcAllDummysRemoved.tar.gz

I just moved the signlink class out from its package. It can actually be found here (https://github.com/rixftw/client/blob/master/src/rs/SignLink.java). I’m basically packaging everything in the rs namespace at the moment.

Edit: Now for some weird reason, the client isn’t compatible with the cache. It worked the day before, though. :confused: I found one. Thanks mdog311!

That was one step before packaging I think, plus I probably made some other improvements (guess you could look/diff), so if you haven’t done much, I’d probably start with the one I linked to if I were you.

I haven’t looked into this project much, but here’s a few things I noticed from a quick look at the GitHub page:

[ul][li]CollisionMap isn’t actually a collision map. I think you’re looking for Class11 instead. The class you currently have named CollisionMap serves a different purpose (namely managing the objects in the local region and scene, though I haven’t looked in detail into its functionality).[/li]
[li]Chat probably should have a name that reflects its use for encoding and decoding chat messages.[/li]
[li]Class36 contains animation frame data, and Class18 contains information about the transformations and affected groups for a particular frame.[/li]
[li]Class4 has utility methods for determining tile offsets for map chunks and objects within those chunks.[/li]
[li]Class43 and Class40 represent the two distinct tile types. The former is a simple square tile while the latter can take on a number of shapes.[/li][/ul]

If you have any questions, you’re welcome to ask me for help.

As I recall I was apart of a refactoring being it got trashed into something else.

Oh Yeah Here: http://code.google.com/p/rename317/source/browse/#svn%2Ftrunk%2Fsrc%2Frs2

ResourceCaches -> ResourceCache
Bzip2Entry -> Decompressor.State
Bzip2Util -> Decompressor
ClippingBox -> BoundingBox
PaletteImage -> IndexedSprite (? http://en.wikipedia.org/wiki/Indexed_color)

I tend to name things by usage, not implementation.

You may also want to avoid ugly names like “get_model()”, where “model()” is just as good :slight_smile:
What arrays you named “cache” aren’t really always caches in every class… sure, they may be in ItemDefinition, but in classes where the array is indexed by a resource ID, e.g. Graphic.cache, isn’t it a bit cleaner to name it Graphic.GRAPHICS?
ClientStream represents a connection to a Jagex server, with support for write buffering.
CanvasScreen is something like a graphics buffer, an off-screen page… I could’ve sworn I once named it MemoryImage, but in my last refactor I called it ScreenBuffer.
GameShell represents a generic Jagex game… the -Shell part seems a bit redundant. I’ll get around to posting one of my more complete refactors in the near future.
EntityDefinition is NPC-specific.

P.S. “rotate_90deg” is a lot cleaner as “turn” :wink:
P.P.S. What Metho D refers to when he speaks about the “shaped” tile is one that is one built from a mesh of smaller triangles, as opposed to the typical square one.

EDIT: In all truth it might be better to skip using moparisthebest’s refactor altogether and avoid the headache of dealing with those wretched names… :slight_smile:

mysterious person

@Metho D: Thanks for posting. :slight_smile: Now that I read your post for the umpteenth time, I’ve finally made local changes. I’ve renamed CollisionMap back to its original name, WorldController. Do you think that ChatMessageCodec is a more apt (verbose, too) name for Chat? I looked at the source of Hyperion and those two methods are in org.hyperion.rs2.util.TextUtils. I’ll look into classes 4, 36, 40 and 43 later on.

@slavemaster: It’s been ResourceCache for a few days before you posted, pushing it to the repository probably slipped out of my mind. :stuck_out_tongue: Good post altogether, but I don’t have the time to reply (not that it’s important to do so… :|).

ChatUtils? ChatCodec? The possibilities are endless! :smiley:
WorldController manages the game world scene, so maybe World or Scene is more apt? The class that you see in an array of 4 used by ::noclip is the collision map, btw.

I just updated the repository. There are only 4 unnamed classes, the project is really looking good! :smiley:

[quote=“slavemaster, post:14, topic:409054”]ResourceCaches -> ResourceCache
Bzip2Entry -> Decompressor.State
Bzip2Util -> Decompressor
ClippingBox -> BoundingBox
PaletteImage -> IndexedSprite (? http://en.wikipedia.org/wiki/Indexed_color)

I tend to name things by usage, not implementation.

You may also want to avoid ugly names like “get_model()”, where “model()” is just as good :slight_smile:
What arrays you named “cache” aren’t really always caches in every class… sure, they may be in ItemDefinition, but in classes where the array is indexed by a resource ID, e.g. Graphic.cache, isn’t it a bit cleaner to name it Graphic.GRAPHICS?
ClientStream represents a connection to a Jagex server, with support for write buffering.
CanvasScreen is something like a graphics buffer, an off-screen page… I could’ve sworn I once named it MemoryImage, but in my last refactor I called it ScreenBuffer.
GameShell represents a generic Jagex game… the -Shell part seems a bit redundant. I’ll get around to posting one of my more complete refactors in the near future.
EntityDefinition is NPC-specific.

P.S. “rotate_90deg” is a lot cleaner as “turn” :wink:
P.P.S. What Metho D refers to when he speaks about the “shaped” tile is one that is one built from a mesh of smaller triangles, as opposed to the typical square one.

EDIT: In all truth it might be better to skip using moparisthebest’s refactor altogether and avoid the headache of dealing with those wretched names… :)[/quote]

GameShell came from the 1998 version of Vertigo ^ and I collected from the internet archive. The classes were simply renamed, and not obfuscated at all. They had their source file attributes, one of which was GameShell.java. That class has not changed much over the decade.

@Rix_: As for c|p’s refactor, I don’t know how much farther he got from me. I know he was using my 194 client as a part reference when refactoring the 317; I don’t know how much help it was. I do still have my project lying around. It’s probably crude, seeing as I haven’t worked on it in something like 20 months. I could upload it though, if you’d like.

I know Jagex internally used the name GameShell, I just don’t like it :stuck_out_tongue:
Similarly I prefer Model and World to object3d and world3d or whatever.