Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

**Tutorial** Low-tech ALE cloning

Here you find the different tutorials on editing and MODing Freelancer

Dev

Post Fri Jun 22, 2007 2:42 pm

**Tutorial** Low-tech ALE cloning

Since somebody just posted a tutorial on recoloring .ale effects, I figured I might as well post my findings on duplicating .ales as well. Just a disclaimer up front, I've only ever tried it with one effect, gf_br_smallengine01_fire.ale, but I would be very surprised if the same procedure didn't work with any other .ale.

So, let's take a look at gf_br_smallengine01_fire.ale with a hex editor (I'm using xvi32 here). Look through it and find the name of the effect:


To be safe, let's change the name to something with the same length as before:


Now for the first trick. Open up data/fx/engines/engines_ale.ini. Go find the previous engine effect and copy it (gf_br_smallengine01_fire in this case). This is mostly to make sure you get the right textures; you'll be changing everything else anyway. Change the nickname to what you want, change the alchemy line to your new file, and most importantly change the effect_crc to the CRC of your new effect's name (alternate_engine001_fire in this example). If you don't know what the heck I'm talking about, this is a utility for calculating the CRC32 used by models and ALE effects: CRCCalc. However, the problem here is that effect_crc expects a signed integer, and CRCCalc will give you an unsigned integer. If you don't know what that means... when you've got 32 bits to store an integer value, you can hold exactly 2^32 distinct values (about four billion). The question is, do you want your range of values to cover only positive values or some split of positive and negative values? In this fashion, the same sequence of bits can mean two different integer values, depending on if you interpret it as a signed or unsigned integer.

Ok, now that the basics are covered, how does one go about converting an unsigned integer into a signed integer? Well, if you'll notice, CRCCalc will give you the hexadecimal representation of the number as well. Simply hijack that and drop it into xvi32 and then ask it to interpret what you gave it as a signed integer. Just be sure to put the bytes in backwards order. Easier shown than explained (this is just an example to illustrate the process):

Get the CRC:


Insert the CRC in xvi32 and get its signed value:


Ok, so now you've got the signed CRC value. Let's get back to engines_ale.ini and put it in. The CRC for alternate_engine001_fire happens to be 0x13625306, which equals 325210886 as a signed integer.

[VisEffect
nickname = alternate_engine001_fire
alchemy = fx\engines\alternate_engine001_fire.ale
effect_crc = 325210886
textures = fx\planetflare.txm


But that's not enough. Recall that Freelancer internally keeps track of everything by name (or rather, by CRC of name), so if two things of the same type also have the same name, it will get confused and believe that only one of those things exists; all instances of the second will end up looking like the first. ALE effects are no exception. Fortunately, getting around this is pretty easy.

First off, find the .app part of the .ale. There may be several, though for gf_br_smallengine01_fire there's just one. Take the CRC of this; you will be using it later.


In this case, the CRC equals 0x1CE7F0D9. This CRC will exist somewhere else in the .ale file, so let's go find it. Do a search for it (be sure to put the bytes in reverse order) starting from the beginning. Odds are very, very low that you will encounter more than one instance of that particular value, so you can just assume that you've found it.


In this case, the value is sitting at address 0x17C. Now, let's change the .app name so that Freelancer can tell this effect apart from gf_br_smallengine01.app. Again, to be safe I made the length of the name equal the length of the original name.


Finally, take the CRC of this new .app name (it's 0x1EBBA843). If you haven't guessed already, we need to change the value at 0x17C to this new CRC. Do so now.



And whoosh, now you can toy with this new .ale as much as you want without affecting gf_br_smallengine01_fire. It's kind of an ugly process but honestly doesn't take that long once you get used to it.

Edited by - Dev on 6/22/2007 3:45:45 PM

Post Fri Jun 22, 2007 2:54 pm

... I just copied and pasted the ALE file, renamed it, and used the same CRC. Both effects work. Seems a whole lot simpler, no?

MK

PS: Since when have I become just 'somebody?'

Edited by - mknote on 6/22/2007 3:58:04 PM

Post Fri Jun 22, 2007 4:57 pm

I was always sitting there wondering what should I do to make the CRC a valid one... I was trying to make sure CRCs I generated were the same as the ones I saw in the files. Never got them to actually match... Thanks for the tutorial Dev, this will be VERY handy!

Post Fri Jun 22, 2007 5:47 pm

wow, ale development WOOOOOO new engines ftw?

Requiem: A Freelancer Total Conversion MOD

Openlancer Project

Dev

Post Fri Jun 22, 2007 6:14 pm

"I just copied and pasted the ALE file, renamed it, and used the same CRC. Both effects work. Seems a whole lot simpler, no?"


Can you see them both at the same time, though? It's been my repeated experience that if you don't properly clone the ALE, you'll only see one of the effects when both are being used near you; the other effect will just look like the first one.

Post Sat Jun 23, 2007 7:02 am

GAH! You're right. I shall change this, of course...

MK

Post Sat Jun 23, 2007 1:44 pm

( insert foot A into Mouth slot B ) lol

Edited by - Cold_Void on 6/23/2007 2:44:45 PM

Dev

Post Mon Jun 25, 2007 3:37 pm

Well, THIS was an interesting find. It would seem that the CRC generation used with .ale files does NOT convert all letters to lowercase first (it's supposed to). As such, be sure to avoid using uppercase letters in the effect name and .app name.

Post Tue Jun 26, 2007 5:38 pm

Success! Dev, I can tell you that your method works, at least on weapon and jump hole effects. While the effects I duplicated for my purple Hispania weapons (the unused orange Kusari weapons) are unused in my mod, the effects can be used in another mod that uses both my custom effects and the Kusari ones. I've tested them, and both show up side by side now. Thanks for pointing out my error; I hate those creeping into my works.

MK

*edit*

I should also point out that I did have trouble when I renamed gf_jumphole_green_01.app to gf_jumphole_blue_01.app (the point being that changing the length of the effect name inside the .ale causes problems).

Edited by - mknote on 6/26/2007 6:41:54 PM

Post Wed Jun 27, 2007 7:29 am

hm, doing my testing ive changed for example:
gf_li_cruiser_maingun.app to test_maingun.app
gf_li_cruiser_maingun_rings.app to test_maingun_rings.app
and it all worked fine.
i was overwriting from the first letter "g" and replaced the "too long letters" with zeros.
just telling from my experience..

Post Wed Jun 27, 2007 7:34 am

that would be why i think 00 could symbolise a space?

Requiem: A Freelancer Total Conversion MOD

Openlancer Project

Dev

Post Wed Jun 27, 2007 1:06 pm

0x00 is the null character, used to indicate the end of a string of characters (don't use that to pad your strings... bad plan). Rimshot means that he pads the end of the new name with zeros (as do I, incidentally) so that it is the same length as the old name. For example, let's say I want to use the name omg_haxx_engine and the original name is gf_br_smallengine01_fire. Well, I'm short nine characters, so I stick nine zeros onto the end of would use the name I want, giving omg_haxx_engine000000000.

Post Wed Jun 27, 2007 1:33 pm

Post Sun Jul 01, 2007 9:22 am

Q for Devast8r and mknote: have you had any luck, or attempted, to change the texture references? I recall Argh said he had tried it, and it was not possible by simply changing a string. anyways, i think that -that- would be a very big breakthrough that would complement cloning nicely; color s and size adjustments are also tre'cool but half the problem with the FX is that they use a -very- small library of textures. i've just started working on a hi-def set of TXMs to replace the old ones (omg the original 'shine' texture for headlights is horrible lolz) but as long as adding new ones and actually using them is not possible the effects won't get much more dazzling

NVM, cancel that - tried it, seems my recollection is incomplete, as it worked quite nicely; simply replace the string and redirect the .txm reference to your new texture library

Edited by - Cold_Void on 7/4/2007 5:59:07 PM

Post Fri Jul 13, 2007 3:18 pm

bump - could someone refresh my memory, what number are CRC's 'signed' with and what is the exact math operation?

Return to Freelancer Editing Tutorial Forum