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
Metadata
Release files for hamolicious-chunky 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hamolicious-chunky-1.1.1.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hamolicious_chunky-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.1 kB
Release files / hamolicious-chunky-1.1.1.tar.gz
| Download URL | hamolicious-chunky-1.1.1.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3854da4469bf23d0a41d3fbdd1b194f8b4f0dbb8f0dd248fef4726a8d75fb76
|
|
BLAKE2b-256 checksum How to use checksums |
9b2919b5b14f5fb92a141da584b0ea7622d09e1079c7dd11b8c8afa56f3cbe83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / hamolicious_chunky-1.1.1-py3-none-any.whl
| Download URL | hamolicious_chunky-1.1.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83f03f501f118f5d069736cc4b2e3f77f2c195bf2eb2b3d53a15ef62984ebe7f
|
|
BLAKE2b-256 checksum How to use checksums |
86bb61abe1621727a28f1ec5e8a2657bf8f0b8b5efbce71917b50a42a234fc60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|