{{page>utils:top_links}} ====== Web APIs ====== {{page>Utils:main_tabs}} ===== Map Browser ===== Creeper World 1 and 2 do not have an easily readable map browser API and can only be accessed here: * Creeper World 1: https://knucklecracker.com/creeperworld/viewmaps.php * Creeper World 2: https://knucklecracker.com/creeperworld2/viewmaps.php Creeper World 3, 4 and Particle Fleet map browser API can be fetched from these URLs: * Creeper World 3: https://knucklecracker.com/creeperworld3/queryMaps.php?query=maplist * Particle Fleet: https://knucklecracker.com/particlefleet/queryMaps.php?query=maplist * Creeper World 4: https://knucklecracker.com/creeperworld4/queryMaps.php?query=maplist The data is gzipped, in XML format. Each map record contains the following information: ==== Shared values ==== * ''g'' - ''string'' - Map GUID. * ''i'' - ''int'' - Map ID. * ''a'' - ''string'' - Map author name. * ''l'' - ''string'' - Map title. * ''w'' - ''int'' - Map width. * ''h'' - ''int'' - Map height. * ''t'' - ''int'' - Map upload UNIX timestamp, divided by 1000. * ''p'' - ''int'' - Forum thread ID (can be used to build URL). * ''u'' - ''int'' - Thumbnail image size (length). ==== CW4 values ==== * ''b'' - ''int'' - Current map thumbs count. * ''s'' - ''string'' - Current map tags, delimited by commas. * ''o'' - ''int'' - Map objectives. Base 10 representation of available objectives in binary format. See [[web_apis#parsing_the_cw4_objectives_value|Parsing the CW4 objectives value]] for more details. * ''v'' - ''int'' - Version number. Determines from which game version the map was uploaded. Presumably this is only incremented if an update with significant 4RPL additions is made, so older versions of the game cannot attempt to play them. Version 1.0 of the game did not have this system and will be able to play any map though. * ''z'' - ''string'' - Discord forum thread ID for the specified map, on the Knuckle Cracker Discord server. ==== CW3 and PF values ==== * ''e'' - ''string'' - Map description. * ''s'' - ''int'' - Total current amount of scores posted. * ''r'' - ''float'' - Current map rating. * ''n'' - ''int'' - Total current amount of map ratings posted. * ''o'' - ''int'' - Total current amount of map downloads. ===== Score Query ===== Creeper World 1 does not have an easily readable score query API and scores can only be accessed through here: * Creeper World 1: https://knucklecracker.com/creeperworld/viewscores.php Creeper World 2, 3, 4 and Particle Fleet score query API can be accessed through following examples: * Creeper World 2: https://knucklecracker.com/creeperworld2/scoreQuery.php?customID=1&userfilter=&groupfilter= * Creeper World 3: https://knucklecracker.com/creeperworld3/scoreQuery.php?customID=1&userfilter=&groupfilter= * Particle Fleet: https://knucklecracker.com/particlefleet/scoreQuery.php?customID=1&userfilter=&groupfilter= * Creeper World 4: https://knucklecracker.com/creeperworld4/playLogQuery.php?customID=1&userfilter=&groupfilter= Below is a list of available parameters to the score query APIs: * ''userfilter'' - Filter by user name. Leave empty for no user filter. In Particle Fleet, filtering by user name still shows all scores, but highlights * ''groupfilter'' - Filter by group name. Leave empty for no group filter. * ''timefilter'' * CW3: 0, 1 or 2. 0 - All Time. 1 - 3 days. 2 - 1 week. * PF: 0 or 1. 0 - All. 1 - Month. * ''sort'' - "score" or "time". Applicable to games that have a score. Sort by either best score or best time. The following arguments are exclusive, i.e. only use one of these at a time, as applicable: * ''customID'' - Custom map ID. Needed to query non-DMD custom maps. * ''gameUID'' - GUID of the map. Needed to query non-custom maps. * ''dmdID'' - CW3 only. DMD map ID. Needed to query DMD maps. ==== CW4 Chronom GUID ==== To query scores for Chronom maps, you must know what to supply to the ''gameUID'' parameter. The value must look like follows: ''CHRONOM MAR 21, 2021'', and then be encoded to base64. Example JavaScript code for building a ''gameUID'' value for querying Chronom maps: let months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]; let date = new Date(); let str = `CHRONOM ${months[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`; let gameUID = Buffer.from(str).toString('base64'); ==== CW2 Code map GUID ==== To query scores for Code maps, you must know what to supply to the ''gameUID'' parameter. The final string is based on the map's seed name, size and complexity. Example JavaScript code for building a ''gameUID'' value for querying Code maps: let name = 'think then after'; let size = 1; //0, 1, 2 let complexity = 2; //0, 1, 2 let hash = crypto.createHash('md5').update(name.toLowerCase().trim()).digest("hex"); let hnum = parseInt(hash.substring(0,8), 16); let gameUID = "procedural" + hnum + "-" + size + complexity; ==== Campaign Mission GUIDs ==== To run score queries on campaign maps, you must know what to supply to the ''gameUID'' parameter. Below are long lists of campaign map GUIDs that can be supplied. === CW4: Farsite Expedition === 09 Leo, 266 c3Rvcnkw Farsite c3Rvcnkx Home c3Rvcnky Not My Mars c3Rvcnkz Ruins Repurposed c3Rvcnk0 We Know Nothing c3Rvcnk1 We Were Never Alone c3Rvcnk2 Hints c3Rvcnk3 Serious c3Rvcnk4 More and More c3Rvcnk5 War and Peace c3RvcnkxMA%3d%3d Shattered c3RvcnkxMQ%3d%3d Archon c3RvcnkxMg%3d%3d The Experiment c3RvcnkxMw%3d%3d Somewhere in Spacetime c3RvcnkxNA%3d%3d Tower of Darkness c3RvcnkxNQ%3d%3d The Compound c3RvcnkxNg%3d%3d Sequence c3RvcnkxNw%3d%3d Wallis c3RvcnkxOA%3d%3d Founders c3RvcnkxOQ%3d%3d Ever After c3RvcnkyMA%3d%3d === CW4: Span Experiments === Special a251Y3JhY2tlcjEy The Dark Side a251Y3JhY2tlcjE3 Turtle a251Y3JhY2tlcjU%3d Cheap Construction a251Y3JhY2tlcjg%3d Four Pieces a251Y3JhY2tlcjI%3d Highway to helheim a251Y3JhY2tlcjEz Holdem 2 a251Y3JhY2tlcmJvbnVzMQ%3d%3d Neuron a251Y3JhY2tlcjM%3d Valley of the Shadow of Death a251Y3JhY2tlcjY%3d Sector L a251Y3JhY2tlcjk%3d Far York Farm a251Y3JhY2tlcjE4 Invasion a251Y3JhY2tlcjIw Forgotten Fortress a251Y3JhY2tlcjE%3d Mark V Sample ZGVtb2JvbnVz Gort a251Y3JhY2tlcjEw Creeperpeace a251Y3JhY2tlcjE0 Creeper++ a251Y3JhY2tlcjQ%3d Before Time ZGVtb2JvbnVzMg%3d%3d Islands a251Y3JhY2tlcjE1 Razor a251Y3JhY2tlcmJvbnVzMA%3d%3d Day of Infamy ZGVtb2JvbnVzMw%3d%3d Parasite a251Y3JhY2tlcjc%3d Creepers Pieces a251Y3JhY2tlcjEx Enchanted Forest a251Y3JhY2tlcjE2 Chanson a251Y3JhY2tlcjE5 Shaka ZGVtb2JvbnVzNA%3d%3d === PF: Story === Naivety 1Story Indelible 2Story Unwise 3Story Insanity 4Story Evidence 5Story Stretch 6Story Brute 7Story Potential 8Story Emergent 9Story Ties 10Story Secrets 11Story Doppelgangers 12Story Intent 13Story The 145th 14Story Origin 15Story === PF: Inception === The Melt 1Inception Fountains of Betelgeuse 2Inception Daisy Chain 3Inception Industrial Complex 4Inception Square Land 5Inception CEO\'s Landing 6Inception Archipelago 7Inception The Nest 8Inception Warp Never Changes 9Inception === CW3: Arc Eternal === Inceptus : Tempus Tempus Inceptus : Carcere Carcere Abitus : Telos Telos Abitus : Far York Far+York Abitus : Starsync Starsync Navox : Jojo Jojo Navox : Ormos Ormos Navox : Seedet Seedet Navox : Flick Flick Navox : Tiplex Tiplex Egos : Lemal Lemal Egos : Ruine Ruine Egos : Defi Defi Egos : Choix Choix Egos : Chanson Chanson Frykt : Mistet Mistet Frykt : Crosslaw Crosslaw Frykt : Vapen Vapen Apex : Meso Meso Cliff : Krig Krig Andere : Otrav Otrav Andere : Farbor Farbor Cricket : Arca Arca === CW3: Credits === Adventure : Fortress of Ultimate Darkness credits === CW2: Story === Day 1: Novus Orsa s0 Day 2: Far York s1 Day 3: Taurus s2 Day 4: UC-1004 s3 Day 5: The Maxia Choice s4 Day 6: Chaos s5 Day 7: Lost s6 Day 8: Sliver s7 Day 9: Intelligence s8 Day 10: The Experiment s9 Day 11: The Cooker s10 Day 12: Answer s11 Day 13: Horror s12 Day 14: Phoenix s13 Day 15: Exterminate! s14 Day 16: Purpose s15 Day 17: Trickery s16 Day 18: The Tide s17 Day 19: Colony Prime s18 Day 20: All Things s19 === CW2: Bonus === Positronic b0 The Tree b1 Minion Surprise b2 Shields Up! b3 Stygian Depths b4 Odyssey b5 Barbarian Hordes b6 Assault b7 Cubic b8 Abyss b9 === CW2: Academy === Legacy z0 Basic Training z1 Mind and Muscle z2 Spelunking z3 Engineering z4 The Zoo z5 Pressure z6 Dimensions z7 Accident z8 Darkness Looms z9 === CW2: Credits === Credits credits ===== Misc Info ===== ==== Parsing the CW4 objectives value ==== The objectives value from CW4 map data is a binary number saved in base 10 format, therefore to find which objectives exist on a map, we must look at each individual bit. There are 6 bits in total, as there are only 6 objectives. Example JavaScript code for parsing the objectives value: let o = 7; let Custom = (o >> 5 & 1) != 0; //false let Collect = (o >> 4 & 1) != 0; //false let Hold = (o >> 3 & 1) != 0; //false let Reclaim = (o >> 2 & 1) != 0; //true let Totems = (o >> 1 & 1) != 0; //true let Nullify = (o >> 0 & 1) != 0; //true //Conclusion: Map has Nullify, Totems and Reclaim objectives