Log In  
Log In  

Hey all,

Introduction

I haven't done any development for many years and in general hardly did any game development. Now I'm getting back into it with the awesome Pico-8 and to get familiar with the engine and game dev I'm working on a platformer.

Current progress

The current status is that I have a player character, physics, a (very) basic map and some sound effects. It all works nicely and I'm currently working on items that the player can pick up (power-ups and such). Before moving forward I was hoping to learn some best practices from you all and get some feedback on my current approach.

Approach or implementing items

As I want to have rather large maps with many items I want to place items using the map editor, not by defining them manually in the code (as tweaking during play-testing would be a pita). At the same time I want the items to have some animation before they're picked up and of course an animation when they're picked up as well.

My current idea is to scan the map during _init() using mget() for these items and then add them to an array which would be scanned and updated during the game loop. The idea is to iterate over the elements in the array and use mset() to change the tiles to do the animation before they're picked up.

Then I'm using collision detection to detect whether the player is picking up an item and if so play a sound effect + run an animation.

Feedback please

  • Does the above approach make sense or is there a better way to achieve this?
  • What are the pros/cons? Are there any alternatives?
  • Wouldn't iterating over the entire map to move the items to an array be too slow?
  • Can I do the loading in chunks based on what's in view? (e.g. using the camera position)

All help is very much appreciated!

P#60881 2019-01-16 07:58

Yes, this makes sense. I know of many games that have done it this way.

You say you want to have a large map, though. Are you sure you have room for the entire map in the editor? It might be that you're forced to store the map in "code" at some point anyway.

P#60883 2019-01-16 08:38

> You say you want to have a large map, though. Are you sure you have room for the entire map in the editor? It might be that you're forced to store the map in "code" at some point anyway.

Right, I haven't explored limitations of the map in Pico-8. Good point, I'll look into that. And thanks for your reply!

P#60884 2019-01-16 08:52

Another thought. Although I don't know about how efficient this method is,

  • Go through the map at _Update() and add all the items in the camera's view to a table.
  • Then remove the items from the map tiles.
  • Render the items as "entities" by iterating over the table every _Update().
  • If the player doesn't pick them up or interact, re-add them to the map if they are outside the camera.

Picking them up would mean that the are not re-added as there would be no entity. This would presumably work with enemies and other things too, as it could retain weather or not the enemy was killed or a door opened.
Just thinking aloud.

P#60885 2019-01-16 10:47 ( Edited 2019-01-16 10:49)

> Right, I haven't explored limitations of the map in Pico-8.

Note that half of the map and half of the spritesheet share memory.

Depending on how many sprites you use, the map is from 128x32 to 128x64 cells.

P#60888 2019-01-16 12:46 ( Edited 2019-01-16 12:46)

Thanks for all the input, I've gone ahead and started implementing it. Hit a road bump though, but figured I'd open a separate thread for that here: https://www.lexaloffle.com/bbs/?tid=32919

P#60898 2019-01-16 19:47 ( Edited 2019-01-16 19:47)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-05-26 23:00 | 0.015s | 2097k | Q:19