Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Pygame dev here, I wish I could give you a straight answer, but I've never done it, my first thought was to look through github and see how other people are doing it, and theres a lot of results for "pygame infinite" Repository search results, as well as random terrain generation here: Magoninho/terrain-generation-test-pygame: Just for testing a random 2D terrain generation system i've made (not with perlin noise)

I wish I had a better answer for you, but if I was you I'd be looking through github pygame projects, combing through their code to see how other people are handling infinite worlds, generation etc.

My first thought was importing random and having python pick numbers to represent different possibilities for what to generate, something like:

If we're talking a game like minecraft something like this could implemented so that when the player steps off screen, import random and choose  a number between 1 and 4 with 1 being sand biome, 2 swamp, 3 mountain, 4 beach/ocean, and handle it like that. In addition to using a system like that for biomes you could have random make a choice to decide if there will be enemies on that chunk, treasure, nothing at all, etc etc.

Sorry for not really knowing how to help, but hopefully between some brainstorming and github repositories you can figure out a good way to implement your generator.