Skip to main content

A chunking system for game development

Project description

is_maintained pypi_version

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hamolicious-chunky-1.1.1.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

hamolicious_chunky-1.1.1-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page