Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JSON format for maps #257

Merged
merged 5 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/stats/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func main() {
log.Fatal("Please specify a map file!")
}
file := os.Args[1]
if !strings.HasSuffix(file, ".asc") {
file += ".asc"
if !strings.HasSuffix(file, ".json") {
file += ".json"
}
mapStr, err := os.ReadFile(file)
if err != nil {
Expand Down
39 changes: 0 additions & 39 deletions data/maps/Coastline.asc

This file was deleted.

57 changes: 57 additions & 0 deletions data/maps/Coastline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"terrains": {
"+": 1,
"-": 50,
"^": 6,
"r": 2,
"t": 14,
"~": 20
},
"map": [
".................~.....~................",
"---------------tt~-^^^-~----------------",
"--T------------~~~-^T^t~t---------------",
"-^^---t-------t~t--^^-t~~t--------------",
"-T^-----------t~~-T^T--t~t-------t------",
"-^---------UU-tt~t^^-rrt~t--------------",
"-----------UU--t~t^--t~~~r------tt------",
"-----tt--------t~~ttt~~tt------tTTT-----",
"-----ttt------ttt~t~~~ttt-----tTTRt-----",
"----tt~~tt---t~~~~~~tttt------TTt-------",
"-----t~~tt--tt~rtttttt------------------",
"-----ttttt-tTt~~tTTTt-----TT------------",
"------tttt-TTTt~tTTT--t---TT------------",
"---^^-----TTTtt~tTT-------^-------------",
"--^T^----tTttt~~t--------^--------------",
"---^------^r~~~tt-t----TT---------ttt---",
"----------tr~ttt-------TT---------ttt---",
"----------r~~tt--------------------t----",
"----------t~ttt-t-----------------------",
"----------t~ttt-------------------------",
"----------t~~tt---h---------------------",
"---tTT----tt~tt-----------UU---ttt^^----",
"--tTTTT----t~~~t----------UU--ttttt^^---",
"--TTTt--tt--tt~t------t-------t~~~tt^---",
"--------tt---t~------tt--~~----~~~ttt---",
"---~~~~r--++-~~~--------r~~~r---tttt----",
"---~~~~~~~r--~~~~~~~~~--~~~~~~r---------",
"-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--~~~---",
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
],
"achievements": [
"landscape-architect",
"fisherman-guild"
],
"description": [
"A medium-sized (40x40) map with a coastline and a river. Plenty of all resources.",
"Available random tiles: 500."
],
"center": {
"X": 18,
"Y": 20
},
"initial_terrains": 500
}
44 changes: 0 additions & 44 deletions data/maps/Desert Valley.asc

This file was deleted.

61 changes: 61 additions & 0 deletions data/maps/Desert Valley.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"terrains": {
"+": 40,
"-": 15,
"^": 1,
"r": 3,
"t": 4,
"~": 4
},
"map": [
"....................++++++++++++.........",
"................+++++++UU+++++++++.......",
"..............++++++++UU+++++++++++......",
"............++++U++++++++++^--------.....",
"..........++++UU++++++++++---tt-------...",
".........+++++UU+++++++++----~~~~tt----..",
"........++U+++++++++++++^---t~tt~~~~~---.",
".......++UU++++++++++++^---t~~tttttt~t---",
"......+++++++++++++++++^---t~tt-----~~~~~",
".....+++++++++++++UU+++^---t~t-------t---",
"....++++U++++++++++U+++---~~~----++^^----",
"....+++UU++++++++++++++--t~tt--+++++++++-",
"...++++U++++++++++++++--t~~t--^+++UUU++++",
"..+++++++++++++++++++---t~tt--^+++UU+++++",
".++U+++++++++UU+++++^---t~tt--^+++U++++++",
".++++++++++++UU+++++t----~~~--+++++++++U+",
".++++++++++++++++++tt-----t~--+++++++++++",
".------++++++-------------t~--+++++++++++",
".---~~~-^+++--ttt--------t~~--+U+++++++++",
"~~~~~t~t----t~~~~ttt--h--t~t--+U+++++++++",
".-ttt-~t---tt~tt~~~~t----t~t-+++++++++++.",
".-----~~ttt~~~---tt~ttt--~~--+++++++++++.",
".------~~~~~tt-----~~~~~-~t-^++++++++U++.",
".++^^---tt----------ttt~~~--++++++++UU++.",
".++++^----+++++^-----------+++++++++UU+..",
"..++++++++++++++^^^^+++++++++++++++UU++..",
"...++U+++U++++++++++++++UU+++++++++++++..",
"....+++++UUU+++++++++++++U++++++++++++...",
".....+++++UUU+++++++++++++++++++++++++...",
"......+++++UU++++++UU++++++++++++U+++....",
".......++++++++++++++++++++++++++++++....",
"........++++++++++++++++++++++++++++.....",
".........++++++++++++++++++U+++++++......",
"...........++++UU++++++++++++++++........",
".............+++UU++++++++++++++.........",
"................+++++++++++++............",
"..................++++++++..............."
],
"achievements": [
"landscape-architect"
],
"description": [
"A medium-sized (40x40) map with a green valley through a vast desert. Very limited on building space.",
"Available random tiles: 500."
],
"center": {
"X": 22,
"Y": 19
},
"initial_terrains": 500
}
50 changes: 0 additions & 50 deletions data/maps/Great Plains.asc

This file was deleted.

67 changes: 67 additions & 0 deletions data/maps/Great Plains.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"terrains": {
"-": 250,
"^": 3,
"r": 3,
"t": 20,
"~": 2
},
"map": [
"-------------------------------------------",
"----------------------------------tt-------",
"-------------tt------------------tt--------",
"-------------tt----------------------------",
"----t--------------------------------------",
"---t~--------------------------------------",
"---t~--------------------TR----------------",
"-------------------------R^----------------",
"-------------------------------------------",
"-------------ttt----------------------tt---",
"------------ttttt--------------------tttt--",
"------------tttT---------------------tttt--",
"-------------t^^------------tt--------rT---",
"---------------------------tttt--------R---",
"--------------------------tt~~t------------",
"---------------------------t~~tt-----------",
"---------------------------ttttt-----------",
"-------------r-------------RRtt------------",
"--r----------r--------------R--------------",
"-rT----------------------------------------",
"--^----------------------------------------",
"---------------------h---------------------",
"---------------tt--------------------------",
"--------------tttt-------------------------",
"--------------ttttt------------------------",
"---------------ttt-------------------------",
"---------------------------------rtt-------",
"---------------------------------ttt-------",
"---------------------------------tt--------",
"-------------------------------------------",
"-------------------------------------------",
"------------ttt----------------------------",
"-----------ttttt---------------------------",
"-----------r~~tt---------------------------",
"-----------t~~tt---------------------------",
"--tt-------t~~tt-----------TR--------------",
"--tt--------ttt------------Tr--------------",
"--------------------------------------tt---",
"--------------------------------------ttt--",
"--------------------------------------tt---",
"-------------------------------------------",
"-------------------------------------------",
"-------------------------------------------"
],
"achievements": [
"landscape-architect",
"farmer-guild"
],
"description": [
"A medium-sized (43x43) map with vast plains and a few hills and forest patches. Resources are rare.",
"Available random tiles: 250."
],
"center": {
"X": 21,
"Y": 21
},
"initial_terrains": 250
}
52 changes: 0 additions & 52 deletions data/maps/River Delta.asc

This file was deleted.

Loading
Loading