more enemies wtf



So this week, we have two more units. I could probably spend months just adding new content like this. Difficult to say how much is enough, or how much the game will be able to handle in its finished state, given my totally unoptimized code. I take daily notes, which I'll try to condense here.



PO-PO

Piiigs in spaaaaace! First new unit that took up most of the week was adding police patrol cars. Can't have space without space police.

Here's some additional video of them from earlier in the week:



It uses a unique faction type and pretty much all of the rebel fighter's code except that it obviously targets different objects. Despite being allied with the company units, I just have a hunch that it's a good idea to classify these guys under a separate faction. That creates a bit of extra work, because now I have to add collision and targeting data to most of the other objects in the game so it will apply to them. If I add an object with a preexisting parent, all of that stuff just works out of the box with no extra lines of code, which is wonderful. But in preparation for future complexity, I'm adding a new parent object for this particular enemy.

They only turn hostile to an instance that attacks someone, otherwise they just fly around. However, they will never aggro on company ships (because corruption). And they will flee from any monsters in the area (because cowardice).

Most exciting thing to me here is that this is the first time I've tried using any transparency in a sprite.

This lets me add some glow to the sirens and headlights. Honestly, it is a little inconsistent with the rest of the 'art' style, but I can't have a hover police car without glowing headlights. I can already foresee needing to update a lot of the older assets to be on par with the more recent ones at some point.

As mentioned above, I had originally intended for the police to only target ships that shoot someone, but that seemed like it would be difficult to implement. Instead, they will attack everyone that isn't in the police or company factions once they aggro, which seems appropriate. I debated on how to implement this, and ended up just programming it the way I imagined it actually working. When a company object gets hit, they 'call the police'. If there is an officer in range of any ship that is 'calling the police', they will switch to 'use excessive force' mode, which means flipping on their siren and shooting anything they don't like. Target selection works as normal with the added conflicting behavior of moving away from any monsters in the area, so they will still fire at you but will tend to back off more if you're near an enemy that they're afraid of.



Police stations are in the game and functioning more or less the way I want. When the player isn't looking, they will periodically create parked police cars nearby, that just sit there until they aggro or decide to go out on patrol. This can be a bit awkward because there are asteroids everywhere, so you frequently get parked cars just exploding when things hit them. Which makes me wonder why they would park outside when no one else does, and being outside is extremely dangerous. Still, not sure if I want to change it. I also made it so that police cars that get shot can call for backup, essentially in the same way as the company ships. That whole system is weird, because I can't really tell who is asking for help from who, and who is responding. My suspicion is that objects will choose one unit to listen to for instructions and ignore everyone else. But even going on that assumption, it doesn't always work the way I expect. But the general result is close to the behavior I want. Namely, police will attack when shot or when a company ship nearby is attacked, and they tend to assist each other and call for help.

If they do call for help, it is very easy to end up with a whole swarm of them on your tail, and they can be pretty vicious in groups. Although as of now, they will usually attack the nearest target rather than chasing after you. I may change that later on to make it feel more like a pursuit. Or I could have an event trigger that switches their behavior. For instance, a bunch of them could show up at once to try and 'arrest' you.


TUMS

While Jimmy is in the room, he will sometimes call for help from his dad (which he doesn't really need, being an invincible space cat). Mr. Tums will then show up and travel horizontally across the room in his flying saucer, blasting anything that moves along the way. I gave him a beam cannon that does an absurd amount of damage. Like every unit, he doesn't lead targets, so he still misses faster enemies frequently. I believe he's classed as part of the rebel faction, so enemies will attack him. They don't realize that I gave him 10 billion HP and no destruction code. He will also periodically drop powerups, which gives the player another reason to seek him out when he shows up.

Looks a bit weird when scaled up, better in-game for once

He has blue eyes for now, like Jimmy did as a kitten. Honestly can't remember his eye color. May have to look at a photo. Though you can barely tell when the image is the correct size.

I need to fix an issue with his shots getting stuck on blocks. Easiest and best fix is probably to make it so he doesn't fire while colliding with a block. He doesn't have bounce or path-finding code, since he's just supposed to travel in a straight line. I should also make it possible to hail him, which is something I didn't think of until just now.


ITCH.IO PAGE

Something I was hoping to get to this weekend was setting up an itch.io page, just to allow access to testers. There's still a lot of work left to do, but I don't see any reason to wait on that. So that may be a task for this week. This will hopefully serve as a more visible place for the devlog updates, too. Not sure what I'm going to do about images for the page, though. Even trying to take a screenshot that isn't hideous is difficult, and I'm not sure I'm up to creating promo art.

In prep for testing, I tried to make a couple of things more usable than before. Escape used to quit the game immediately, which is an extremely annoying feature to leave in your game for players, as it's far too easy to hit it by reflex when you just want to pause. So Escape is now pause and unpause, and Q exits only when paused. Added a cheat: pressing Enter sets your health to 5000. By default, you only have 20 HP, which is enough to take one or two hits before dying, and there's no way to get more.


NOTES TO ME

Just a note for future reference: there seem to be some collisions happening with objects that aren't visible. Could be a problem with some collision boxes, or an actual object that is not showing up or spawning at the wrong time. No idea what's causing it. Another possibility is the collision code itself might be pointing to the wrong coordinates. Though I haven't noticed any objects not responding correctly to actual collisions. 

Disabled the code that creates new asteroids at the edge of the room. I already have newer code that creates some inside the room, and this older code seems to be responsible for some janky stuff that will look like a bug to the player. As a result, the room is more sparsely populated with asteroids than before, which is probably a good thing. Things are starting to get crowded with all of these new objects. Currently, most of the smaller asteroids that show up are just the result of a larger asteroid being destroyed, so I will probably add in some new creation code for the smaller ones later on.

Note related to above, spawning instances inside the room should be updated to test the coordinates in a radius before creating the object. Especially once there are a lot of stations crowding the room, I have a suspicion that creating an asteroid on top of them results in a lot of collisions happening at once, which probably slows the game down. The police station is the first object where I've used code that actually tests a location before creating an object, so I can probably use something similar to that. 


NEXT

So I think next week, we'll focus on getting a functional itch.io page, and maybe some of the additional ambient effects that I wanted to add. Should definitely move away from adding new unit types for a while. 









Comments