Thoughts about hex editing.

A private forum for those folks working on patches for RRT3.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Thoughts about hex editing. Unread post

I'm starting to think cunning. The problem with hex editing is that it's in hex, or more accurately in a hex rendition of floating point format. This is not human-friendly.

What would make .3dp editing far easier is if the editor could be persuaded to represent the hex in human-friendly format, meaning normal, everyday decimal notation. This should be possible, but will require some custom scripting which I don't currently know how to write.

The editor I have will allow various display options but doesn't include the one we really need. What's needed is an option to take a selected group of bytes, bundle them up four at a time (because each four bytes represents an X, Y or Z axis co-ordinate) then run that bundle through a base converter to get the decimal value, and display that on the screen. That way you'd end up with three columns of normal numbers instead of 12 columns of hex/floats. If we can find an editor that will let us do this we'd be in like Flynn. !*th_up*!

It's probably possible, since most things are. It's just a matter of finding out how to do it. I'm going to do a bit more sleuthing.
User avatar
Stoker
Engineer
Posts: 569
Joined: Mon Dec 08, 2008 12:18 pm
Location: Amongst the Sagauros

Re: Thoughts about hex editing. Unread post

I am amazed at what you are able to do by manually editing the Hex files. When I first saw your work and heard talk about the 3D file converter I assumed you were opening the .3dp files in a 3d modelling program to edit things. I am curious if you ever tried to actually do it this way? The original development team has posted here, and they said that 3D Studio Max was used to create all of the models. The only way I would consider modifying some of the buildings would be if I can indeed open them up in 3DS Max (or similar) to change things. Otherwise, I am afraid that only re-skins will be in this patch. You really can do a lot just by reskinning and alpha-ing out things from buildings, so it isn't as limited as it sounds. But still, I have to wonder if .3DS building models can be imported now? There are lots of completely free to use .3DS models of buildings available if this can be done.

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Thoughts about hex editing. Unread post

If they can be imported to and from a proper 3D CAD app of some sort that would be great, but from what I've read of the topics here nobody seems to have been able to get that sort of thing working. Rather than chase all over the web forever trying to find a way to do that, I figure I'll just get in there and make stuff.

Alpha channel tricks are useful for some things, and useless for others. If you only use alpha channel tricks you're severely limited in what you can do. I don't like being severely limited. I like seeing a target and heading straight for it. If you change the actual geometry, you can do anything.
User avatar
Stoker
Engineer
Posts: 569
Joined: Mon Dec 08, 2008 12:18 pm
Location: Amongst the Sagauros

Re: Thoughts about hex editing. Unread post

So, is it only possible to open up and look at .3dp files in 3d programs using the 3d converter? I thought it was possible to convert .3dp to .3ds and then re-convert them back into .3dp from .3DS or such, but this does not work?

P.S: my memory on the subject is a bit fuzzy, but I did find out a few years back that the .3dp files are in fact .3ds files with a special header on them in the Hex code.

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Thoughts about hex editing. Unread post

Oh sure, somebody somewhere did mention that somehow they got something to work, but didn't actually give usable information. Ergo, I concluded it was a dead end until someone came up with usable information.

This seems to have always been a common problem with RT3 modding: no &#%@%! reliable documentation. People half explain things but never bother to actually give information other people could use to replicate the result. If you want to kill modding, that's a really good way to do it.
Last edited by Gumboots on Fri Jan 31, 2014 12:18 am, edited 1 time in total.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Thoughts about hex editing. Unread post

Incidentally, the above is why I've been writing out stuff I've learned as I learned it. My aim is to make this stuff accessible, not to bamboozle and aggrevate people by leaving things half explained. It's about at the stage where I could start collating and rationalising the presentation so locomotive modelling is documented fairly clearly. Even basic stuff like "*** is a float?" should be covered in FAQ. People shouldn't have to figure it out for themselves. I had to. Nobody else should have to.
Last edited by Gumboots on Thu Jan 30, 2014 7:05 pm, edited 1 time in total.
User avatar
Stoker
Engineer
Posts: 569
Joined: Mon Dec 08, 2008 12:18 pm
Location: Amongst the Sagauros

Re: Thoughts about hex editing. Unread post

I just did a test and opened up a .3ds building in 3d object converter. Saved it as .3dp. Worked. I have not tried to import the object to RT3 yet, so I don't know if the game will actually do that (there could be a scaling issue or such with the architectural scale building model I did this with), BUT, from what I can see it should be possible to open .3dp's from the game, save them as .3ds , work on them with Blender or 3ds max, etc. save them as .3ds, open them in 3dOC and convert them back to .3dp. Am I missing something here?? . Is it possible it is actually this easy?

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Thoughts about hex editing. Unread post

RT3 .3dp is not the same .3dp that 3D Object Converter converts to and from. RT3 .3dp is a custom format, not the .3dp that is used by normal CAD apps so no, it is not that easy.

Try using the result in the game before suggesting it might be a workable option. If it doesn't run properly in the game, it's not a workable option. !*th_up*!
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Thoughts about hex editing. Unread post

User avatar
Stoker
Engineer
Posts: 569
Joined: Mon Dec 08, 2008 12:18 pm
Location: Amongst the Sagauros

Re: Thoughts about hex editing. Unread post

Well, that figures. They sure messed things up for modding with this game. I think I had better stick to the building coding for now, I will get into the graphics after that is all done. I can only mentally handle one insanely complex conundrum at a time these days.

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Thoughts about hex editing. Unread post

Yup. I know wotcha mean there. That's why although I'd like a pony for Christmas I'm just plodding along with the old burro. He may be slower, but I'll still get there. If someone figures out how to get free ponies for everyone, I'll grab one then.
Lama
Brakeman
Posts: 178
Joined: Fri Dec 01, 2006 11:06 pm
Location: Fresno, CA

Re: Thoughts about hex editing. Unread post

Gumboots wrote:Incidentally, the above is why I've been writing out stuff I've learned as I learned it. My aim is to make this stuff accessible, not to bamboozle and aggrevate people by leaving things half explained. It's about at the stage where I could start collating and rationalising the presentation so locomotive modelling is documented fairly clearly. Even basic stuff like "*** is a float?" should be covered in FAQ. People shouldn't have to figure it out for themselves. I had to. Nobody else should have to.
Kudos to you for that attitude. So many times people with expertise seem to fear that if they share it, others might surpass them. Your approach is more compatible with an academic or craftsman's ethos than the jealous guarding of secrets.
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Thoughts about hex editing. Unread post

If someone can surpass me in loco modelling that's good, because it means we get better trains. !*th_up*!

There was a lot of information that other people had obviously known at some point but had never written down. I don't ascribe this to malice of any sort. It's just that coders like to code cool stuff. They don't like having to spend all their time explaining how they coded cool stuff. IOW, coders tend to be crap at documentation. They also tend to be crap at explanations because they make a common mistake. They think that an explanation is something that makes sense to them. It isn't. An explanation is something that makes sense to your target audience. If what you have written makes no sense to your target audience, you haven't explained anything.

Writing it down as I figured it out makes sense. That way not only do other people get to use the info if they want to make something (which would mean more cool stuff for us to play with) but if I take a break from this stuff and then come back to it I wont have to figure it out all over again. I'll just have to read my notes.

Anyone who has written several thousand lines of code (in whatever format) has probably experienced getting it all working, going away and doing something else, then coming back six months later or whenever and having to work on that code again. Even though you wrote it yourself, if it's not documented far more than you thought necessary at the time you'll probably look at it and think "Which idiot coded this pile of festering vulture gizzards, and *** does it all do?" If it's that bad for stuff you wrote yourself, and it usually is, it's far worse for anyone who's never seen it before.
User avatar
sbaros
Conductor
Posts: 256
Joined: Sun Nov 15, 2020 1:59 pm
Location: Inside the 9th car

Re: Thoughts about hex editing. Unread post

So, putting it all together, 3D Object Converter, hex editing, documentation, I started this attempt here
https://rrtycoon.blogspot.com/2021/08/b ... table.html
to create some sort of tutorial projects. Although I uploaded it, I have not advertised it at all yet since I prefer to have some feedback first
If you have no Marxists in the leadership of your trade union, you have no trade union.
Abolish NATO and the (Na)zionist state !
User avatar
Gumboots
CEO
Posts: 4813
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Thoughts about hex editing. Unread post

3D Object Converter is not necessary, nor is it particularly useful. I would ignore it. I do not recommend Watto Game Extractor either. I found it more trouble than it was worth. IMO it is better to use Milo's PK4Unpack and PK4Pack command line tools.

Honestly, I think the easiest way to do the skinning of any file is with the Blender import/export script. It saves having to screw around with trial and error. You can make your own mesh, exactly where you want it, and skin it exactly how you want it skinned, with very little effort, and while able to see exactly what you are doing. IMHO methods that rely on loading and reloading the game, while you are flying blind on the mesh and skinning, are not at all optimal. Been there. Done that. Don't want to go back.
User avatar
sbaros
Conductor
Posts: 256
Joined: Sun Nov 15, 2020 1:59 pm
Location: Inside the 9th car

Re: Thoughts about hex editing. Unread post

I uploaded another piece here.
I'd like to know if my articles on these subjects are comprehensible and if there are any hard-to-understand points.
Post Reply