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
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.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 723eeb899f46f8a353877e088e8b11d388c654512f145c2c0906374ea91d1125 |
|
MD5 | 156ddedbd89afc98298e9e7e899dc0d3 |
|
BLAKE2b-256 | b0eafe8b91e8eee3781eb1aaa57a11d9928d204f4d6070e3ca97903cae047891 |