Game
Gunship Souls
10 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

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

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

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

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

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

Smile! Here, take some happy pills! ✨💊 #Blender #3DModelling #3DArt Buy me a Ko-fi: https://ko-fi.com/barbarafb_

Today I was setting up the location of the first boss. His name is "Father" and he is the first of the Patagonians. His task is to guard the road to the House.🛡🗡 Bookmark pre-launch page🔖🔖🔖

https://www.kickstarter.com/projects/rdvindiegame/the-patagonian…

Quantum precognition is one of the most powerful cards. End game cards & equipment. Demo/alpha build boss is no match for this deck.

Werehog transformation process. #sonicunleashed

Strange Umbrella