BlueGit

blue-star tribegen

improve loading times, placeholder env sprites

timfa Tim · pushed by timfa

Authored 2026-01-30 · 9 months ago

Hash
7ae7886d2cb0214a04c0be429a4d7e859dc63a30
Parent
bcbade39
9 files changed +75 −6
web/assets/environments/test/autumn.png added Binary file +0 −0

The contents of this binary file are not shown.

web/assets/environments/test/metadata.json added +66 −0
@@ -0,0 +1,66 @@
1 {
2 "name": "Test Environment",
3 "description": "A controlled environment used for testing purposes.",
4 "koboldLocations": [
5 {
6 "x": 0.3,
7 "y": 0.4
8 },
9 {
10 "x": 0.6,
11 "y": 0.7
12 },
13 {
14 "x": 0.8,
15 "y": 0.2
16 },
17 {
18 "x": 0.1,
19 "y": 0.9
20 },
21 {
22 "x": 0.5,
23 "y": 0.5
24 },
25 {
26 "x": 0.4,
27 "y": 0.3
28 },
29 {
30 "x": 0.7,
31 "y": 0.8
32 },
33 {
34 "x": 0.2,
35 "y": 0.1
36 },
37 {
38 "x": 0.9,
39 "y": 0.6
40 },
41 {
42 "x": 0.15,
43 "y": 0.25
44 },
45 {
46 "x": 0.35,
47 "y": 0.45
48 },
49 {
50 "x": 0.55,
51 "y": 0.65
52 },
53 {
54 "x": 0.75,
55 "y": 0.85
56 },
57 {
58 "x": 0.95,
59 "y": 0.15
60 },
61 {
62 "x": 0.25,
63 "y": 0.35
64 }
65 ]
66 }
@@ -0,0 +1,66 @@
1{
2 "name": "Test Environment",
3 "description": "A controlled environment used for testing purposes.",
4 "koboldLocations": [
5 {
6 "x": 0.3,
7 "y": 0.4
8 },
9 {
10 "x": 0.6,
11 "y": 0.7
12 },
13 {
14 "x": 0.8,
15 "y": 0.2
16 },
17 {
18 "x": 0.1,
19 "y": 0.9
20 },
21 {
22 "x": 0.5,
23 "y": 0.5
24 },
25 {
26 "x": 0.4,
27 "y": 0.3
28 },
29 {
30 "x": 0.7,
31 "y": 0.8
32 },
33 {
34 "x": 0.2,
35 "y": 0.1
36 },
37 {
38 "x": 0.9,
39 "y": 0.6
40 },
41 {
42 "x": 0.15,
43 "y": 0.25
44 },
45 {
46 "x": 0.35,
47 "y": 0.45
48 },
49 {
50 "x": 0.55,
51 "y": 0.65
52 },
53 {
54 "x": 0.75,
55 "y": 0.85
56 },
57 {
58 "x": 0.95,
59 "y": 0.15
60 },
61 {
62 "x": 0.25,
63 "y": 0.35
64 }
65 ]
66}
web/assets/environments/test/spring.png added Binary file +0 −0

The contents of this binary file are not shown.

web/assets/environments/test/summer.png added Binary file +0 −0

The contents of this binary file are not shown.

web/assets/environments/test/winter.png added Binary file +0 −0

The contents of this binary file are not shown.

web/css/style.css +2 −2
@@ -401,7 +401,7 @@ button {
401 401 border-radius: 5px;
402 402 padding: 15px;
403 403 overflow-y: auto;
404 min-height: 150px;
404 min-height: 200px;
405 405 }
406 406
407 407 .panel h3 {
@@ -518,7 +518,7 @@ button {
518 518 }
519 519
520 520 .food-display {
521 font-size: 1.1em;
521 font-size: 0.8em;
522 522 font-weight: bold;
523 523 color: #667eea;
524 524 }
@@ -401,7 +401,7 @@ button {
401 border-radius: 5px;
401 border-radius: 5px;
402 padding: 15px;
402 padding: 15px;
403 overflow-y: auto;
403 overflow-y: auto;
404 min-height: 150px;
404 min-height: 200px;
405}
405}
406
406
407.panel h3 {
407.panel h3 {
@@ -518,7 +518,7 @@ button {
518}
518}
519
519
520.food-display {
520.food-display {
521 font-size: 1.1em;
521 font-size: 0.8em;
522 font-weight: bold;
522 font-weight: bold;
523 color: #667eea;
523 color: #667eea;
524}
524}
web/js/app.js +6 −0
@@ -193,6 +193,12 @@ class TribeGenApp
193 193 const dataText = await response.text();
194 194 const data = JSON.parse(dataText);
195 195
196 if (!data.success && data.error == "Not authenticated")
197 {
198 this.handleLogout();
199 return;
200 }
201
196 202 const savesList = document.getElementById('savesList');
197 203 savesList.innerHTML = '';
198 204
@@ -193,6 +193,12 @@ class TribeGenApp
193 const dataText = await response.text();
193 const dataText = await response.text();
194 const data = JSON.parse(dataText);
194 const data = JSON.parse(dataText);
195
195
196 if (!data.success && data.error == "Not authenticated")
197 {
198 this.handleLogout();
199 return;
200 }
201
196 const savesList = document.getElementById('savesList');
202 const savesList = document.getElementById('savesList');
197 savesList.innerHTML = '';
203 savesList.innerHTML = '';
198
204
web/src/Classes/Kobold.php +0 −2
@@ -111,8 +111,6 @@ class Kobold
111 111 $spriteMorph = self::getRandomSpriteMorph();
112 112 $name = self::generateRandomName();
113 113 $kobold = new self(uniqid('kob_' . $saveId . '_'), $userId, $saveId, $name, $age, $spriteMorph);
114 // Copy and transform sprite from assets to save folder
115 $kobold->initializeSprite();
116 114
117 115 return $kobold;
118 116 }
@@ -111,8 +111,6 @@ class Kobold
111 $spriteMorph = self::getRandomSpriteMorph();
111 $spriteMorph = self::getRandomSpriteMorph();
112 $name = self::generateRandomName();
112 $name = self::generateRandomName();
113 $kobold = new self(uniqid('kob_' . $saveId . '_'), $userId, $saveId, $name, $age, $spriteMorph);
113 $kobold = new self(uniqid('kob_' . $saveId . '_'), $userId, $saveId, $name, $age, $spriteMorph);
114 // Copy and transform sprite from assets to save folder
115 $kobold->initializeSprite();
116
114
117 return $kobold;
115 return $kobold;
118 }
116 }
web/src/api/game.php +1 −2
@@ -29,9 +29,8 @@ if ($method === 'POST') {
29 29
30 30 $tribe = Tribe::create($userId, $input['saveName']);
31 31
32 // Generate 20 random kobolds
33 32 $kobolds = [];
34 for ($i = 0; $i < 10; $i++) {
33 for ($i = 0; $i < 12; $i++) {
35 34 $kobold = Kobold::generate($userId, $tribe->getSaveId());
36 35 $tribe->addKobold($kobold);
37 36
@@ -29,9 +29,8 @@ if ($method === 'POST') {
29
29
30 $tribe = Tribe::create($userId, $input['saveName']);
30 $tribe = Tribe::create($userId, $input['saveName']);
31
31
32 // Generate 20 random kobolds
33 $kobolds = [];
32 $kobolds = [];
34 for ($i = 0; $i < 10; $i++) {
33 for ($i = 0; $i < 12; $i++) {
35 $kobold = Kobold::generate($userId, $tribe->getSaveId());
34 $kobold = Kobold::generate($userId, $tribe->getSaveId());
36 $tribe->addKobold($kobold);
35 $tribe->addKobold($kobold);
37
36