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
Close
Hashes for hamolicious_chunky-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83f03f501f118f5d069736cc4b2e3f77f2c195bf2eb2b3d53a15ef62984ebe7f |
|
MD5 | 53fe9836d7445f3a0a66566c8bff6c17 |
|
BLAKE2b-256 | 86bb61abe1621727a28f1ec5e8a2657bf8f0b8b5efbce71917b50a42a234fc60 |