Difference between revisions of "Technical"

From Elma Wiki
Jump to navigation Jump to search
Line 53: Line 53:
  
 
Map URL examples:<br />
 
Map URL examples:<br />
http://elmaonline.net/images/map/346023/ No parameters gives you a 330px by 330px max resolution picture.<br />
+
http://elmaonline.net/images/map/346023/ No parameters gives you a 330px max X-resolution picture.<br />
http://elmaonline.net/images/map/346023/1800/1800 To get 1800px by 1800px max resolution picture.<br />
+
http://elmaonline.net/images/map/346023/1800/ To get 1810px max X-resolution picture. '''X-resolution adds 10px'''<br />
Maximum resolution '''seems''' to be 7193px by 7193px. Not confirmed.
+
http://elmaonline.net/images/map/346023/0/1800/ To get 1832px max Y-resolution picture. '''Y-resolution adds 32px'''<br />
 +
If you add both restraints it will '''only''' use the highest axis for scaling and ignore the other axis' restraint.<br />
 +
The lowest resolution it will scale the axes to is 287 (297px actual) for the X-axis, and 287 (297px actual) for the Y-axis.<br />  
 +
Maximum resolution '''seems''' completely arbitrary and changes from level to level somehow. Some levels you can have in the 7000-7200px range, others stop at 5000 or so. Further information would be useful.
 +
 
  
 
{| class="wikitable"
 
{| class="wikitable"

Revision as of 23:46, 25 March 2016

Technical information for Elasto Mania files, available APIs and various development stuff.

Elasto Mania

Note: All Elasto Mania files are in little-endian format.

The type name will depend on what programming language you are working with, here's a short equivalency list between the most common ones as a reference:

Bytes C Python¹ Rust
1 char c u8/i8²
1 uchar B u8
2 short h i16
4 int i i32
4 uint I u32
4 float f f32
8 double d f64

¹ Using struct formatting [1]
² Depends on context. Assume that all chars in Elma files are ASCII and never expected to be signed, use u8. Probably?

Levels

8)

Language Examples

C/C++
wow test
Python

There is already a nice Elma Python library by sigvef that should cover most of your needs. If not, there's some nice code examples for how you can unpack/pack files if you look at the source code.

Rust
wow test

Replay files

APIs

Currently there are two online APIs available for public use.

Elma Online API 2.0

Official API for the Elma Online site. Use this API if you want to get best times for a certain level.

Battle API

Domovoy and b0ne's API that gives you current battle information in either XML or JSON format, and also calls to start levels.

Get battle information

URLs are http://elma.seamy.ru:8880/current_battle for XML, http://elma.seamy.ru:8880/current_battle?json=1 for JSON
There's currently no direct way to get level information like the map and non-battle times. You'll unfortunately need to fetch the battle URL by the ID field and parse the HTML data to get the level ID from there. Then either use the official EOL API to get best times, or construct the map URL from the level ID.

Map URL examples:
http://elmaonline.net/images/map/346023/ No parameters gives you a 330px max X-resolution picture.
http://elmaonline.net/images/map/346023/1800/ To get 1810px max X-resolution picture. X-resolution adds 10px
http://elmaonline.net/images/map/346023/0/1800/ To get 1832px max Y-resolution picture. Y-resolution adds 32px
If you add both restraints it will only use the highest axis for scaling and ignore the other axis' restraint.
The lowest resolution it will scale the axes to is 287 (297px actual) for the X-axis, and 287 (297px actual) for the Y-axis.
Maximum resolution seems completely arbitrary and changes from level to level somehow. Some levels you can have in the 7000-7200px range, others stop at 5000 or so. Further information would be useful.


Field Context
designer EOL Name of player. Example URL: http://elmaonline.net/players/DIvAn
file_name Level file name. As there can be multiple levels with the same name, use the id field instead if you want to fetch the level information.
start_delta Seconds elapsed from battle start. Given in negative values, so just add it to duration field to get time left.
battle_type Battle type:
0: Normal
1: One life
2: First finish
3: Slowness
4: Survivor
5: Last result
6: Finish count
7: 1 Hour TT
8: Flag tag
9: Apple
10: Speed
battle_attrs Bitmask for battle attributes:
1: See others
2: See times
4: Allow starter
8: Apple bug
16: No volt
32: No turn
64: One turn
128: No brake
256: No throttle
512: Always throttle
1024: Drunk
2048: No significance, ignore. No explanation, ask mila
4096: One-wheel
8192: Multiplayer
duration Total battle time in seconds. Use start_delta field to get remaining time.
id Battle ID. Example URL: http://elmaonline.net/battles/104896


http://elma.seamy.ru:8880/current_battle XML example result:
 
 <CurrentBattle>
   <designer>DIvAn</designer>
   <file_name>D339.lev</file_name>
   <start_delta>-175</start_delta>
   <battle_type>0</battle_type>
   <battle_attrs>2050</battle_attrs>
   <duration>420</duration>
   <id>104896</id>
 </CurrentBattle>
 

http://elma.seamy.ru:8880/current_battle?json=1 JSON example result:

 { 
   "designer":"DIvAn",
   "file_name":"D339.lev",
   "start_delta":-187,
   "battle_type":0,
   "battle_attrs":2050,
   "duration":420,
   "id":104896
 }
 
Start levels

Put stuff here.

Action SuperCross

Levels

Replay files