Side Scrolling Shooter Challenge - Monsters and Tractor Beam

Published April 11, 2019
Advertisement

 

Spatial partitioning for Pooling

After spending many hours debugging my old spatial partitioning scheme, I decided it was too clever for its own good. I had been attempting to keep objects sorted in x order, so as to decide when to activate / deactivate pooled objects. However the problem is that objects have varying widths, which makes things more complex, I was needing a sorted x list for both minimum and maximum x values, which was difficult to debug in gdscript.

So I decided to try out the old faithful grid partitioning scheme, although simply in 1 dimension for this game. As objects are activated and deactivated they are removed and inserted into the grid. Searching for new ones to activate then becomes simply iterating through a small range of the grid.

There is still a little bit of tweaking to be done, especially for wide objects like platforms. These might be 'missed' for activation as their centre may be in a grid square off the screen. There are two obvious workarounds for this - I can extend the range checked further (which will entail a little unneeded extra processing for the narrow objects), or I can place the wide static objects into more than one gridsquare. But this is quite easy to fix.

Monsters

There are now 4 different monsters (might be enemy spaceships, don't know yet). They will have their own behaviour. I'm just reusing some models from my frogger game for now. They tend to more get in the way of your progress at the moment rather than attack you! :)

Tractor Beam

My first step to allowing you to interact with the environment is the tractor beam, which you can activate by pressing space. It was actually really simple to implement.

tractor.png.d612a1a5068f1af7ade0d473ee07d4e7.png

In Godot I made an 'Area' underneath the player, and in the area you can give it modified physics when switched on. So I simply changed gravity inside the tractor beam.

There are various other improvements too, to the UI and sound etc.

Physics

Almost by accident the physics features have turned out very cool. You can pick up boxes etc and unblock / block routes, which I might use as part of the gameplay. The enemies do tend to get in the way physics wise too, which I'm not sure yet whether is good or bad.

There are a couple of snags with the physics too. One is that sometimes you can get stuck. This is a common problem with physics. I'll probably do something like leave a trail of breadcrumbs behind you, and if it detects you getting stuck, reverts to one of the previous positions.

The other problem is more a game / level design issue. It is quite possible to get into situations where boxes are blocking off your way through the level. I can either have some complicated logic in the level generator (I'm planning on auto generating levels), or I can have some way to remove them, such as shooting them or have the tractor beam work sideways.

2 likes 4 comments

Comments

NubDevice

The difficult part for me is moving forward with something fun. It's easy enough to toss a mechanic together but fun is elusive. Starting with physics is nice because it pumps up the fun level to eleven but now new ideas seem pale compared. I moved to menu and game state to take my mind off of lack of meaty goodness. I need to set aside a full week for sound. The framework I'm using empty in that department. From scratch has its drawbacks....Looking good. you sure you got enough fuel there :D Definitely in the top three best gags. 

April 11, 2019 12:23 PM
lawnjelly

Yeah, definitely getting something fun is hard to put a finger on. I'm just planning on adding as many features as possible and tweak them until it is most fun in my eyes, I'm not going to worry about it too much. I'd rather complete something that isn't fun, than spend days deliberating and *not complete* something that is fun. :D 

Physics I have a love / hate relationship with. I get the impression players love physics because it enables them so much freedom to try things designers didn't think of. On the other hand that can make it a testing / design nightmare.

Making your framework will be well worth it. Even though I'm using an engine, I've definitely benefited from having made a reusable framework through my frogger, boating and chess game.

April 11, 2019 12:51 PM
Rutin

?

April 11, 2019 12:53 PM
NubDevice
4 hours ago, lawnjelly said:

Physics I have a love / hate relationship with

I go this route right away because I feel it takes a lot of burden off. Instead of telling it what to do the whole way, you just place it, give it a push and let it go do it's thing. Instant believable action. Want it to do something weird? no prob, turn it off. You in this one root? jelly is killing it over here. :) gotta' go... 

April 11, 2019 05:31 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement