From f26a86bcc78c1946f55b6a399039e3bd8fb5dd16 Mon Sep 17 00:00:00 2001 From: jacopo grandi Date: Mon, 22 Feb 2021 20:18:25 +0100 Subject: fix maxrange and testing --- build/army/balance 1000 melee.txt | Bin 0 -> 21560 bytes build/army/balance 1000 the second.txt | Bin 0 -> 21560 bytes build/army/balance 1000.txt | Bin 0 -> 21560 bytes build/army/balance melee maul.txt | Bin 0 -> 21560 bytes build/army/best army ever.txt | Bin 21560 -> 21560 bytes build/army/range test.txt | Bin 21560 -> 21560 bytes build/army/worst.txt | Bin 21560 -> 21560 bytes build/content/templates/default.txt | 60 +++++++++++++++++++++++++++++++++ build/test.exe | Bin 786658 -> 786658 bytes design/notes.txt | 3 +- gst/info.c | 7 ++-- gst/units.c | 6 ++-- 12 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 build/army/balance 1000 melee.txt create mode 100644 build/army/balance 1000 the second.txt create mode 100644 build/army/balance 1000.txt create mode 100644 build/army/balance melee maul.txt diff --git a/build/army/balance 1000 melee.txt b/build/army/balance 1000 melee.txt new file mode 100644 index 0000000..86ffd09 Binary files /dev/null and b/build/army/balance 1000 melee.txt differ diff --git a/build/army/balance 1000 the second.txt b/build/army/balance 1000 the second.txt new file mode 100644 index 0000000..6db93ae Binary files /dev/null and b/build/army/balance 1000 the second.txt differ diff --git a/build/army/balance 1000.txt b/build/army/balance 1000.txt new file mode 100644 index 0000000..a44f973 Binary files /dev/null and b/build/army/balance 1000.txt differ diff --git a/build/army/balance melee maul.txt b/build/army/balance melee maul.txt new file mode 100644 index 0000000..fede815 Binary files /dev/null and b/build/army/balance melee maul.txt differ diff --git a/build/army/best army ever.txt b/build/army/best army ever.txt index 1ed86d2..7e76ce1 100644 Binary files a/build/army/best army ever.txt and b/build/army/best army ever.txt differ diff --git a/build/army/range test.txt b/build/army/range test.txt index 44a5c2b..949cda9 100644 Binary files a/build/army/range test.txt and b/build/army/range test.txt differ diff --git a/build/army/worst.txt b/build/army/worst.txt index 79686b5..aac287a 100644 Binary files a/build/army/worst.txt and b/build/army/worst.txt differ diff --git a/build/content/templates/default.txt b/build/content/templates/default.txt index f99915c..b5bff58 100644 --- a/build/content/templates/default.txt +++ b/build/content/templates/default.txt @@ -38,5 +38,65 @@ "armor": [ 0, 0, 0, 0, -1, -1, -1, -1 ], "augs": [ -1, -1, -1, -1, -1, -1, -1, -1 ], "levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }, + { + "name": "600 dude", + "chassis": "8", + "brain": "0", + "battery": "1", + "weapons": [ 2, -1, -1, -1, -1, -1, -1, -1 ], + "armor": [ -1, -1, -1, -1, -1, -1, -1, -1 ], + "augs": [ 8, 8, -1, -1, -1, -1, -1, -1 ], + "levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }, + { + "name": "300 bot dude", + "chassis": "0", + "brain": "0", + "battery": "0", + "weapons": [ 7, -1, -1, -1, -1, -1, -1, -1 ], + "armor": [ -1, -1, -1, -1, -1, -1, -1, -1 ], + "augs": [ -1, -1, -1, -1, -1, -1, -1, -1 ], + "levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }, + { + "name": "400 perfect duud", + "chassis": "2", + "brain": "0", + "battery": "0", + "weapons": [ 0, 0, -1, -1, -1, -1, -1, -1 ], + "armor": [ -1, -1, -1, -1, -1, -1, -1, -1 ], + "augs": [ 16, -1, -1, -1, -1, -1, -1, -1 ], + "levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }, + { + "name": "1000 tank boi", + "chassis": "11", + "brain": "0", + "battery": "0", + "weapons": [ 18, 16, -1, -1, -1, -1, -1, -1 ], + "armor": [ 0, 0, 0, -1, -1, -1, -1, -1 ], + "augs": [ 8, 8, -1, -1, -1, -1, -1, -1 ], + "levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }, + { + "name": "1000 melee bot friendo", + "chassis": "5", + "brain": "3", + "battery": "0", + "weapons": [ 10, 10, -1, -1, -1, -1, -1, -1 ], + "armor": [ 0, 0, 8, -1, -1, -1, -1, -1 ], + "augs": [ -1, -1, -1, -1, -1, -1, -1, -1 ], + "levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] + }, + { + "name": "2000 maul dodo", + "chassis": "4", + "brain": "0", + "battery": "1", + "weapons": [ 9, -1, -1, -1, -1, -1, -1, -1 ], + "armor": [ -1, -1, -1, -1, -1, -1, -1, -1 ], + "augs": [ -1, -1, -1, -1, -1, -1, -1, -1 ], + "levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] } ] \ No newline at end of file diff --git a/build/test.exe b/build/test.exe index d68d851..01857dc 100644 Binary files a/build/test.exe and b/build/test.exe differ diff --git a/design/notes.txt b/design/notes.txt index 5333555..dabdd19 100644 --- a/design/notes.txt +++ b/design/notes.txt @@ -1,11 +1,11 @@ tasks: (date) -[ ] implement stats hud view (issued on 18:02:21) [ ] implement net hud and minilobby (issued on 18:02:21) [ ] implement brain behaviour (issued on 18:02:21) [ ] implement lobby cost constraints (issued on 18:02:21) [ ] implement edit unit directly (issued on 18:02:21) [ ] implement persistent settings ini (issued on 18:02:21) +[ ] implement stats hud view (issued on 18:02:21) [ ] implement move animation (issued on 18:02:21) [ ] implement fire animation (issued on 18:02:21) [ ] implement explosions (issued on 18:02:21) @@ -15,6 +15,7 @@ tasks: (date) [ ] design component sprites (issued on 18:02:21) [ ] implement sound (issued on 18:02:21) + [x] implement army hud view (issued on 18:02:21, done on 22:02:21) [x] implement naming template and army (issued on 18:02:21, done on 22:02:21) [x] implement cost function (issued on 18:02:21, done on 20:02:21) diff --git a/gst/info.c b/gst/info.c index 2329baf..0eaecb3 100644 --- a/gst/info.c +++ b/gst/info.c @@ -240,13 +240,14 @@ float info_unit_get_range(infos *info, info_unit *u, int w) { float info_unit_get_maxrange(infos *info, info_unit *u) { int lc = u->levels[LEVEL_CHASSIS]; - float sum = 0; + float max = 0; for(int i=0; ichassis[u->chassis].slot_weapon[lc]; i++) { if (u->weapons[i] != -1) { - sum += info_unit_get_range(info, u, i); + float range = info_unit_get_range(info, u, i); + if (range > max) { max = range; } } } - return sum; + return max; } float info_unit_get_charge_per_shot (infos *info, info_unit *u, int w) { diff --git a/gst/units.c b/gst/units.c index 409f9b1..89c9489 100644 --- a/gst/units.c +++ b/gst/units.c @@ -64,7 +64,6 @@ void unit_remove (army *ar, map *m, unit *u) { ar->uslen--; ar->grid[xytoi(m, tx, ty)] = u; ar->grid[xytoi(m, ux, uy)] = NULL; - printf("ar->uslen: %d\n", ar->uslen); } void unit_dead (army *ar, map *m, unit *u) { @@ -76,7 +75,6 @@ void unit_search (infos *info, army *ar, map *m, unit *u, { for (int f=0; f<32; t[f] = NULL, f++); int mult[4][2] = { {1, 1},{1,-1},{-1,-1},{-1,1} }, x, y, dx, dy, tmp; - *t = NULL; for (int r=1; rgridpos[0] - (*t)->gridpos[0], u->gridpos[1] - (*t)->gridpos[1] - }; float mag = vec2_mag(diff); - if (mag > range) *t = NULL; + }; float mag = vec2_mag2(diff); + if (mag > range*range) *t = NULL; } }}} } -- cgit v1.2.3-54-g00ecf