• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Development Alternatives to tiles when outside room [SOLVED]

jamyers

Member
I've created an "infinite" world with chunk loading. I've been testing and searching around for an answer for the past few hours and I can't seem to find anything.

I wanted to use tiles originally, but they only fill in in the actual room which in the case of this game is not very big. The main problem is that because the game allows you to go past the room border, and even into the negatives, from what I've gathered, I won't be able to tile because game maker doesn't allow it? .

I've tried adding sprites to an asset layer, but as you can imagine, after a certain threshold, my frame rate tanks, as to be expected. I didn't see a way of clearing an asset layer though.

I've also tried drawing sprites just inside of the view along my "chunk grids", but for whatever reason that was really choppy even when my fps was in the 400s... I'm assuming I coded it poorly, and I'll try again tomorrow. But in the mean time, are there any other work around to placing tiles outside of the room? Or maybe some other ideas my sleep deprived brain is struggling to come up with?
 
Last edited by a moderator:

Yal

🐧 *penguin noises*
GMC Elder
If you have infinite chunk loading, you should also have chunk unloading... basically, when stuff goes out of the view far enough, remove them from the room. Then the asset layer approach should work just fine.

Another approach: instead of creating and destroying tiles all the time, compute your terrain using an infinite noise function, and just draw the terrain corresponding to the view's current position. Now you only need to keep track of the current world position (through the draw loop might be a bit slow)

A primer on what noise randomness is (watch the entire thing if you can't tell the difference between noise randomness and a traditional pseudo-random generator off the top of your head):
 

Japster

Member
Hi @jamyers...

You've probably already checked out @Yal 's advice and that great link, and tbh, I think that there are many approaches to this (most of which I'm guessing yal, with their experience, has tried and used, or dismissed for various good reasons! - Your query is marked as solved, but I'm intrigued on how you sorted it in the end!

i.e. I was thinking....

Couldn't you have a larger room, smaller camera, and simply adjust the layer's X and Y or as @Yal suggests, draw the surrounding tiles - if you're storing your map data anyway (ie. to a persistent grid, etc), you can use that to render the tiles on-screen, and just outside of the view? ..ie The player does not move, but the tile layer contents are updated to give the impression that they are?

Also, I've had very, VERY, large rooms in terms of 10's or thousands of tiles across / high, and didn't notice any performance issues with a view that does not show ludicrous amounts of them at once - you could create a huge room with a smaller viewport into it, only updating and rendering the tiles around the player, and when nearing the edge of it, fill in a more central viewport area's worth with the new 'area's tiles, and 'snap' the player to that location? - The player would be oblivious to this relocation (Note - this would only work if you're storing the source world data in a data structure, as opposed to ONLY in the tile layer, thereby over-writing it.)

...or you could do it via this method:- If you're smooth scrolling, you could go old-skool, ie:- smoothly scroll the tile layer (or camera) around, offsetting the X/Y position, until you hit an exact X/Y tile 'grid' position, then hard 'shift' all on-screen tiles across by one tile grid cell, and reset the layer or camera's X/Y position. Conversely, If you're NOT smooth scrolling, you need simply do the latter? - just shift by one grid position each step!... (Both of which we used to do on the ol' C64 / 8-Bits... :D )

If the player is 'moving' around a virtual space, and you're displaying that local environment around them, couldn't you just use their 'virtual' location to offset the chunker's rendering source grid, to always display the 'tiles' in that area on the actual tile or asset map, therefore not hitting the tile layer boundary?

Sorry if I'm not great at explaining this sort of stuff!
 

Yal

🐧 *penguin noises*
GMC Elder
~









On a serious note, deleting post contents is considered rude since it retroactively diminishes the value of the entire discussion, not just your own contributions. Please use the "delete" button instead.
 

Japster

Member
~


On a serious note, deleting post contents is considered rude since it retroactively diminishes the value of the entire discussion, not just your own contributions. Please use the "delete" button instead.
...not to mention that my curiosity is now driving me crazy.... :(
 
Top