Level and Replay files

General discussion about the games and the scene.

Moderator: Moporators

Post Reply
User avatar
The_BoneLESS
38mins club
Posts: 4604
Joined: 7 Sep 2003, 00:30
Team: HHIT
Location: Dangerously close to the St-Lawrence River
Contact:

Level and Replay files

Post by The_BoneLESS »

After looking at Mila, Viper and Skint's code that Skint uses on his website to read informations from a replay file, i started to look closer at those files. I first tried to modify the name of the level, which i did. After, i succeeded to switch a mask from big to horizontal. But those are extremely simple to do.

What i would like to know is :

- Would it be possible ( sure it is ) to create a level, directly by coding it ?
- What the hell is all that so called by milagros junk ?

Sample from the getRecInfo() function programmed by mila, viper and skint
Image

I would like someone, like mila who seems to have a good knowledge of the files, to explain that to me. Because, i would love to make an elma related program.
Website || TT:38:05:33 || WC5:15th || HHIT for life || 9th world wide ... BAP is next
User avatar
jaytea
37mins club
Posts: 1015
Joined: 22 May 2004, 08:45

Post by jaytea »

i dont understand how those fread() functions work exactly, but wouldnt fread($f,1) read the same information over and over? since the variable in the function ($f) doesnt change. i wouldve thought they'd use $i somewhere in the loop code, like fread($f,$i)

but if it does in fact work, judging by the comment on the first line, it probably reads the first 12 bytes of the file. then again..opening a rec file in notepad shows the first 12 chars are useless, the corresponding level name is at a different position. maybe the time of the rec is encoded in the first 12 chars? who knows
User avatar
zworqy
Kuski
Posts: 3706
Joined: 19 May 2002, 23:17
Location: Lilla Edet, Sweden
Contact:

Post by zworqy »

Most reading functions in most languages automatically increments after reading.
<Fihlvein> another case of zworqy-is-always-right closed i guess
<yoosef> zworqy doesnt suck at anything
User avatar
Abula
Moposite admin
Posts: 4471
Joined: 16 May 2002, 23:00
Team: FM
Location: Helsinki
Contact:

Post by Abula »

40:02,71 (151.) | WCup4: 8. | 3x WR | 3x GAA | 11x FEM | KOM | The History of Elasto Mania (1995-2018)
User avatar
skint0r
39mins club
Posts: 768
Joined: 16 Jun 2002, 07:36
Location: Oslo, Norway

Post by skint0r »

You can see the whole code here: http://www.skintatious.net/src/getRecInfo.phps

Actually now that I look at it, I'm not sure what the point is of looping through those 12 bytes instead of just doing fread($f,12). I have no idea what those bytes are either way though.
- Would it be possible ( sure it is ) to create a level, directly by coding it ?
Obviously. I don't think ALE uses magic after all. You could check out these guides by ribot http://elma.not-dot-anything.net/index.php?page=hacking

And to answer your question in skintatious topic ($time * 62500 / 273), Balasz uses some big magic number or something. milagros gave me the code for the proper calculations a while ago, but neither vk or myself could figure out how to use it in PHP.

Code: Select all

double con;
((long *)&con)[1]=0x406c9e01;
((long *)&con)[0]=0xe01e01e1;
i=time*con
Prestigious member of 14.6x Tutor14 club
User avatar
milagros
Cheatless
Posts: 4560
Joined: 19 May 2002, 17:05

Post by milagros »

Actually now that I look at it, I'm not sure what the point is of looping through those 12 bytes instead of just doing fread($f,12). I have no idea what those bytes are either way though.
no point in reading 12 bytes one-by-one, I had it in my c++code because saved 11bytes of memory(not really)
I really don't remember what were those 12 bytes, some of them were magic numebr and some of them some info about lev
Would it be possible ( sure it is ) to create a level, directly by coding it ?
sure (check ribot's levs) and rec too (check my slesk recs)

Code: Select all

double con;
((long *)&con)[1]=0x406c9e01;
((long *)&con)[0]=0xe01e01e1;
i=time*con
I simply copied bytes of the double number that elma uses to count time, then those 0.0000000001 differences won't occure and the time should be right
who cares anyway
[carebox]
User avatar
The_BoneLESS
38mins club
Posts: 4604
Joined: 7 Sep 2003, 00:30
Team: HHIT
Location: Dangerously close to the St-Lawrence River
Contact:

Post by The_BoneLESS »

Some other question on an elma file...

With what program can i open the .dat file ? How the hell do you do that?
Website || TT:38:05:33 || WC5:15th || HHIT for life || 9th world wide ... BAP is next
User avatar
Xiphias
39mins club
Posts: 4101
Joined: 23 Nov 2004, 23:05

Post by Xiphias »

hex
Thorze wrote:I just wanted to make a cool topic like Juish have cool topics..
User avatar
goofu
Kuski
Posts: 338
Joined: 10 Apr 2006, 11:52
Location: #YOLO

Post by goofu »

The_BoneLESS wrote:Some other question on an elma file...

With what program can i open the .dat file ? How the hell do you do that?
max ez

get teh textpad @ http://download.textpad.com/download/v47/txpeng473.exe
TT: 45:43:64
User avatar
Coco
Kuski
Posts: 205
Joined: 20 Jun 2005, 14:41
Location: Bretagne
Contact:

Post by Coco »

I actually try to read a replay file... hum : quite difficult to understand everything ! If someone could help me :/

I only know parts of state.dat and file.lev structures...
If I can help you, post a PM.
User avatar
berhabdul
Banned
Posts: 1125
Joined: 18 Jul 2005, 17:09
Location: Warsaw, Poland
Contact:

Post by berhabdul »

Maybe this: http://elma.not-dot-anything.net/index. ... rt=recedit
will help to understand what are those bytes in rec file for
User avatar
Coco
Kuski
Posts: 205
Joined: 20 Jun 2005, 14:41
Location: Bretagne
Contact:

Post by Coco »

thanks for help berhabdul, very usefull :D
User avatar
berhabdul
Banned
Posts: 1125
Joined: 18 Jul 2005, 17:09
Location: Warsaw, Poland
Contact:

Post by berhabdul »

no problem, if any further help needed - ask, maybe just i know the answer
Post Reply