PAC-like Creeper Template

Started by Degritone, July 07, 2018, 06:12:37 AM

Previous topic - Next topic

Degritone

This probably won't get as much attention as PAC and Sleeper, or maybe none at all, but I made a script that gives the Creeper the same extra tools that the player gets in PAC maps, so here's a template for making that.

What it does
In case you haven't played a PAC map, the creeper starts as a single emitter and grows by laying down digitalis on creeper with a depth above one. Once digitalis has grown on top of a power zone, it places either an emitter or a spore tower, though is will almost always prefer an emitter, slowly replacing emitters with spore towers if it finds itself stuck behind void, a super turret, a shield, etc. for more than 10 seconds, and slowly replacing spore towers with emitters if it hasn't been stuck for the last 10 seconds.

Emitters can assist each other, turning themselves off, but increasing the effects of the emitter closest to the player. Emitters can either be in burst mode or constant mode. It will automatically switch to burst mode when there's less than 1 creeper below it. In burst mode, it releases a set amount every few seconds, which is lowered for every emitter assisting it. In constant mode, it releases an amount of creeper, which is increased for every emitter assisting it, every few frames.

It also determines targets on its own. I currently don't have priority setting variables, but I could add them if it seems important to other people. It currently targets nullifiers > shields > power zones > beams > relays > collectors > berthas > all other weapons > all other player units. But, again, if it seems important to other people to have this be customizable, I can add setting variables for every unit it cares to target.

Additionally, it can create a field to push creeper toward the current target. Currently, it creates a field starting at the nearest emitter and going a certain length toward the current target. This field has a power determined by the amount of totems that digitalis has grown under.

Settings
The current settings are as follows:
fileName You only need to change this if you change the file name of the .crpl script. It should always equal the name of the script file.
emitterFirstx The X position of the first emitter.
emitterFirsty The Y position of the first emitter.
emitterBurstAmt The amount an emitter produces when in burst mode. Uses float creeper.
emitterBurstInterval The amount of frames between each production of creeper while in burst mode.
emitterConstantAmt The amount an emitter produces when in constant mode for every emitter on the map. Uses float creeper.
emitterConstantInterval The amount of frames between each production of creeper while in constant mode.
sporeTowerPayload The amount of creeper in each spore.
sporeTowerInterval The amount frames between each wave of spores.
fieldPower The power each totem gives to the field.
fieldLength The length of the field in map tiles.

And then there's the ones you shouldn't touch.
warning Tells you you shouldn't change the variables below it.
name You can change this if you plan on having multiple starting emitters. This should be "core" for the main CRPLCore, "EMITTER" for CRPLCores over emitters, and "SPORETOWER" for spore towers.
targetx Used to determine various things like spore tower targets and field direction. Changing it won't really do much, since it's set by the script, anyway.
targety Used to determine various things like spore tower targets and field direction. Changing it won't really do much, since it's set by the script, anyway.

Bugs
Somehow, at one point, it put my game into 60 FPS mode but I have never been able to replicate it, so please tell me what was going on when it happened to you if it did.

If you compile scripts while emitters or spore towers placed by the core are on the map, you will have to manually go into every single one and change variables yourself.

If you have more than a total emitters+sporetowers multiplied by player units greater than 60000 (30x2000), it will run into the 1000000 instruction per frame wall every 2 seconds as it attempts to find a target, causing the game to be very, very angry. This number was annoying to achieve, but I wanted to because I did.

For some reason, the creeper will begin behaving odd as you approach the above limit, but it will still be playable.

The spore tower targeting around Beams has some unintended behavior in certain situations. (Working on it)

Changelog
I did a dumb and forgot to make the first emitter placed take the settings. Now it does.

Builder17

It's not bad, I could have a go on these scripts tomorrow. (coding just before bedtime isn't usually good idea)

Do you know what happens after spores shoot there? (Screenshot)

Degritone

#2
I don't know what happens when it does. Probably crashes or some other angry reaction. But, the cause of that is it trying to aim further away from beams so it won't get its spores killed, which doesn't always cause the spores to land, but it at least tries. Looks like I need to go back and fix it.