Commit Graph

140 Commits

Author SHA1 Message Date
c752e8e1e3 fix hpcols_init
note that I need to re-call this whenever I have a new max hp

also note that vertmeter does not handle 1024 correctly. find out what max hp functions and hardcap it
2025-06-28 23:10:57 -07:00
507f06fb8c more efficient bullet spawning 2025-06-28 22:59:51 -07:00
14849101dd skip call to sparks if there are no sparks
Then don't check for nil spark colors in sparks itself.

Also uses a more verbose but more efficient exit check, and fixes a bug.
2025-06-28 22:49:10 -07:00
2cd7c64dd9 micro-optimize bullet details
Shots that miss are most likely to not be there yet, so check Y-top first.

If I assume shots will never be larger than 16 pixels per side, there is
no reason to check the ship's genuine width and height.
2025-06-28 22:35:36 -07:00
2d5d392df0 reverse strip logic
saves a single cycle per bullet, but...
2025-06-24 23:16:47 -07:00
904fbe6b2e bullets don't expire 2025-06-24 23:06:09 -07:00
36b268e057 initialization is very slightly faster this way, I think 2025-06-24 22:54:03 -07:00
3d6ef03b37 attempt to optimize collision
it's actually worse
2025-06-24 22:36:58 -07:00
d7e029edb6 profile-guided optimization 2025-06-23 01:37:57 -07:00
5e6b98523b delete linked lists and use optimized array impls.
Also removes "suppress" table from collider, use candidate.dead instead
because the set of dead ships and the set of non-colliding ships is
identical.
2025-06-23 00:47:02 -07:00
67970a5164 add draw/update stat readout
surprisingly, update is most of my problem
2025-06-21 17:50:03 -07:00
eaea42f993 fix shot axis 2025-06-21 17:38:05 -07:00
929f47fc78 bullet microoptimization and velocity fix 2025-06-21 17:36:27 -07:00
430a0a4b14 ship_m:move micro-optimizations 2025-06-21 17:17:44 -07:00
e4062d3ccd back out of fast bullet changes, keep optimizations
in the "nothing but turrets" worst-case scenario, fast bullet logic costs 133% of slow bullet logic even when almost all shots on screen are slow. when I back out of this, that scenario is _still_ over 300% CPU but at least it's not 400%. note that this is with a screen mostly full of enemies, so processing all of them and their potential collisions also has cost, so the actual bullet-specific change is closer to 150%, maybe 200%. this is genuinely not as bad as I had thought but it doesn't feel like it will be workable; while my worst-case scenario is implausibly bad it's not actually 3x-likely-peak bad. so I'm going to need to find more optimizations, and probably give up on fast bullets. But I can keep the fast bullet branch around in case I find the headroom to reintroduce it later.
2025-06-21 17:05:36 -07:00
c9d7437ffe trim up draw costs a bit 2025-06-21 16:40:23 -07:00
d0de757b0e test the worst case scenario for shots
way too slow
2025-06-21 16:36:36 -07:00
a8b5b9dbe6 fast shot rendering prototype
it's slow *and* it sucks, and making it not suck will make it much slower. this is bad
2025-06-21 16:07:23 -07:00
2596f8aa6c I can't spell 2025-06-21 15:13:07 -07:00
ef40c245f8 multi-step shot prototype
nothing reaches this new logic yet, and multiple steps aren't drawn
2025-06-21 15:12:40 -07:00
6d6e13cf3b special case strip(call_move) to stripmove()
this gets called so much the extra function overhead actually seems bad
2025-06-21 14:55:20 -07:00
99323be298 despawn shots aggressively when offscreen
avoids hitting enemies before they spawn in.

may need to revisit this for the X coordinate if I want to implement a "Wild Ball" kind of weapon, but I think I won't have the tokens for that anyway
2025-06-20 19:13:28 -07:00
85c5091804 pbullets also move just before the collision check.
This also sets up for the "fast shots" refactor.
2025-06-20 19:08:58 -07:00
a77180d89a bullet_base:die doesn't actually make sense 2025-06-20 18:55:48 -07:00
c01c3400b7 fix eternal horizontal bullets 2025-06-20 18:51:58 -07:00
0f791b193c more efficient collision iteration, fix eternal shots 2025-06-20 18:50:04 -07:00
d3351d9a05 Use eship_collider for ship collisions, too. 2025-06-20 17:56:57 -07:00
ecddb56d72 loops work better when you increment them 2025-06-20 17:50:03 -07:00
723c0f791c Refactor collider to collaborate with linked_list.
The only use of a collider is intertwined with the ship list, so I can combine the "prepare to yoink" and "populate collider" and "iterate list" steps, and I can combine the "hide" and "yoink" steps. This doesn't save tokens now but it's about to, when I use the eship collider to test pship collision.
2025-06-20 17:48:02 -07:00
e018578754 keep animating bullets while dead 2025-06-20 16:36:18 -07:00
bf8297eb72 prevify eships when setting up collider
I will refactor this next: collider.new will take the linked list to ingest, perform the `insert` and "prevify" loops itself, then replace `hide` with `yoink`, which yoinks the item out of the original list. This pairs the `yoink` operation with the context that makes it possible to do (that is, the context when prevification was implemented); eships therefore cannot be edited in complex ways while the collider is still valid, but we can append to it as long as we don't expect those items to be procesesd correctly this frame. a new_eships+vore plan might be better if we turn out to need it, but presently we don't; flotilla spawning and raider spawning happen at a different point.
2025-06-20 16:31:18 -07:00
1c8bcae44c put ebullet moves inside the collision check loop 2025-06-20 16:01:59 -07:00
325d7444e7 invert eship/pbullet collision
Also mildly trims up linked_list impl.
2025-06-20 15:09:18 -07:00
85d28ae28b get rid of pships
lots of things rely on exactly one primary ship now, so this was just
overhead and wasted tokens / cspace.
2025-06-01 17:55:46 -07:00
c514c61b3a look at me. *look at me.* I'm the gun_base now 2025-06-01 17:41:07 -07:00
9be828dd5c blast gun is a trig gun
now there are no more base guns
2025-06-01 17:38:45 -07:00
2b51a3472b protron trig gun 2025-06-01 17:36:15 -07:00
95ea70baae vulcan_gun as trig gun
causes x offset to reverse for negative aim; may need to be careful
with how I make aiming guns actually work, but this should work for
deriving player guns from enemy guns (by using negative aim)!
2025-06-01 17:26:29 -07:00
b18b4f885d trig zap gun; fixes
use the trig gun for the zap gun
2025-06-01 17:00:28 -07:00
2fdb8d1a05 trigenometry gun prototype 2025-06-01 16:48:39 -07:00
fc1f84fa28 Delete slip behavior 2025-06-01 16:15:46 -07:00
93b63a5831 Prevent new calls that won't work as expected 2025-06-01 16:11:35 -07:00
297e6e4996 implement clip reload time
two tiers of cooldowns, pretty much
2025-06-01 15:55:11 -07:00
9b3120c47b rewrite mknew to inherit fields before init
I am horrified to admit that C++'s constructor static initialization
list syntax abruptly makes sense to me and I understand the problem
it is trying to solve
2025-06-01 15:53:50 -07:00
abee6d1206 fix skirmisher sparks 2025-05-31 23:44:36 -07:00
3151db5430 fix precedence error 2025-05-31 22:27:03 -07:00
2964159858 fix offset, try but fail to fix variants 2025-05-31 22:19:35 -07:00
95d4b6eb37 what the hell was I thinking when I wrote this 2025-05-31 22:06:48 -07:00
96312e3adf fix offset bugs 2025-05-31 22:05:47 -07:00
bf9a45d87e fix gframe unit 2025-05-31 21:55:21 -07:00