https://github.com/hamolicious/chunky
A chunking system for game developement
https://github.com/hamolicious/chunky
chunking chunks library pypi pypi-package python
Last synced: over 1 year ago
JSON representation
A chunking system for game developement
- Host: GitHub
- URL: https://github.com/hamolicious/chunky
- Owner: hamolicious
- License: wtfpl
- Created: 2021-12-16T06:25:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-21T06:21:42.000Z (over 4 years ago)
- Last Synced: 2025-02-08T02:10:26.001Z (over 1 year ago)
- Topics: chunking, chunks, library, pypi, pypi-package, python
- Language: Python
- Homepage: https://pypi.org/project/hamolicious-chunky/1.0.0/
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README


# Chunky
A chunking system for game development
## Using the library
### Installation
run `pip install hamolicious-chunky`
### Implementing
```python
# import necessary modules from library
from chunky import World as BaseWorld, Chunk, Vec2d
# setup library
BaseWorld.render_dist.set(3, 3) # how many chunks to load
Chunk.size = Vec2d(300, 300) # size of chunks in pixels
# override the `generate_chunk()` method
class World(BaseWorld):
def generate_chunk(self, pos:Vec2d) -> Chunk:
chunk = Chunk(pos)
chunk.objects.append() # add objects the chunk should hold
return chunk # should always return chunk
# create player
player_pos = Vec2d(500, 500)
# instantiate class
world = World(player_pos)
while True: # main loop
world.update(player_pos) # update to generate new chunks and update the loaded chunks
chunks = world.get_loaded_chunks() # gets the chunks inside the render distance
chunks = world.get_active_chunk() # gets the current chunk the player is in
```