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 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page