Pages

Saturday, July 30, 2016

Absolutely Beautiful Multiplayer Building and Deletion!

This particular update on Fragile is very exciting. There are several key updates:
  • I discovered a way to determine a pixel's game world position in the pixel shader, as well as a way to produce pseudo-random values and therefore random noise in the shader code as well!

    What does that lead to? First and foremost, a way to construct very, very beautiful looking buildings, each with a unique look to them as well! Secondly, it dissolves me of the need to utilize any textures or texture coding, for the time being. Lastly, it opens the door to more easily creating all sorts of neat effects in the future, such as blurring, fire, water, lightning, shining, etc.! (I will also be able to animate these effects if desired.)

    I also discovered a really cool website while looking for shader code to help me calculate pseudo-random numbers, which is basically a sort of open-source GPU-shader-code testing, development, and sharing website: https://www.shadertoy.com
  • I added memory structures to efficiently detect collisions and use the spiral that I recently created to move the builder unit when it builds on top of itself. This is important because it will allow for efficient calculations for other things like path finding, auto-attacking, area of effect (AoE) actions, etc. in the near future.
  • I finished adding building capabilities for players and building deletion (left double-click for now).
  • I fixed several glitches with drawing, alpha, etc. and improved unit movement and targeting.

Lastly, before we get to the demo, please note that Fragile is still in desperate need of path finding. You'll notice that when even the slightest bit of a corner is in the way of the unit, it will immediately stop moving. This demonstrates both my excellent collision detection code and the frailty of the game's playability until path finding is added in soon.

Here is the beautiful demo, followed by several pictures. Forty fourth step complete:


Next up: path finding, building animation, attacking, health, etc.!

Friday, July 15, 2016

Generated a gridded spiral for repositioning!

When a player builds on top of itself, it needs automatically jump (teleport) to the nearest adjacent spot in the game. There are various solutions to this problem, but I chose to create a gridded spiral to solve it, which is kind of a unique solution but should be more time-efficient.

What happens is, I create and store something like a gridded Archimedean spiral with unique points when the game starts. Then, when a player builds on top of itself, the game runs through this spiral (in an outward fashion) and checks each space until it finds an empty one.

Forty third step complete (orange lines drawn in Paint for illustration):
 Here is what the spiral algorithm would generate if I spaced it out 3 times (not using this one):

I'm in the middle of adding more features in regards to building and moving, so more progress updates on that coming soon!