Game
Gunship Souls
11 years ago

Day One: look at all the stars!


Hi

24 hours into my #indievspewdiepie game. I’ve got circles that shoot bullets at you, a circle that is you, and a nice red reticle. The circles are generated by a (currently invisible) mother ship. The art is all just drawing primitives, and I think I will probably keep it that way for the jam.

I worked super hard on the infinite starfield. It probably took, like 4 hours or something stupid. I went off of a helpful article, but encountered many tricky tricks along the way.

The technique, basically, is to imagine an infinite square lattice. Each lattice point is indexed uniquely by a point in Z^2 — such as -2, 7. When you draw the screen, you first ask which lattice point will be in the upper left corner of the drawable space (maybe a little off the screen), and then iterate over enough lattice points to paint the whole screen.

Now the interesting part is the stars, of course: each lattice square has an index, as I mentioned. Pass the lattice square’s unique integer coords and a seed into a hashing function, and you will get a big ol’ 32 bit integer that is guaranteed to be unique for each lattice square. Use that 32 bit integer to choose the positions for a couple of stars (relative to the top left corner of the lattice) and you are good to go.

What is super duper cool about this is that, if the player leaves and returns to the same part of space, they will see all the same stars! So you’ve basically got an infinite expanse of randomly generated stars that never change or get lost or regenerated. Layer them for paralax if you care to! (I did, but you can’t see that from the screen shots)

Depending on how I feel, I might further customize it so that the stars closer are actually more pixellated. I kind of think that, since the rest of the game’s art will be rough edged geometry, the stars should fit the mold.

Finally, here is a link to the original article, and here is a link to a gist with my (lua) implementation. Feel free to offer criticism! I love you!

z.



0 comments

Loading...

Next up

Fixation (2D Array) When life feels like a puzzle-platformer

Soft Chambers A clever human can name the things we've always known in our hearts in a way that makes them new again.

skipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskipskip TL;DR Think before skipping skippable text in games.

Outer Space 15 Drift alone, in the void of space.

A Pretty Odd Bunny A stealth game about navigating social pressures.

I was bored, so... ManutKat.

Family band complete!

The Darkside Detective: A Fumble in the Dark is out TODAY! 🖱️Advanced pointing, clicking action 🖨️Very funny words! Loads of them! 👻6 sarcastic, spectral cases to solve

A house I've built a while ago. :)

It nicely separates the snowy biome from the grassy one.

It's built with painted Ebonstone.

Spaaaace~

These are background sprites I've created for a game I'm working on at school ^w^ Click on the post to see how the sprites connect. You won't regret it! (personally, I think it's pretty heheh)

Drawn in Piskel using my mouse. Whaddya think?