A chunking system for game development
Project description
Chunky
A chunking system for game development
Using the library
Installation
run pip install hamolicious-chunky
Implementing
# 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hamolicious-chunky-1.1.1.tar.gz.
File metadata
- Download URL: hamolicious-chunky-1.1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3854da4469bf23d0a41d3fbdd1b194f8b4f0dbb8f0dd248fef4726a8d75fb76
|
|
| MD5 |
5928eb5a64cfced9b2f7b62bd3c1db77
|
|
| BLAKE2b-256 |
9b2919b5b14f5fb92a141da584b0ea7622d09e1079c7dd11b8c8afa56f3cbe83
|
File details
Details for the file hamolicious_chunky-1.1.1-py3-none-any.whl.
File metadata
- Download URL: hamolicious_chunky-1.1.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83f03f501f118f5d069736cc4b2e3f77f2c195bf2eb2b3d53a15ef62984ebe7f
|
|
| MD5 |
53fe9836d7445f3a0a66566c8bff6c17
|
|
| BLAKE2b-256 |
86bb61abe1621727a28f1ec5e8a2657bf8f0b8b5efbce71917b50a42a234fc60
|