Skip to content

Commit

Permalink
docs(docs): 📝 Yay'd up the docs
Browse files Browse the repository at this point in the history
Improved the sections for installing, and also added skimage to the game part of pyproject.toml
  • Loading branch information
Tsunami014 (Max) authored and Tsunami014 (Max) committed Dec 26, 2024
1 parent 378302f commit ec48885
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 92 deletions.
97 changes: 8 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ The default theme is entirely taken from the `ThemeWood`, made by [Pixel-boy](ht
Are you ready? This is the most complicated installation process of any python library that exists ever, even Tensorflow (yes, I know!) But, follow the instructions and you'll probably be ok. Remember to [join the discord server](https://discord.gg/xr3phyEZtv) if you need any help.

1. Run `pip install Blaze-Sudio[all]`
2. Rejoice in happiness as your library gets installed, pain-free

<small>Disclaimer: may not actually be pain-free.<br>Disclaimer of the disclaimer: I'll help you if you run into any issues via [github issues](https://github.com/Tsunami014/Blaze-Sudio/issues/new/choose) or [Discord](https://discord.gg/xr3phyEZtv), so it will be mostly pain-free (for you) as a satisfaction guarantee</small>
2. Rejoice in happiness as your library gets installed, pain-free (hopefully).

### ⛏️ Installing from source
```bash
Expand All @@ -83,15 +81,15 @@ cd Blaze-Sudio
pip install .[all]
```
### 📜 Optional requirements
## Optional requirements
You don't need to install *everything*, so here is a list of all the optional requirements and what they do:
- `Blaze-Sudio[all]` - Installs all of the below.
- `Blaze-Sudio[game]` - Installs the required dependencies for the **game, graphics & collisions** module (everything you need to make a game with).
- `Blaze-Sudio[game]` - Installs the required dependencies for the **game, graphics & collisions** module (everything you need to make a game with) including some extras for extra functionality (e.g. `utils`).
- `Blaze-Sudio[collisions]` - Installs the required dependencies for the **collisions** module.
- `Blaze-Sudio[image]` - Installs the required dependencies for the **element Gen** module.
- `Blaze-Sudio[graphics]` - Installs the required dependencies for the **graphics** module.
- `Blaze-Sudio` - Doesn't install anything, just the library. But nothing in it will work.

You can also install multiple of these at a time like so: `pip install Blaze-Sudio[game,collisions]`.
You can also install multiple of these at a time like so: `pip install Blaze-Sudio[graphics,collisions]`.

## 📚 Library usage (Demos)
Demos are avaliable in `demos.py` for any main part of the library.
Expand All @@ -100,91 +98,12 @@ Demos are avaliable in `demos.py` for any main part of the library.
### 💻️ The graphics module
This is a module for having buttons, switches, colour pickers, scrollable screens, you name it - all in Pygame. It has a demo in `demos.py` too.
### 🎮️ The Game module
A simple demo is kinda hard because you need an ldtk file to make the levels with, but if you want there are some demo games [here](https://github.com/Tsunami014/BlazeTests).
But, the docs for making a game would be helpful, and are here: [Offfine 🖥️](docs/game/README.md) / [Online 🌐](https://tsunami014.gitbook.io/blaze-sudios/main-functionality/game)

And if you want full, in-depth explanation of each thing Blaze Sudio has to offer and how to use it all, visit [the docs](https://tsunami014.gitbook.io/blaze-sudios/)!
A simple demo is kinda hard because you need an ldtk file to make the levels with, but if you want there are some demo games [here](https://github.com/Tsunami014/BlazeTests) for you to see how making games is structured.
It may be a little confusing, **BUT DON'T WORRY** as making a game is super easy with the help of the documentation, no matter how hard you think this may look. It is all explained there.

But if you want to see the kind of code that is created, well, here is an example:
<details>
<summary>Click to see the code</summary>

<!-- TODO: Remember to always update this whenever something major changes -->
```python
from BlazeSudio.Game import Game
from BlazeSudio.collisions import collisions
import BlazeSudio.Game.statics as Ss
import pygame

G = Game()
G.load_map("./world.ldtk")

class BaseEntity(Ss.BaseEntity):
def __init__(self, Game, e):
super().__init__(Game, e)
self.accel_amnt = [[0.2, 0.2], [0.05, 0.05]]
self.gravity = [0, 0.1]

def __call__(self, evs):
self.handle_keys()
self.handle_accel()
colls = self.Game.currentLvl.layers[1].intgrid.getRects(1)
self.pos = [self.pos[0]-0.45, self.pos[1]-0.45]
outRect, self.accel = collisions.Rect(self.scaled_pos[0], self.scaled_pos[1], self.entity.gridSze*0.9, self.entity.gridSze*0.9).handleCollisionsAccel(self.accel, colls, False)
outUnscaled = self.entity.unscale_pos((outRect.x, outRect.y))
outUnscaled = [outUnscaled[0]+0.45, outUnscaled[1]+0.45]
self.pos = outUnscaled

@property
def scaled_pos(self):
return self.entity.scale_pos(self.pos)

@G.DefaultSceneLoader
class MainGameScene(Ss.BaseScene):
DefaultEntity = []
def __init__(self, Game, **settings):
self.lvl = settings.get('lvl', 0) # This before because it loads the bounds in the super() and it needs the level
super().__init__(Game, **settings)
self.sur = None
self.CamDist = 8
for e in self.currentLvl.entities:
if e.defUid == 107:
self.entities.append(BaseEntity(self, e)) # The Player
self.DefaultEntity.append(e)
self.entities[0].pos = [e.UnscaledPos[0]+0.5, e.UnscaledPos[1]+0.5]
break
else:
raise Ss.IncorrectLevelError(
'Need a player start!'
)

@property
def CamPos(self):
return self.entities[0].scaled_pos

def render(self):
if self.sur is not None:
return self.sur
self.sur = self.Game.world.get_pygame(self.lvl)
return self.sur

def renderUI(self, win, offset, midp, scale):
playersze = scale*self.entities[0].entity.gridSze
pos = self.entities[0].scaled_pos
r = (pos[0]*scale+offset[0]-(playersze//2), pos[1]*scale+offset[1]-(playersze//2), playersze, playersze)
pygame.draw.rect(win, (0, 0, 0), r, border_radius=2)
pygame.draw.rect(win, (255, 255, 255), r, width=5, border_radius=2)

G.load_scene()

G.play(debug=False)
```

This code is a modified version of `Basic-1`, which is playable and is contained inside this repo. It was modified to remove the changing level script (an extra 2 functions) for simplicity and also to remove other things it didn't need (like the debug functions) but still does virtually the exact same thing.
<br>
</details>
But, the docs for making a game would be helpful, and are here: [Offine 🖥️](docs/game/README.md) / [Online 🌐](https://tsunami014.gitbook.io/blaze-sudios/main-functionality/game)

**BUT DON'T WORRY** as making a game is super easy with the help of the documentation, no matter how hard you think this may look. It is all explained there.
And if you want full, in-depth explanation of each thing Blaze Sudio has to offer and how to use it all, visit [the docs](https://tsunami014.gitbook.io/blaze-sudios/)!

## 💻️ The terminal script
If you have installed BlazeSudio into your global pip, you *should* be able to run the `BlazeSudio` command in your terminal. This is a script to really quickly make a new project or open the docs. you can run with `BlazeSudio --help` to see all the options.
Expand Down
7 changes: 5 additions & 2 deletions docs/Installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

1. Run `pip install Blaze-Sudio[all]`. Done. Wasn't that hard, was it? Or was it? If there was an error please tell me about it by [making a new issue](https://github.com/Tsunami014/Blaze-Sudio/issues) or [joining Discord](https://discord.gg/xr3phyEZtv) and hopefully I'll be onto it soon enough.

Except if you *don't* want to install everything, in which case you can choose which optional requirements you want to install. See the next section for more information.

## Optional requirements
You don't need to install *everything*, so here is a list of all the optional requirements and what they do:
- `Blaze-Sudio[all]` - Installs all of the below.
- `Blaze-Sudio[game]` - Installs the required dependencies for the **game, graphics & collisions** module (everything you need to make a game with).
- `Blaze-Sudio[game]` - Installs the required dependencies for the **game, graphics & collisions** module (everything you need to make a game with) including some extras for extra functionality (e.g. `utils`).
- `Blaze-Sudio[collisions]` - Installs the required dependencies for the **collisions** module.
- `Blaze-Sudio[image]` - Installs the required dependencies for the **element Gen** module.
- `Blaze-Sudio[graphics]` - Installs the required dependencies for the **graphics** module.
- `Blaze-Sudio` - Doesn't install anything, just the library. But nothing in it will work.

You can also install multiple of these at a time like so: `pip install Blaze-Sudio[game,collisions]`.
You can also install multiple of these at a time like so: `pip install Blaze-Sudio[graphics,collisions]`.

# How to install the long hard way
This is not recommended. It gets the latest release, which if you get it at the wrong time may be the time where I committed 'was half way through majorly rewriting the code and it's all broken'. So be careful.
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ graphics = [
image = [
"noise",
"Pillow",
# Maybe remove the below 2
"scikit-image",
# Maybe remove the below
"matplotlib"
]

Expand All @@ -66,6 +66,7 @@ collisions = [
game = [
"Blaze-Sudio[graphics]",
"Blaze-Sudio[collisions]",
"scikit-image",
"pyperclip",
]

Expand Down

0 comments on commit ec48885

Please sign in to comment.