Took a break from the falling sand simulation blog posts this week to work on another small project. It's a little pixel world generator- each time you visit, you'll see a new little world. I really like this stuff and had a blast building it yesterday!
Nice one, I like the coloring, it'd be nice if it was dynamic or things could live on it, maybe next step? I have a few random for fun projects lying around:
Do you mind if I dig into the code and figure out how it works?
I'm really finding the market that you've got going interesting, how in-depth is it?
I've got a thing[0] I've been prototyping which does a market simulation that I'm working on and I'd be curious how far you've gone down that rabbit hole? =)...
The simple model consist of buy and sell orders, buys come with a max price, sell comes with a min price, both come with quantities.
Just have to meet in the middle by dynamically accumulating orders by quantity from both sides and after the prices met, set that as the actual sell price and discard the rest of the order as not filled.
Really cool stuff. I kept refreshing and it took me back to the days of all those ZZT games but this evokes much more geography. Crazy what you can do with ASCII characters and 256 colors.
I've been playing around with something similar recently and I'd encourage you to look into doing this with pure webgl rather than p5.js. It's surprisingly simple (this would just be a `gl.drawArrays(gl.POINTS,...)` call it with some buffer setup and texture `texelFetch` reading) and freeing and empowering to work from the groud up without frameworks. It's also really nice to offload player offset and zoom to the gpu/shaders (it handles it really smoothly and with basically more straightforward than you'd have to do to only draw things that's on the screen with canvas rendering).
Great idea. This would be dramatically lighter weight in terms of client download and more performant. I believe color variation logic could also be offloaded to a fragment shader.
I had a lot of fun drawing instantly without a library, but p5js has so many great things that are easy to forget.
Between noise, color conversions, prebuilt draw loop, event handling and working with images…
It’s not so easy to give it up for quick projects.
Suddenly 10 minutes in p5js is an hour or very difficult without a replacement library (noise) and focusing on boilerplate instead of the interesting bits
I totally get this argument. The only counter argument I'd put forward is that once you've set up that boilerplace once (which you've now figured out), abstracting that into a little library file of your own that you understand isn't too much work (and easy to extend in the future). Another argument is that learning raw webgl and getting comfortable with it (which repeated boilerplate setup and general comfort with all the API calls creates with long term use) is likely learning that will transfer over to future projects more than mastery of p5 in particular would.
I'm mostly saying this as if talking to an earlier version of myself since I spent a lot of time learning threejs when I in hindsight now realize doing it with raw webgl (while building up a little boilerplate abstraction library and generally gaining comfort with the API) might have been a better use of time (especially long term). Kinda depends on what you overall goals are though too (and how eager you are to make the idea you have come into reality) etc etc.
Refreshing the page for more worlds reminded me - at some point someone recommended this[1] Chrome extension to me and it's been neat to have a new satellite view of earth show up every time I open a new tab
Really cool, I did something similar for a university project where I had to implement a Minecraft clone. I don’t remember all the details, but I used multiple, differently scaled Perlin noise “textures”, a 2D one was responsible for the surface terrain (which determined the type of the upper n percentage of blocks there), another 2D managed the height at each block column (with some interaction with the terrain texture’s value?), and a 3D one was responsible for caves under the surface. It was my first try at anything similar and a surprisingly easy code generated surprisingly good results.
It should date me fairly well to know that I'm familiar with Temple of Apshai, but only because of the other reference. "Man... I throwed up all over this maze."
Been working on a similar thing recently, but this looks fantastic
It looks like you're using some kind of perlin noise, one idea I had (probably been done a million times before) is rather than using the "height" of the noise to decide on a tile, you could have it decide on a biome, which itself has a list of tile types with a weighted random choice of which one it picks; so you're forest areas can still be populated with grass for example, but tree's are more common.
If possible could you include a license? I don't like touching code without one, as sharing modifications and/or derivatives is a potential copyright violation.
Nothing so creative / complex! You can check out the source code, I didn't obfuscate it. It's just hand-picked thresholds for perlin noise, leveraging the built in noise function in p5.js
I found this at a time when I was feeling rather blue. It was fun to come up with stories for each of the maps that I generated. Kept my mind off of things. Thank you.
[Error] SyntaxError: Unexpected token '='. Expected an opening '(' before a method's parameter list.
(anonymous function) (little-worlds:94)
This is what I get on my laptop. Probably don't have to worry too much, I'm generally a hold out when it comes to updating OS versions, so things that expect newer features might not work for me
Thanks for the follow-up. I think Safari 13 doesn't support static vars on classes. I'm not using a bundler or anything. I'll think about how I should approach this in the future.
Not trying to contradict TheRealNGenius, just hoping to put some bounds on what works and what doesn’t. Perhaps there was a fix in Safari 14 that allows this but was broken in 13. I don’t have access to an older Safari to test against.
This looks lovely, well done!