Game
Space Cadet Bert
9 years ago

v0.0.2 - Introducing basic enemy spaceships


Space Cadet v0.0.2 Now Available.

Hi everyone,

Today sees the release of v0.0.2 of Space Cadet Bert. I’ve added the basics of enemy ships flying around the asteroid belt.

The first attempt at some asteroid avoidance was using GameMaker’s built-in potential_step function. I was not happy with the results. The potential_step function works fine for the blobs on the asteroids edging around the stationary rocks but that behaviour doesn’t look good for spaceships avoiding moving rocks. As I haven’t spent much time with potential_step I am planning to look at some tutorials and see if anyone has attempted anything similar to what I want to achieve.

Another method of obstacle avoidance I have seen is using a force field or vector field. The basic principle is to have an “anti-gravity” force for each spacerock. Instead of attracting objects as gravity would, the hazard exerts a repelling force on the object, deflecting the object to the side. As the spaceship approaches the spacerock the force increases, preventing a collision. This should give the appearance of the spaceship steering away from the spacerock.

Here’s an article I found interesting

I also had a look at the Inverse Square Law and Newton’s Law of Universal Gravitation for a quick physics refresher.

After making a few notes, I created a new object and wrote some code. For the first attempt I settled on a simple formula which gives a linearly increasing force once the spacerock crosses the detection threshold. The force direction is directly outwards from the spacerock.

Here’s the important line of code:

RockForce = (EnMaxSpeed) * (1 - (RockDist / DetectRange));

For a simple model, the results are good.
Here is a video showing how things run at the moment

For future development I am going to try some other methods of calculating the force. An alternative is to use a constant force but calculate the direction more effectively. This would mean when heading directly towards a spacerock, the force is fully to the side, and when the spaceship is already to the side, the force acts in the same direction as the spaceship movement. Of course, I may find something useful using the GameMaker motion planning functions.



0 comments

Loading...

Next up

Bandana Dee the Dream Friend

🍒Did you like the game? A demo is available for free on Steam.

✌️ Thanks for playing IndieGameiacs!

⚙️ Free Demo: http://bit.ly/UniDuni

📺 Full Video: https://youtu.be/5qEbVXg7GaQ

#steam #uniduni #clops #screenshotsaturday

Terraria

"Day to Day" (also check spud out here he's a great guy and writer: https://soundcloud.com/spudward)

Levels' maps.

Cash Banooca

Coming Soon...

OK, this starts to be too tricky puzzle already :D

#platformer #indiegame #puzzle

Respect (Only TLOZ Players Will Understand)

Daldos Gameplay