Log In  
Log In  

@morningtoast

Follow
Follow

Long time hobby game developer, Hot Wheels racer and wrestling smark.

http://www.redlinederby.com
http://www.1005holds.com

It's been a while since I've made a game so I'm running into questions I probably had answers previously...my apologies if this is a rerun.

I typically use a table for each type of object - enemies, bullets, powerups, etc. - and then loop over each table checking to see if the collide or whatever. Something like...

for bk,b in pairs(bullets) do
    for ek,e in pairs(enemies) do    
        if collide(e,b) then ...do something... end
    end
end

And then there could be several of these depending on which objects interact with each other.

But I've also seen where you use one table for all objects and then check object types to see if they should interact.

for bk,b in pairs(bigtable) do
    for ek,e in pairs(bigtable) do    
        if e.type==1 and b.type==2 then 
            ...do something...
        end

        if e.type==3 and b.type==4 then 
            ...do something...
        end
    end
end

Is there any advantage to one of these methods over the other?

Personally, having a table per object type makes it easier to stay organized but having a ton of loops going feels troublesome and can be hard to manage. Likewise, looping twice over a giant table sounds less ideal as well.

So...just wondering. I'll probably keep coding how I always do because it works and keeps me sane, but was just thinking about the impact.

P#53152 2018-05-31 20:32 ( Edited 2018-06-01 06:26)

I'm trying to get P8 to run in a window on my Linux Windows install on my Raspberry Pi, so I can have it and my editor up on the same desktop (like I do in real Windows). But by default, P8 runs fullscreen. I've tried launching it from terminal with the flags outlined in the docs and even by editing the config file, but none of that is working, it's still going fullscreen.

Anyone else tried to run it windowed on Linux (RPi)? ..and got it working? Or is all that windowed stuff for "real" Windows only.

P#49737 2018-02-26 23:11 ( Edited 2018-08-12 11:43)

Sorry for the vague subject line...I don't know how to best describe what I'm seeing. That probably means this issue is certainly something I'm doing wrong but just don't know what. I swear I've done it in the past without problems so it has me wondering if it's a new P8 version thing or if I'm just crazy...anyway...

I have something like this...

pool={
   {name="Jerry"},
   {name="Tom"}
}
list={}

function mybutt(myx)
   local obj=pool[1]

   obj.x=myx
   obj.y=20

   add(list, obj)
end

mybutt(10)
mybutt(64)
mybutt(82)

And the problem is that when I loop through 'list' every value of 'x' is the last value added via the function, so in this example, 82.

But when I do rewrite as below it works as I think it should above...

pool={
   {name="Jerry"},
   {name="Tom"}
}
list={}

function mybutt(myx)
   local tmp=pool[1] -- This is the part that feels wrong

   local obj={}
   obj.name=tmp.name
   obj.x=myx
   obj.y=20

   add(list, obj)
end

mybutt(10)
mybutt(64)
mybutt(82)

It's like it won't add unique properties to the local 'obj' variable when I create it from another table. I have to put the pull from the other table (pool) into its own variable, then populate the table I actually want to add to the list.

I could swear that I've used the first version in the past and it has worked just fine...yes? No?

I shouldn't have to do it that way. Creating local from a global and then adding to that local should work just fine using dot notation and so on. It's bizarre.

And maybe I'm just all sorts of wrong, in which case, why doesn't example #1 work like I expect?

P#48435 2018-01-21 22:28 ( Edited 2018-01-22 15:31)

I'm looking for some help or snippet on how to create a path for an object that gives an arc between 2 coordinates.

I have code/examples for waves and orbiting in a circle, but I haven't needed to make an arc between 2 explicit points before. I'm not making an Angry Birds game but need that type of physics arc created that then allows a object to follow that path.

Ideally, something that lets you increase the gravity/friction/whatever that will slow the object down the further it gets away from the source point.

Although...I guess I could just trial-n-error it from the source point, messing with the variables until the thing lands where I need it. But having a 2-point method would probably be more helpful in the long run (for everyone).

Even if you have a cart that has something similar, I'm happy to code surf for things and learn.

P#48360 2018-01-19 12:33 ( Edited 2018-01-22 06:30)

Is there a where to run Pico-8 from the commandline so that it can compile/export without having to run the actual game? I'm looking for a way to create the HTML export without having Pico-8 running.

I'm often on a computer where I can't install P8 but can code with a cloud IDE. Of course, that's just blind coding without any running or debugging. So was thinking if I can could install Pico-8 on my web server (which I can ssh into) and run a command that will tell P8 to export the web version, then I might be able to do some debugging and testing.

Possible?

I see there's a headless mode now available but not sure that would allow this type of workaround. That sounds like a normal "run and quit" type of thing.

P#47856 2018-01-04 11:33 ( Edited 2018-01-04 17:47)

It goes without saying that you should always publish and share your PICO-8 games here on the the official site. Not only will you get great feedback, your game will appear in the Splore menu of PICO-8. So it's a no-brainer for any game you make.

But where else should you publish?

When I made my first PICO-8 games, I wasn't sure where to put my games. I saw a few others use Itch.io so I did the same...and that's where my game publishing journey started.

.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.

Itch.io
http://www.itch.io

Pros

  • Nice site that's easy to use for everyone
  • Customizable game pages
  • Web player and binary download options
  • Good analytics
  • Donation options

Cons

  • Limited exposure and findability
  • Lots of competition, focus on download games

Itch.io is a great platform on which to publish games (PICO-8 or otherwise). The site is nicely designed so it's easy for visitors to come and play. They also let you customize your game page so it's easy to add your own graphics and styles to help promote your game. I create a rather generic template for my games but also made a "fancy" one to promote Alien Harvest...check it out.

Itch.io also offers decent analytics and tracking for your games. You can easily see views, downloads and other stats.

One nice feature is that the site allows you to offer the web player version of your PICO-8 game but you can also put up other files for download (for free or purchase). So you can also add your binary game exports to your page. The site is setup to be a one-stop for game publishing.

You can also setup a pay-what-you-want style action for your games. So while you might not be able to charge out-right for your game, you can ask for a "donation" and maybe get some beer money...bonus!

If there's anywhere Itch.io seems to lack behind some of the others is in exposure and discoverability. Itch.io is host to thousands upon thousands of games, so you're a small fish in a very big sea. Sure, you should promote your game through every channel you care and drive them to Itch.io but I wouldn't rely on Itch.io to give you the exposure you hoping for. When I released a new game, stats were high for about 48-hours and then died drastically. Feedback and comments from players also seems to be sparse.

.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.

Newgrounds
http://www.newgrounds.com

Pros

  • Good exposure without much effort, player feedback
  • Basic analytics
  • Revenue sharing

Cons

  • Can't customize game pages
  • No donation options
  • Web site feels quite dated

Newgrounds was one I hadn't heard of until recently when someone suggested it on Twitter. I checked it out and found that the web site is far from great to use. It's not difficult, per se, it's just ugly and the experience overall isn't that great. It feels very dated.

Newgrounds seems focused on web playable games, so you won't find the download competition like you have on Itch.io...but Newgrounds is also host to non-game creations as well, such as movies, music and art. They seem to do a nice job of separating and organizing.

The game manager for admins isn't bad either. Itch.io's is nicer and has more features but Newgrounds is still easy to use. You can't customize your page template or anything, so you'll need to get creative with your promotional text.

Newgrounds limits you to 2 game uploads per day, which probably won't be an issue unless you're uploading your back catalog of PICO-8 games like I was and had to spread them out over a couple days...just something to keep in mind. They also don't offer any way for people to pay for your games, but they do offer revenue sharing so you'll get a cut of ads on your game pages. Kinda nice but not sure how much it will yield...probably need a VERY popular game to warrant anything.

Where Newgrounds seems to excel is in good exposure and feedback. After just a few days with my game up on Newgrounds, it has several thousand views and some great feedback from players...far more comments that I ever got on Itch.io, and that's with zero promotion on my side. Newgrounds' base seems to be more active in playing new games which is great. It's hard to say what the longtail is...I haven't had games up for long.

.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.

Konegregate
http://www.kongregate.com

Pros

  • API for scores and achievements
  • ????

Cons

  • Site is ugly; difficult for visitors
  • ????

To be honest, I can't really say anything about Kongregate because I haven't upload any games there.

I find their site a pain to look at and use, and that was enough for me to not use it. If a site isn't easy for me to use then I'm not going to ask others to go there.

I do know that Kongregate offers an API so that you can tap into their system for high scores, achievements and other things, which is a really nice feature, but I haven't tried them with a PICO-8 game yet.

If you have experience using Kongregate, please share your story.

.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.

Where else do you post your games?

As I've learned about game publishing sites, I've found it a real pain to keep up with them. I know it's too much of an ideal to just pick one and go with it...at least if you want as many people as possible to play. But making the rounds to each when I make game updates or changes is exhausting. I'm still trying to come up with a nice system that feels efficient...I'm close but not close enough to not make it feel like a chore.

Please share your own game publishing experiences in this thread so we can build up a good resource for folks looking to get their games in front of people.

P#46172 2017-11-12 00:27 ( Edited 2018-10-27 19:20)

Has anyone successfully changed the app icon for Windows binary exports?


By default, the cartridge label is used as an icon. To specificy an icon from
the sprite sheet, use -i and optionally -s to control the size. For example, to
use a 2x2 sprite starting at index 32 in the spritesheet:

I tried those flags as documented but it doesn't seem to change. Even without trying to use something from the spritesheet, the icon doesn't use the label or anything - it's just the Pico-8 logo.

Not end of the world if it's not working...just trying it out. Maybe a .11 bug? Dunno...

P#45807 2017-11-02 13:53 ( Edited 2017-11-07 17:59)

After several days of trial-and-error and testing with help of Twitter friends, it seems playing Pico-8 games on your smartphone is very do-able and comfortable, with only minor trade-offs.

I've put 3 of my games up for mobile play. Please give them a try on your phone and see what you think.

NOTE: You need to visit these links on your phone. Visiting them on your desktop will just load the game as normal.

I used this template from Dennis Treder as a starting point for the actual web controls that interact with Pico-8. I then customized it a bit to add more control layouts and make it into a "web app" of sorts for phones. On phones you can choose to have a web page behave as a "standalone" app, which basically means it runs in the web browser but hides the back button and all that type of stuff...so it looks like a native app. I'm still cleaning up my modified code but once I have it nice, I'll share it as well.

When you visit any of those game links on your phone, you should see a landing page asking you to add the link to your home screen. When you do that, you'll get an icon on your phone. Launch the game from that icon and the Pico-8 should boot and you can play.

I know it works on iPhones well. Android seems to vary a bit but should be good.

Based on feedback from Twitter testers, the games should work on iPhone and Android phones. They'll probably need to be somewhat modern phones with latest browsers.

The one thing that is known to be wishy washy is the sound. On iPhone Safari, there is no sound at all. On Android Chrome, sound seems to be choppy at best. So your mileage may vary when it comes to sound performance but the game itself should be pretty playable. Not ideal but closer than I've ever seen.

The on-screen controls are pretty ugly but honestly, they work really well with zero lag (that I've seen). One cool thing about that template is it allows for alternate layouts during the game. You'll notice in the games I've posted that you'll get different layouts depending on what part of the game you're in. Pretty spiffy.

This isn't a perfect method of playing Pico-8 games on phones but it's the closest I've ever seen and the closest that I feel okay putting my games out there and asking people to play. Lack of sound is a bummer but I'll take that hit to make my game easily accessible on a phone. I'm also hoping that near-future updates to Pico-8 and browsers will solve the sound problem for us.

I don't have the resources to get Pico-8 games ported over to native apps for phones so they appear in the App Store or whatever. Having a web app work like a native app is the closest I'll probably get...if nothing else, it's a great way to test to see if making your game a true App is worth it.

Please give the games linked above and try them on your phone. Post here about your experience or hit me up on Twitter @morningtoast and share your report.

P#45628 2017-10-30 10:19 ( Edited 2018-07-09 16:25)

Creating web-based controls for Pico-8 games is not a new topic but after just finding a great template, I jumped back into the fray with the idea and need some help testing.

Please visit this link ON YOUR PHONE and see what works. It's my Invader Overload game from last year.

http://www.morningtoast.com/games/invaders

When you land, you should see a page asking you to add it to your phone's home screen. Once you do, you can launch from the icon and it should be a web player with big red buttons for controls.

It's all very ugly right now but I'm just testing to see how much of it works and how well.

On my iPhone 6 with Safari, the game loads and plays just fine with controls but there is no sound. I've had a few others report the same for iPhone and one report that Android doesn't work at all.

Please post with your findings. This feels like the closest I've seen to having Pico-8 be viable on a phone without needing to port things over to an actual app of some sort.

Here's the template I used and modified:
https://github.com/headjump/pico8_html_template

P#45540 2017-10-28 12:11 ( Edited 2017-10-30 03:15)

So apparently I'm an idiot...or at least never read this in the manual (never thought to)

When saving in .png format, the compressed size of the code must be less than 15360 bytes. To find
out the current size of your code, use the INFO command. The compressed size limit is not enforced
for .p8 format. In most cases you don't need to worry about the compressed size, as the token
limit (8192) will be reached first.

Given you can upload carts to the BBS by pasting in code, and exporting to HTML is also a separate process...you can ignore/avoid the compression limit entirely unless you want to pass around the PNG cartridge.

Dammit.

Here I spent a ton of time getting my game under that compress limit when I didn't need to. I was within token/character limits just fine. Arg!

Well...lesson learned...and maybe this call out can help someone else avoid the headache.

P#45189 2017-10-13 22:30 ( Edited 2017-10-15 23:47)

Cart [#46170#] | 2017-11-12 | License: CC4-BY-NC-SA | Embed
20


Dylan Burke is finishing the job his father failed to complete on LV-426. He must be stopped.

Explore planets and collect 12 alien eggs before Burke can get to them.

Sound and headphones are recommended for the best experience

.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.

Player manual. Complete with hints and tips!
http://slides.com/morningtoast/alien-harvest-manual#/

Browser gamepad support is availble through Itch.io:
http://morningtoast.itch.io/alien-harvest

Keyboard controls

  • Arrows, Move character
  • Z, Map / Continue
  • X, Use weapon

.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.

.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.

What people are saying...

"I nearly jumped outta my seat when it chased me..." - @Liquidream

"Yeah, headphones are a must" - @enargy

"Hats off to you for bringing that element into your games. Brilliant." - @beetleinthebox

"The game is cool!" - @pineconegraphic

"That's some cute manual action!" - @rtrntospielburg

"You’ve found a really nice style in this one." - @johanpeitz

"Are you still making that damn game?" - @barneysangels

.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.

This game has been a long time coming. I started it back in June and worked on it for about a month. Then I hit a wall and got distracted by other stuff...it sat on the shelf. I came back to it after a couple months and finally finished it up. Very happy I did.

The idea got seeded when I read an article in Retro Gamer about the Sega SG-1000 and the game "Girl's Garden". In it you're a girl that has to collect flowers while avoiding bears to keep her boyfriend happy. Somehow that got me thinking about applying that model to an Aliens motif...and I had just so happened to find a spritesheet rip of Rebelstar from the ZX Spectrum that had alien characters in it. I took those and started designing around that.

Prior to this, most of my Pico-8 games have been arcade shooters, so making a maze/map game was new to me (especially one with a story). It was nice to try something different and I learned a lot. I'm not sure I'll try to make another one...while rewarding, this experience was exhausting. I'll just have to spread out my efforts when it comes to this genre.

What I think made the most difference with this game was that I came back to it after some time away. It felt good coming back to something that was a) half done and b) still familiar enough code to dive back into without a lot of re-learning. Plus I could look at it with fresh eyes to determine if it was worth finishing. It held up well and I was motivated to get it done.

But man...the last 10% of development is killer. For one, I hadn't quite figured out the last act and then when I did, Pico-8 compression limits came around and tried to crush my dreams. To combat that, I simply started over...kinda. I opened a blank cart and copied over code chunks one-by-one, inspecting and refactoring each one as I went. I had to trim some design fat but in the end that had little impact on the gameplay and that's what matters. All that effort paid off and I got in under the limits with a solid game.

Since this game has an actual ending, I kept playing and I kept failing to win. Usually that's a sign of the balance being off but this time it was just a good solid challenge. By design or by luck, the game trade-offs worked out wonderfully. The game isn't easy but not too difficult. It never feels overly unfair and has some wonderful emotional impact as well. Even with insider knowledge, it took me quite a while to win but only after plenty of "just one more time" moments.

Thanks to everyone that helped along the way, whether on Twitter on here in the forum...all of it made a difference.

Please see the manual for more credits, acknowledgements and original source material

Super thanks to @pineconegraphic for the character animations
Awesome thanks to @gnarcade_vgm for the original music

Some lessons learned:

  • Use shorter variable names
  • Using the pair() loop is better than the all() loop
  • Large arrays are bad
  • Story text is troublesome, as are long strings in general
  • Code comments seem to count toward compression limits, remove them
  • I need to figure out how to get more use out of tile maps
  • I need to learn more about memory functions
  • Pathfinding is difficult and taxing
  • Aliens chasing you is terrifying, even when they're 16x16 sprites

Please report any crashes you experience.

If you have any questions about how this game was made or what was used, please don't hesitate to ask.

P#45162 2017-10-12 21:46 ( Edited 2018-02-17 05:21)

I think some variant of this has been discussed before but if I recall it turned into a debate about the lack of being able to customize the keyboard controls in Pico-8.

Please don't debate that here...go find that thread :)

I'm interested in hearing thoughts on whether you think it's a better "standard" to label controls in your game as the letter - like Z, X - or to label them as the special characters (X),(O).

While I personally prefer the aesthetics of the icons, I do know it is difficult to know which button is which on your gamepad when doing that. I used the icons on the game I'm making now and when had people play, confusion followed, so I changed it to letters.

Plus, after some very limited polling on Twitter, most play Pico-8 games with their keyboard...so that tells me that labeling controls with keyboard letters is more helpful across the board. Thought being if you want to use a gamepad you'll a) figure it out, or b) can map things accordingly. Gamepad=Power user, of sorts.

Hmmm...I might have just answered my own question...helps to say it out loud, I guess. But I'd still be interested in hearing thoughts/experiences.

P#45055 2017-10-10 11:13 ( Edited 2017-10-13 02:10)

I'm using stat(1) to see what type of CPU usage my game is using and in certain spots it's a lot, sometimes hitting 100% and causing some serious jitters.

When that started happening, I went back through my code and did some refactoring of things...removing dupe code, nesting conditions, removing methods, limiting loops per tick...and that helped.

I'm not so dumb as to not realize that bloated code will impact CPU usage, but what else increases that usage?

Maybe that's a big question...I dunno, I'm looking for a somewhat high level answer, I guess. Just general "things to pay attention to" kind of stuff.

I'm not using any fancy techniques like poke/peek or memory storage or anything like that. Very straight forward coding. I don't feel like my game(s) are very complex or doing a whole lot, which tells me I'm probably missing something in managing overhead.

P#44717 2017-09-28 15:43 ( Edited 2017-10-06 21:20)

I've been rebuilding/refactoring a recent game in efforts to reduce clutter and increase performance, as well as get under the dreaded compression limit.

For whatever reason, I've started to nest functions...mostly as a way to better organize code. This works just fine but I'm wondering if there's any real downside to it?

I've been nesting functions that are relative only to code of the parent function, so as to reduce some code. Usually some math or condition checking or something...

As of yet, it doesn't seem to impact on my games at all. Just wondering...

function myParent()
  function myNested()
    ...often repeated task code...
  end

  if Something then myNested() end
  if Something and SomethingElse then myNested() end

  ...you get the idea...
end

myParent()
P#44641 2017-09-26 15:12 ( Edited 2017-09-27 05:51)

Cart [#44332#] | 2017-09-19 | License: CC4-BY-NC-SA | Embed
17

New York City is being overrun by ghosts! Who you gonna call?

Take control of your favorite Ghostbuster and try to stop the onslaught of Slimers through 5 frantic levels of arcade action. Choose from Abby, Erin, Patty and Holtzmann. And if you're good enough, you might just unlock a few of your old Ghostbuster friends too. Good luck!

Keyboard controls:

  • Use Z to fire your proton beam
  • Use X to throw a trap
  • Up/Down arrows switch levels

Stop the Slimers from reaching the city. Use your proton beam to bust ghosts and destroy the mirror portals. Your slime meter will fill as ghosts get by you. If your slime meter gets full, it's game over. And watch out...you don't want your proton pack to overheat!

You have unlimitd traps but can only throw one trap at a time, so manage your need wisely. And keep an eye out for the Stay Puft marshmallow man...it means the city is almost filled with slime.

=====

About this game:
My 5-year-old daughter loves Ghostbusters and while she's not really into video games just yet, I decided to make her a Ghostbusters game to maybe nudge her along a little bit. She's seen all the movies but likes the new Ghostbusters the most, so this game features the lady Ghostbusters...but don't worry, you can unlock Peter and the gang...just keep bustin'!

All in all, it's a simple game...basically Tapper with Ghostbusters. It's not that difficult but I pretty much made with my kid in mind. It'll be a tough challenge for her but for us "experienced" gamers it'll be a fun but brief playthrough.

Feedback and bug reports are welcome and encouraged. Thanks to everyone that helped in development. Brian Follick for turning the Ghostbusters theme into a Pico-8 track. @BeetleInTheBox for the extra graphics in short notice. And the great Pico-8 community for the support, snippets and encouragement to actually finish a game...thanks!

P#44296 2017-09-17 21:39 ( Edited 2017-10-28 16:04)

I'm not surprised that I'm hitting the "out of memory" error when I put a big table of coordinates into the global scope...I'm figuring out how to deal with that right now. My question is why does it take up so much memory in the first place?

I created a table with indexes for x/y coordinates, which in turn correspond to objects in the game.

My map is made up of 16x16 tiles, so 8 per screen. When I have a 7x7 map, that's 3136 slots in the table containing tile information. That's a lot, I know. Each table element has attributes for the tile. When there are 8 attributes in the object, Pico8 shows memory at 70% - adding just one more key-value pair takes me over the limit.

How does adding a single pair take up 30% more memory?

level_grid={}
map=7
for x=1,map*8 do
    level_grid[x]={}

    for y=1,map*8 do
        level_grid[x][y]={
            tx=x,ty=y,n=0,f=0,g=0,h=0,p=0,status=0,
            o=0, -- This pair puts me out of memory. Remove it and we're under.
        }
    end
end

I know that memory is used up by everything so the 70% I'm seeing is not just the array, but it's certainly a big chunk of it. Even after stripping out everything except the array, it's still at 59%.

I'm not good with memory sizes or the math that goes into it or what uses up memory and how. I'm pretty sure I'm just going to have to accept that my game will have to have smaller maps, which is fine, but more so just for my own education, I'm wondering why this happens.

P#41937 2017-06-25 21:11 ( Edited 2017-07-14 14:13)

I'm doing this a lot through my games in loops and I feel like there should be a shorthand for it...?

a-=1
if a<=0 then a=0 end

And similar type of counting, etc...

P#41900 2017-06-23 20:37 ( Edited 2017-06-24 02:13)

I'm making a maze game...I know how to use a tile map but I wanted to have a bigger pool of possible screen (128x128) layouts than the map offers. I'm randomly choosing screen layouts and putting them together.

My solution to this was to create 8x8 sprites that then get translated into a table of wall objects. I then loop over that table to draw the maze walls. Nothing too fancy here...checking pixel color, etc.

And this works great up until a point...that point being once player objects and AI objects starting moving around and need to check for wall collisions, etc. It doesn't take long for things to start slowing down once there are 100+ wall objects to loop through per actor.

So given I don't want to use maps outright yet maps are more efficient processing-wise...is there a way to create a map on the fly? Using coordinates that are derived from the sprite.

There doesn't seem to be a vanilla way to do this (which doesn't surprise me), and I hate looking for hacks to get it done, but thought it was an interesting enough question to ask. It might just be a case where I want Pico-8 to do something it's not really suited to do (at least in the manner I'm doing it and I just need to accept Pico-8 limits).

P#41826 2017-06-20 22:21 ( Edited 2017-06-21 19:01)

Anyone have any links, examples or insight on how to make an object move towards a target while also going around obstacles (walls) when they hit them?

Say object A needs to get to object B (which is static). I can calculate the direction A needs to move, that's easy to get and make it move in that direction. But when it hits a wall on the way there, I'm not sure how to have it move around that wall.

I'm not necessarily interested in the shortest path, I just need A to get to B and have it be efficient enough for Pico8 to crunch it for several objects.

I'm aware that this will result in Gauntlet-style movement from the A objects around walls and such, which is fine.

P#41812 2017-06-20 15:20 ( Edited 2017-09-08 14:48)

I have a several 8x8 boxes on the screen.
I have a line from a/b to c/d.

I need to find out the line intersects with the boxes.

How I'm doing that right now is by using some line intersection formula I found to check if the line passes through each segment side of each box. So for each box, checking 4 sides for intersection. This works but I'm finding it's dreadfully inefficient once you get many boxes on the screen.

Hoping someone has a snippet or can at least point me in a direction of what to explore.

I've done a little searching and see something about Bresenham's algorithm but I don't have the brain power to translate it into Pico-8 in a manner that spits out a true/false for a given 8x8 box.

Currently, I'm checking each box, which could be up to 100 or more. I'd like to think there's a way to avoid having to loop through all 100 and compare, but maybe not.

Any help is appreciated.

P#41604 2017-06-14 10:39 ( Edited 2017-06-16 00:39)

View Older Posts
X
About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2018-12-11 06:34 | 0.214s | 4194k | Q:78