Thursday, October 29, 2009

Obfuscation and the like

Obfuscation: what is it? Simply put, it's a method used to make code difficult to read and work with. The basic idea is simple; the script parser doesn't care if a variable has a meaningful name (integer iHeroID) or a nonsensical one (integer ZYF), since semantically the code will execute the same regardless of nomenclature. It does, however, make it significantly more difficult for someone else to make changes to it (especially without accidentally breaking something!)

This is, unfortunately, the reason why AI development has been slow. I've been spending quite a bit of time slowly deobfuscating the script, but there are still many things that I still cannot quite account for. My current project is working out some of the "magic numbers" that appear in the script; numbers which just appear in the script but have no apparent rhyme or reason.

Fortunately, I only have to work out the obfuscated portions in the AI script; IceFrog has been provided me with script changes from version to version (i.e. what was added/changed/deleted in 6.64 from 6.63b) in unobfuscated form, so I can keep the map updated with those features rather easily and effectively. Unfortunately, I don't have access to a full deobfuscated map script (which would make starting a brand-new AI much easier) or a deobfuscated AI script (which would make things easier for the obvious reasons). Ah well. C'est la vie, as a good friend of mine would often say. =P

I'm thinking of posting some of these random numbers for you guys to possibly decipher. I know a lot of them refer to unit geographical locations (x,y coordinates of buildings and such) that have been changed since 6.48b and no longer cause things to work, but trying to figure out what used to be what is a bit tedious. =/

In short, obfuscation = the bane of my existence. At least, in terms of map development. =P

10 comments:

Vanishing said...

1st comment again...

-ยต- said...

I highly hope Cloud_str or RGB would contact you regarding the full deobfuscating of their AI script. They should hold the key. :)

But nonetheless, the rest of us are willing to help just like how the DotA community helps each other.

.Uwe said...

i agree with micro...if RGB could just tell you about his magic numbers... =/

David said...

@Vanishing, you're lame.

Mhm, obviously contacting the original authors seems like the best move. I think by now it's established that buffmeplz is a good AI author, so I'd hope they wouldn't be reluctant to reveal the original code.

If not, well, I'd guess some people would want to help. I'm just thinking of some of the guys in the playdota forums which were also trying to learn the AI script (I myself don't have the time unfortunately :-|).

Thanks for keeping this work up!

Phoenix said...

As David said, the people at Playdota forums in Advanced Mechanics and Programming Corner might be more useful. I can just add that 'e00E' (member at playdota forum) knows a lot of sh*t about DotA Codes.

Unknown said...

@Vanishing Yup you suck.I don't really know anything about programming and guys already posted answers i wanted to say...i hope you will break that code and make AI better player!

Unknown said...

I'd be happy to do what I can to help. Post some numbers and I'll see what I can do.

Unknown said...

@micro

lol, even if they do, the script is like 5 years old and it is obfuscated. So chances are,normal human beings would just say "WTF with this crap?!"

What I'm saying: they wont be any help unless they have the original code and hand it to BMP.

Unknown said...

@vash: Listen what you are saying, normal "human beings", what kinda description is that. Besides we are talking about a very specific very enthusiastic group here. If no one besides BMP can deobfuscate the scripts, that just means he should get all the more respect.

The way I see it, there will be parts where nobody knows it unless we do trial and error, and other parts will be slightly readable to die hard fans, especially for the partly deobfuscated scripts.

We need a sample or three, so this process can start. :D Prizes will be revealed later.

Greets,
ST

Bob said...

does anyone know how to avoid the mac/win compatibality issue? the map is practically unplayable.