Commit graph

217 commits

Author SHA1 Message Date
Sally Coolatta
bfecf45110 Use srb2::finally on bot predictions
I'm not sure exactly where the bot code leaks, other than knowing its the prediction for sure (because the prediction is the only memory bots ever allocate), but srb2::finally is cool and lets me not care :)
2023-09-10 03:20:29 -04:00
James R.
172c3861f4 K_SetBot: check spectator status on first round of GP
Fixes map warp to Prisons or Sealed Stars, since these
create a 1-round GP.
2023-09-08 03:24:20 -07:00
toaster
e123ed7480 MAJOR cleanup of Spectator set/unset
- G_AddPlayer now contains CL_ClearPlayer, G_DestroyParty, and playeringame set
- Instead of a nasty, complicated block in P_SpawnPlayer, externalise it into G_SpectatePlayerOnJoin
- All mid-game human player-to-spectator transitions are handled by P_SetPlayerSpectator, instead of lots of `spectator = true` and associated boilerplate
    - Simplifies Got_Teamchange MASSIVELY
        - Of course this is helped by also stripping back team change
    - This is called by P_KillPlayer, too
- P_KillPlayer no longer eats DMG_SPECTATOR when lightsnaking or exiting
- G_GametypeHasSpectators condition tidied
2023-08-26 19:48:20 +01:00
James R
6c0b042eed Refactor cvar definitions completely, move everything to cvars.cpp
- No need to call CV_RegisterVar
- Cvar definitions live in only one file, easier to locate
- Organized into sections -- netvars, cheats, etc.
- Use builder pattern to initialize cvars
- Still need to extern if you want to read the cvar value
2023-08-25 17:22:40 -07:00
Sally Coolatta
54e6efc798 K_AddBot is direct
No longer sends a packet from the server, now all clients do it. Old method is kept just in case.
2023-06-15 12:06:21 -04:00
Sally Coolatta
e6e7056aae Add bot styles & bot spawn ACS function 2023-06-14 09:16:38 -04:00
AJ Martinez
4f11fd783d Don't try bot ringshooter postrace 2023-06-06 19:54:48 -07:00
AJ Martinez
cfa4f9e135 Botcontrol CV_NETVAR|CV_CHEAT 2023-05-30 02:22:59 -07:00
AJ Martinez
bf901f0166 Add DEVELOP cvar "botcontrol" to disable bot actions 2023-05-29 23:49:08 -07:00
Sally Coolatta
2eff6d7fb5 Bots: Make them stay farther from the beam 2023-05-19 06:08:37 -04:00
Sally Coolatta
724beb0ffe Bots: Improve rubberbanding further
- Use easing functions for the rubberbanding values themselves, for more fine-control over the end-points and the curves.
- Fixed K_UpdateRubberband being broken from using shift instead of divide.
- Rename `debugbotpredict` to `debugbots`, it now displays some of the bots' botvars values as well. If the player isn't a bot, it will show them from the first place bot (for inspecting the rubberband value).
- Bot turning buff was increased, from x1.25 to x2.0. Noticed that Tails bots were failing turns on Popcorn Workshop. I personally think that Tails bots shouldn't be failing very many turns unless if they're finding objects, and constant wall-bumping should be reserved for Eggman and Metal :P
2023-05-19 01:00:55 -04:00
Sally Coolatta
5b5323226f Bots: Rebalance rubberband speeds
- Lv.1 has a significanty lower minimum top speed (from 75% -> 50%)
- Lv.MAX has a significantly higher minimum top speed (from 112.5% -> 125%)
- Every bot level has a slightly lower maximum top speed (Lv.1: 100% -> 80%, Lv.MAX: 220% -> 200%)
- Uses easing functions now to make the distance rubberbanding applies to, and the rubberbanding curves, much more customizable.
2023-05-15 23:53:32 -04:00
Sally Coolatta
7d7875d7be Bots: New spindash conditions are more specific
- Uphill check is ignored if you have slope resistance, or if you're moving fast enough to overpower it.
- Offroad check is ignored if it wouldn't slow you down.
- Made slow acceleration check have a higher range.
2023-05-15 06:49:31 -04:00
Sally Coolatta
d55c9038cc Bots: Can now use Ring Shooter
Reuses most of the anti-grief code, but with a very low timer (5sec) and they simply hold Y when reaching it until they eventually respawn from the ring shooter.
2023-05-14 19:32:51 -04:00
Sally Coolatta
34b12cc436 Bots: Improve spindash behaviors further
- Added new spindashing conditions:
   - In offroad.
   - Trying to go up-hill on a steep slope.
   - On a conveyor going the opposite direction they're trying to go. (Barren Badlands)
- Instead of checking for any spindash condition and adding to the confirm timer, it adds to the confirm timer for every single condition.
    - Increased the confirm time from 2sec to 3sec to accommodate for this change.
- Fixed not using precise momentum angle, causing the low-speed scenarios spindash is intended for to not always work.
- Bots now check for spindash conditions even in damage states, allowing for spindashes after a spinout.
- Fixed the spindash confirm not decreasing over time when entering a condition and then exiting it, causing random spindashes when it wouldn't make sense.
2023-05-14 18:26:31 -04:00
Sally Coolatta
5ac7926e39 Prediction nudge is based on original WP radius
Previously based on prediction radius, which meant it was so low that it might barely even nudge at all. Now we try to nudge a lot, but clamp the radius to make it thinner if it goes off-road.
2023-05-13 01:59:07 -04:00
Sally Coolatta
a8af5b7616 Improve general bot handling
- Their waypoint radius gets thinner quicker
- Waypoint distance is scaled with each ones' floor slope, instead of done once at the end of the prediction.
- Prediction is pulled back further when it goes through a wall
- Prediction starts earlier and goes less far
- Bots will brake at shallower angles (allows them to brake-turn more often)
- K_AddDodgeObject and K_AddAttackObject now adjust based on the radius of the object
- Fixed K_AddDodgeObject adding to the goto objects instead of avoid objects
- Optimized blockmap search size for K_FindObjectsForNudging
- Current waypoint is no longer cleared each frame
2023-05-10 22:25:24 -04:00
Sally Coolatta
7d4720b1a6 Fix bot rubberband being different per map scale 2023-05-10 20:28:42 -04:00
toaster
c67412f6ef Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into conditions-cascading 2023-03-11 12:42:55 +00:00
Sally Coolatta
cd2dd1315a Reduce waypoint radius for bots on turns 2023-03-09 03:06:30 -05:00
toaster
d2c36c952a Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into conditions-cascading
# Conflicts:
#	src/k_grandprix.c
#	src/k_grandprix.h
2023-03-07 19:37:46 +00:00
toaster
0c75c40060 Rework how Bots handle their skin availabilities
Before we can add extra unlock features, we need to make sure we're not building on a house of sand.
- R_SkinUsable: Use Net Unlock system if playernum is -1
- R_BotDefaultSkin: Move to r_skins.c, cache skin search
- R_GetSkinAvailabilities: Use Net Unlock when called for bots (and always permit R_BotDefaultSkin)
- Got_AddBot: Call R_GetSkinAvailabilities for summoned bots to guarantee sync status of available skins
- K_UpdateMatchRaceBots: Tidy up to match grand prix bot skin selection system, hiding server-locked skins and defaulting to R_BotDefaultSkin if you don't have enough unlocked for the remaining player slots
2023-03-05 18:06:09 +00:00
Sally Coolatta
35d0cb8eaa Move podium code to its own file 2023-03-03 16:10:05 -05:00
Sally Coolatta
672d69c626 More podium physics tweaks for the new scale
- Normalize turning stats
- More friction
- Less acceleration
- Podium bots will go at a reduced speed when going towards a No Respawn waypoint, so they can calm down a bit before they get on their platform.
2023-03-03 16:10:02 -05:00
Sally Coolatta
2d84837e5b Use ceremony gamestate when warping to podium on startup
Doesn't spawn the bots for some reason still, but I need this for quicker prototyping
2023-03-03 16:09:57 -05:00
Sally Coolatta
f78b3f7794 Fixes for CEREMONY gamestate
- Made titlemap + ceremony code more straight-forward by being able to set gamestate in G_DoLoadLevel directly
- Demos are only recorded on GS_LEVEL (fixes crash for ceremony + titlemaps)
- Added G_GamestateUsesLevel to encapsulate all checks for using level rendering
- Added GS_CEREMONY to wipedefs
- K_PodiumSequence just checks for GS_CEREMONY now (optimization)

The game can now properly go to the podium after GP
2023-03-03 16:09:51 -05:00
Sally Coolatta
4a8dd02320 Podium cutscene basics
- Bots follow a slightly more strict path via waypoints
- Bots decide their starting waypoint path depending on their position. (The 1st place winner will start by chasing waypoint ID 1, etc)
- The map used for podium sequence can be decided via `PodiumMap = x` in MainCfg.

TODO:
- Camera work
- Add Lose / Win animation states when stopping at final waypoint
- Adjust physics so that the bots can follow the path more strictly in this mode
- Actually go to it after GP
2023-03-03 16:09:49 -05:00
toaster
917062b6c6 K_BuildBotTiccmd: Catch NULL track predictions
Predict can be NULL if the bot's nextwaypoint is NULL, which happens consistently at the beginning of Speed Highway and can sometimes also occour on other otherwise functionally-waypointed sprint courses.
2023-01-27 19:58:45 +00:00
toaster
17dd15b998 "Special Mode" (Sealed Stars) and "Versus Mode" (bosses) are now gametypes
* The existing structs are now exclusively for handling extra data.
    * `specialStage` has been renamed to `specialstageinfo`, to reflect that it is not the sole arbiter.
    * `specialstageinfo.valid` and `bossinfo.valid` are what must be checked before grabbing data from either struct.
        * These are turned on when the gametype extra data is successfully initialised, not on map start.
            * `K_InitBossHealthBar(...)` for `bossinfo.valid`
            * `K_InitSpecialStage(void)` for `specialstageinfo.valid`
        * `K_CanChangeRules(...)` no longer checks these
    * No longer uses duplicate encore information.
* The map command (and -warp) now guesses gametype using a general `G_GuessGametypeByTOL(UINT32)` function
    * Grabs the first gametype with an overlap between the requested TOL and the gametype's TOL.
* The cool Versus-specific intro is now checked via `K_CheckBossIntro()`.
2022-12-26 23:06:24 +00:00
Sally Coolatta
3c8738baab Displace bot predictions against slope physics
This makes them able to climb steep slopes significantly better.
2022-11-27 05:14:35 -05:00
Sally Coolatta
366ade8cbb Bots don't use items while exiting anymore
They'll just hold onto 'em now. Makes the post-exit movement a bit more seamless.
2022-11-27 03:45:45 -05:00
Sally Coolatta
ad02fbcf32 Reel the prediction back when it hits wall 2022-11-27 03:00:48 -05:00
James R
b0e079bdf0 Update botvars rubberband and controller in P_PlayerAfterThink instead of K_BuildBotTiccmd
These vars directly affect gamestate but K_BuildBotTiccmd
only runs for the server.
2022-10-31 14:36:21 -07:00
James R
58bb648b0a Merge branch 'udmf-cherrypick' into 'master'
Update our UDMF

Closes STJr/SRB2#862

See merge request KartKrew/Kart!727
2022-10-29 06:54:48 +00:00
toaster
f281f47c6f Support alternate gameplay events during GP
- Implementation details:
    - grandprixinfo.eventmode is the reference point
    - All bots have spectator applied and removed at map start depending on eventmode, and I've done my best to guard against side effects of not removing them entirely
    - You shouldn't turn off grandprixinfo.gp when turning on things like specialStage.active or bossinfo.boss when pursuing eventmode behaviour
    - Probably needs to be integrated into XD_MAP for any future netplay support, is currently disabled.
    - You technically don't have to assign a Capsules map to be the bonus and a Special Stage to be the special. A Capsules map can be assigned to a Special Stage too, and a Boss can be assigned to either of them.
    - Special Stages are still just as incomplete as they were before.
- Break the Capsules has special behaviour.
   - Timelimit starts at 20 seconds.
   - Earn 10 seconds (plus a little extra cheaty time) every capsule you destroy.
   - WIN + extra life if you bust all the capsules, COOL if you get some but run out of time, LOSE if you lose your bumper or run out of time without breaking a single capsule.
   - Supposed to also give you rings, but ran into a LOT of difficulty with this and didn't want to commit half-baked stuff, so it'll be a later project.
Also:
- Fix a long standing bug where totalring was reset between maps, preventing the sum from adding up across GP rounds and depriving you of extra lives you were owed.
- Fix an issue where Break the Capsules record attack was KARTSPEED_HARD.
- Send timelimitintics in savegames, since it's handled seperately now.
2022-10-14 18:34:43 +01:00
Sally Coolatta
1ab2b4a897 Bot Controller uses args 2022-10-10 10:26:25 -04:00
MascaraSnake
3b971835ee Add Lua backwards compatibility for FOF flags 2022-10-09 01:56:50 -04:00
Nev3r
5c9599f0a9 "UDMF: The whole thing" merged
See merge request STJr/SRB2!1714

Barely any RR features reimplemented
2022-10-09 01:13:37 -04:00
Sally Coolatta
f987d1b601 Add smooth landing vfx 2022-09-20 10:33:24 -04:00
Sally Coolatta
acf2484def Merge branch 'master' into tumble-slope-fuck 2022-09-20 07:34:44 -04:00
James R
6af7df8d40 Fix -Wsign-compare 2022-09-14 23:02:55 -07:00
Sal
89d6506b44 Merge branch 'circuit-pathfind' into 'master'
Circuit pathfinding

See merge request KartKrew/Kart!673
2022-09-12 05:34:28 +00:00
Sal
94d7c497b0 Merge branch 'hooklib-port' into 'master'
Hooklib refactor ported and (mostly) squashed

See merge request KartKrew/Kart!662
2022-09-11 06:30:07 +00:00
Sally Coolatta
0c5b42a07e Stop lag when bots respawn
They try to predict their direction while they respawn, which makes them go a bit nuts when air time compensation kicks in. Cap it so that this can't happen.
2022-09-10 03:59:04 -04:00
Sally Coolatta
5107160a27 Circuit pathfinding
An alternative to the standard pathfind function. Instead of pathfinding to a specific waypoint, it always goes towards the finish line waypoint, but also won't stop when it reaches it. It only stops when it travels a far enough distance.

This is basically a cleaner, less hacky, and optimized version of the pathfinding I gave to the bots; instead of doing 1-2 full pathfinds to do this (depending on if they are near the finish line or not), it will instead always do a single small pathfind. I also need it for shrink laser behavior.
2022-09-10 03:52:31 -04:00
James R
37c3a55dda Fix conflicts 522467a88 2022-09-05 11:56:30 -07:00
toaster
1abfb2745a Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into new-menus 2022-09-03 22:26:28 +01:00
Sal
1d661a6f9d Merge branch 'just-bot-things' into 'master'
More bot things

See merge request KartKrew/Kart!652
2022-09-03 14:20:12 +00:00
toaster
97fab1ab20 Levels of tripwire pass conditions.
- Invinc and sneaker can go up to BLASTER.
- Flame shield and momentum make only the boost by themselves.
- Hyuu and grow ignore tripwire so don't make ANY aura without any of the prior also occouring.
2022-08-30 18:16:51 +01:00
Sally Coolatta
e8b179f7a1 Switch around maxplayers and ingamecap
- ingamecap is now the new maxplayers
- The old maxplayers is now called maxconnections, but can mostly be left alone
- Insert into match race menu
2022-08-29 04:35:14 -04:00