Skip to content

Commit

Permalink
Touched up gameplay and dialogues, online removal
Browse files Browse the repository at this point in the history
  • Loading branch information
fortwoone committed Nov 14, 2023
1 parent 2d3bb6b commit c5ffaa8
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 58 deletions.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,37 @@ cd where/you/want/it/old-fashioned-orcs
python3 -m pip install -r dev-requirements.txt
```

4. Then simply run the [\_\_init\_\_.py](__init__.py) file.
4. Find the hosts file in your computer (see paths in the table below) and add the following lines at the end of the file:
```text
127.0.0.1 oldfashionedorcs.servegame.com
::1 oldfashionedorcs.servegame.com
```
<table>
<tr>
<th>
OS
</th>
<th>
Windows 10+
</th>
<th>
Unix-based systems
</th>
</tr>
<tr>
<td>
Path
</td>
<td>
C:\Windows\System32\drivers\etc\hosts
</td>
<td>
/etc/hosts
</td>
</tr>
</table>

5. Then simply run in this order the [server/backend.py](server/backend.py) and the [\_\_init\_\_.py](__init__.py) file.


## Controls
Expand Down
6 changes: 3 additions & 3 deletions maps/level2.tmx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.9" tiledversion="1.9.0" orientation="orthogonal" renderorder="right-down" width="46" height="13" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="46" height="13" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<tileset firstgid="1" source="../assets/Summer Code Jam 2022 - Old-Fashioned Orcs.tsx"/>
<layer id="1" name="Normal Stuff" width="46" height="13">
<data encoding="csv">
Expand All @@ -9,9 +9,9 @@
28,28,28,0,0,0,0,0,0,0,0,0,28,0,0,0,0,0,0,28,28,33,0,0,0,0,27,27,0,0,0,0,0,27,27,0,0,0,0,0,2147483681,2147483685,27,0,0,37,
28,28,0,0,0,0,0,0,0,0,28,28,28,0,0,35,29,29,29,29,33,0,0,0,0,0,27,0,0,0,0,0,0,0,0,0,0,23,0,0,0,41,0,0,27,37,
28,0,0,0,0,0,0,0,28,0,0,0,28,0,0,33,0,0,0,0,0,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0,2147483687,40,39,0,0,41,27,0,0,37,
28,0,0,0,28,28,28,0,0,0,0,0,28,28,38,0,0,0,0,0,0,3221225511,40,39,0,0,0,0,0,0,0,0,0,0,42,0,0,0,0,0,0,41,0,0,27,37,
28,0,0,30,28,28,28,0,0,0,0,0,28,28,38,0,0,0,0,0,0,3221225511,40,39,0,0,0,0,0,0,0,0,0,0,42,0,0,0,0,0,0,41,0,0,27,37,
28,28,0,0,0,0,0,0,0,0,0,0,0,28,33,0,0,0,0,0,0,0,0,0,0,42,0,0,0,0,0,2147483687,39,0,0,0,0,0,0,0,0,41,27,0,0,37,
2,0,0,28,28,28,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,2147483687,39,0,0,0,0,0,45,0,0,0,0,0,0,0,0,0,0,0,41,0,0,27,37,
2,0,30,28,28,28,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,2147483687,39,0,0,0,0,0,45,0,0,0,0,0,0,0,0,0,0,0,41,0,0,27,37,
2,0,0,0,0,0,28,28,0,0,0,0,0,48,0,0,46,0,0,0,0,0,0,0,0,0,0,2147483692,43,3221225509,0,0,0,0,0,2147483692,0,44,0,25,0,0,0,27,27,37,
2,0,0,0,0,0,0,0,0,28,28,28,0,0,43,43,43,43,43,28,28,43,43,43,43,43,43,28,28,28,44,0,0,2147483692,43,28,28,28,43,43,43,32,43,43,43,2147483678,
2,0,0,0,0,0,0,0,0,0,0,0,0,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,43,43,28,28,28,28,28,28,28,28,28,28,28,28,28,
Expand Down
2 changes: 1 addition & 1 deletion maps/level3.tmx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.9" tiledversion="1.9.0" orientation="orthogonal" renderorder="right-down" width="41" height="12" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="41" height="12" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<tileset firstgid="1" source="../assets/Summer Code Jam 2022 - Old-Fashioned Orcs.tsx"/>
<layer id="1" name="Collision" width="41" height="12">
<data encoding="csv">
Expand Down
22 changes: 11 additions & 11 deletions maps/level5.tmx
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.9" tiledversion="1.9.0" orientation="orthogonal" renderorder="right-down" width="30" height="31" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="6">
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="30" height="31" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="6">
<tileset firstgid="1" source="../assets/Summer Code Jam 2022 - Old-Fashioned Orcs.tsx"/>
<layer id="1" name="Collision" width="30" height="31">
<data encoding="csv">
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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,2147483664,0,15,0,0,15,0,15,15,15,15,15,15,15,15,15,
0,0,0,0,0,0,0,0,0,2147483664,0,0,15,15,3,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,2147483664,0,15,0,15,15,0,15,15,15,15,15,15,15,15,15,
0,0,0,0,0,0,0,0,0,2147483664,0,15,15,15,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
15,0,0,15,15,0,0,15,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,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,
0,0,0,0,0,0,0,35,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7,7,0,0,0,7,7,0,
0,0,0,0,0,0,35,35,0,0,0,0,0,0,0,0,0,0,2147483656,7,0,0,0,0,0,7,2,0,0,0,
0,0,0,0,0,0,35,35,0,0,0,0,0,0,0,0,0,2147483656,6,7,0,0,0,0,0,7,7,0,0,0,
0,0,0,0,35,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,7,0,0,0,0,
0,0,35,0,0,0,0,0,0,0,0,0,0,0,14,0,14,0,0,0,0,0,0,0,7,0,0,0,0,0,
28,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,14,0,0,0,0,0,0,7,21,0,0,0,7,
28,28,28,28,0,0,0,0,0,0,0,0,14,0,0,0,0,0,14,0,0,0,0,0,0,6,6,0,0,0,
28,28,28,28,0,0,0,0,0,0,0,0,14,0,0,0,0,0,14,0,0,0,0,0,0,6,6,6,0,0,
28,28,28,30,28,28,28,28,43,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
28,28,28,28,28,28,28,28,28,28,44,0,0,0,0,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
28,28,28,0,0,28,28,28,28,28,28,43,43,43,43,43,43,43,44,0,0,0,0,0,0,0,0,0,0,0,
28,28,28,0,0,0,0,0,0,28,28,28,28,28,28,28,28,28,28,43,44,0,0,0,0,0,0,0,0,0,
28,28,28,0,0,0,0,0,0,28,28,28,28,28,28,28,28,28,28,29,29,40,39,0,0,0,0,0,0,0,
28,0,0,0,0,0,0,0,0,0,0,29,36,29,29,29,29,29,33,0,0,0,0,0,0,0,0,0,0,0,
28,0,0,0,0,29,28,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,2147483692,43,43,43,43,44,0,
28,0,0,0,0,0,0,0,0,0,0,29,29,29,29,29,29,29,33,0,0,0,0,0,0,0,0,0,0,0,
28,0,0,0,0,29,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2147483692,43,43,43,43,44,0,
28,0,0,33,0,0,34,0,2684354593,33,0,0,0,0,0,0,0,0,0,0,0,2147483692,43,28,28,28,28,28,28,43,
33,0,0,0,0,0,0,0,0,0,0,42,0,0,2147483687,39,0,0,0,0,2147483687,29,29,29,29,29,29,29,29,29,
0,0,0,0,0,0,0,0,0,0,0,0,42,0,0,0,0,2147483687,39,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,0,0,0,0,0,0,
0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
0,0,0,0,0,0,0,0,0,0,40,40,40,40,40,40,40,40,40,0,0,0,0,0,0,40,0,40,40,40,
0,0,0,0,0,0,0,0,0,51,51,50,50,51,51,50,50,51,51,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,51,0,0,0,0,0,0,0,0,0,21,0,
Expand Down Expand Up @@ -65,11 +65,11 @@
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,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,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,4,0,4,4,0,4,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,3,3,0,0,2147483651,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,0,4,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,3,0,0,0,2147483651,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
0,3,3,0,0,3,3,0,3,2147483651,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,
7,7,7,7,7,7,7,0,7,7,7,7,7,6,6,6,6,6,7,7,7,0,0,0,7,7,7,0,0,7,
7,7,7,7,7,7,7,0,7,7,7,7,7,6,6,6,6,7,7,7,7,0,0,0,7,7,7,0,0,7,
7,7,7,7,7,7,0,0,7,7,7,6,8,0,0,0,0,0,0,0,7,7,7,7,7,0,7,7,7,7,
7,7,7,7,0,7,3,3,3,3,12,0,0,0,0,0,0,0,0,2147483656,6,7,7,7,7,0,7,7,7,7,
7,7,0,10,3,3,3,3,3,20,8,0,0,0,0,0,0,0,0,0,0,2147483656,7,7,7,7,7,2147483651,7,7,
Expand Down
6 changes: 3 additions & 3 deletions maps/level6.tmx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.9" tiledversion="1.9.0" orientation="orthogonal" renderorder="right-down" width="30" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="30" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<tileset firstgid="1" source="../assets/Summer Code Jam 2022 - Old-Fashioned Orcs.tsx"/>
<layer id="1" name="Collision" width="30" height="10">
<data encoding="csv">
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,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,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,0,0,0,0,0,0,0,23,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,2147483666,19,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,2147483666,19,18,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,17,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,46,0,0,2147483664,7,16,0,0,0,0,0,0,0,0,0,
0,47,0,0,0,48,0,0,0,0,0,0,0,2147483664,15,15,15,15,7,7,7,15,0,0,0,0,48,0,0,0,
0,47,0,0,0,48,0,0,0,0,0,0,0,2147483664,15,15,15,15,7,7,7,15,16,0,0,0,48,0,0,0,
15,15,15,15,15,15,15,15,15,15,15,15,15,7,7,7,7,7,7,7,7,7,7,15,15,15,15,15,15,15,
3,3,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,3,3,3,3,3,3
</data>
Expand Down
2 changes: 1 addition & 1 deletion maps/level7.tmx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.9" tiledversion="1.9.0" orientation="orthogonal" renderorder="right-down" width="30" height="14" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="30" height="14" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<tileset firstgid="1" source="../assets/Summer Code Jam 2022 - Old-Fashioned Orcs.tsx"/>
<layer id="1" name="Collision" width="30" height="14">
<data encoding="csv">
Expand Down
48 changes: 24 additions & 24 deletions maps/levels.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"0": {
"dialogue": {
"start": [
"Welcome to a totally generic platformer",
"This is the tutorial, where I tell you how to play the game",
"But if you've played platformers before I'm sure you'll figure it out"
"Welcome to a totally generic platformer!",
"This is the tutorial, where I tell you how to play the game.",
"But if you've played platformers before I'm sure you'll figure it out!"
],
"flag": [
"Wow! You reached the very shiny flag! Congratulations!"
Expand All @@ -21,7 +21,7 @@
"character": "player"
},
{
"text": "Ugh. Tourists again",
"text": "Ugh. Tourists again!",
"character": "Tony"
},
{
Expand All @@ -36,11 +36,11 @@
"character": "Tony"
},
{
"text": "[sigh] It's like talking to a brick wall",
"text": "[sigh] It's like talking to a brick wall...",
"character": "Tony"
},
{
"text": "I can't seem to pick it up",
"text": "I can't seem to pick it up.",
"character": "player"
},
{
Expand All @@ -52,7 +52,7 @@
"character": "player"
},
{
"text": "Eh, you'll find a way. Let me grab that shovel",
"text": "Eh, you'll find a way. Let me grab that shovel.",
"character": "Tony"
},
{
Expand Down Expand Up @@ -102,34 +102,34 @@
"character": "player"
},
{
"text": "Sorry if that came across as rude",
"text": "Sorry if that came across as rude.",
"character": "Bob"
},
{
"text": "I guess it's a bit weird if someone randomly comes up to you and asks you if you have any friends",
"text": "I guess it's a bit weird if someone randomly comes up to you and asks you if you have any friends...",
"character": "Bob"
},
{
"text": "However it is an important question. It wasn't meant to be rude",
"text": "However it is an important question. It wasn't meant to be rude.",
"character": "Bob"
},
{
"text": "This is a multiplayer game, so some levels are not possible alone",
"text": "This is a multiplayer game, so some levels are not possible alone.",
"character": "Bob"
},
{
"text": "(We had to justify implementing WebSockets somehow...)",
"character": "Bob"
},
{
"text": "Press F if you have no friends (NOTE: Does not generate friends, just skips level)",
"text": "Press F if you have no friends. (NOTE: Does not generate friends, just skips level)",
"character": "Bob"
}
],
"first_dude_delay": [
"require:first_dude",
{
"text": "Oh and if you need any hints for any of the levels, there's some in the README",
"text": "Oh and if you need any hints for any of the levels, there's some in the README.",
"character": "Bob"
},
{
Expand All @@ -142,12 +142,12 @@
"character": "Gary"
}],
"flag": [
"GET YOUR DIRTY HANDS OFF MY FLAG"
"GET YOUR DIRTY HANDS OFF MY FLAG!"
],
"other_side": [
"Wow you actually made it! Congratulations!",
"(or did you?)",
"Remember to let your friend through! (or not)"
"Wow, you actually made it! Congratulations!",
"(Or did you?)",
"Remember to let your friend through! (Or not...)"
],
"touch_cube": [
"Wow! You managed to touch some random blue cube in some random cave! Congratulations!"
Expand Down Expand Up @@ -205,7 +205,7 @@
"4": {
"dialogue": {
"right_area": [
"Wow you managed to go through a wall. Don't think you're outsmarting me...",
"Wow, you managed to go through a wall. Don't think you're outsmarting me...",
"Are you assuming this pressure plate actually does something?"
],
"flag": ["crash"],
Expand Down Expand Up @@ -245,9 +245,9 @@
"6": {
"dialogue": {
"start": [
"Welcome to a totally generic platformer",
"This is the tutorial, where I tell you how to play the game",
"But if you've played platformers before I'm sure you'll figure it out"
"Welcome to a totally generic platformer!",
"This is the tutorial, where I tell you how to play the game.",
"But if you've played platformers before I'm sure you'll figure it out!"
],
"sushpish": [
"require:start",
Expand All @@ -262,7 +262,7 @@
"character": "player"
},
{
"text": "Ugh. Tourists again",
"text": "Ugh. Tourists again!",
"character": "Tony"
},
{
Expand All @@ -289,7 +289,7 @@
"character": "Tony"
},
{
"text": "[sigh] It's like talking to a brick wall",
"text": "[sigh] It's like talking to a brick wall...",
"character": "Tony"
},
{
Expand All @@ -305,7 +305,7 @@
"character": "player"
},
{
"text": "Eh, you'll find a way. Let me grab that shovel",
"text": "Eh, you'll find a way. Let me grab that shovel.",
"character": "Tony"
},
{
Expand Down
33 changes: 32 additions & 1 deletion src/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,37 @@ def update(self, dt):
}


class collide_circle_ratio_single:
__slots__=("ratio",)
# Same thing as pygame.sprite.collide_circle_ratio, but applies only to the first sprite.
def __init__(self, ratio):
self.ratio = ratio

def __call__(self, left, right):
ratio = self.ratio
left_rect = left.rect
right_rect = right.rect
x_distance = left_rect.centerx - right_rect.centerx
y_distance = left_rect.centery - right_rect.centery
dist = x_distance**2 + y_distance**2
try:
leftradius = left.radius
except AttributeError:
leftradius = 0.5 * ((left_rect.width**2 + left_rect.height**2) ** 0.5)
# store the radius on the sprite for next time
left.radius = leftradius
leftradius *= ratio
try:
rightradius = right.radius
except AttributeError:
rightradius = 0.5 * (
(right_rect.width**2 + right_rect.height**2) ** 0.5
)
# store the radius on the sprite for next time
right.radius = rightradius
return dist <= (leftradius + rightradius) ** 2


class Game:
"""The Game"""

Expand Down Expand Up @@ -877,7 +908,7 @@ def update_objects(self, *args, **kwargs):
self.player,
layer1,
False,
lambda spr1, spr2: spr1.rect.clip(spr2.rect).size >= (2, 2),
(lambda spr1, spr2: spr1.rect.clip(spr2.rect).size >= (2, 2), collide_circle_ratio_single(2.25))[bool(self.level)],
)
if layer1_collisions:
for sprite in layer1_collisions:
Expand Down
Loading

0 comments on commit c5ffaa8

Please sign in to comment.