RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
990 stars 175 forks source link

Race improvements #3123

Open cryham opened 4 months ago

cryham commented 4 months ago

A few things that I'd like to improve:

  1. Bigger font for race time, guessing impossible in ImGui, so maybe other way. I see MyGui is used for Hud right? Probably best there. Ogre overlay and fontdef likely not.
  1. Best time per vehicle. Right now it's just 1 best time for track, obviously fastest vehicles will win and won't see best times after when driving something slower. Maybe even adding a Gui list to show all best times driven for vehicles.

  2. Allow fixing vehicle during race without abort or add option for it. Too many times I didn't finish after hit.

  3. Damage mode off. IDK if possible? I would prefer to race without vehicle damage, or at least no driving damage to wheels. Or a less damage mode.

  4. Reversed direction race. IDK maybe even enough to determine is to check sign(dot(vehicle heading vector, start box) or so on start. Obviously own best time(s) for reversed.

Possible already: 6. Somehow visualize on minimap (surveymap) where are different races, and their checkpoints. Or start places even in 3D? Took me a while to notice all of them on Auriga, even f1_testtrack, just from tiny 3d meshes at start places.

  1. Next checkpoint beam. A clearly visible, 3D, tall, transparent (green) beam in center of next checkpoint. Great also for tracks with no gates or checkpoint meshes. Is in Trigger Rally and then got into Stunt Rally too, I think it's good for RoR also.

Do you have any comments, dislike any ideas, are you okay to merge if I added this (IDK if I will manage and when) and any hints in code for implementation?

cryham commented 4 months ago

Okay 3. was easy by commenting out in resources/scripts/races.as:

            //this.cancelCurrentRace();
            //this.message("You must not reset the vehicle during a race! Race aborted.", "stop.png");
ohlidalp commented 4 months ago

I have my own plans with the race system - see #3018. Since I wrote that code I changed my approach-instead of wrapping a 'missions.as' script around the races script, I'll extend the races script directly as it's already pretty extensible with custom events and callbacks. The plan to implement a datasheet and ability to load the races and hoc remains.

As for your points here I like the gameplay suggestions. Some things are more of a difficulty setting matter than permanent change matter but I like the direction.

For race/mission editing, we need a visual terrain editor first because all is based around eventboxes which are part of terrain. The 'races.as' as it is wants data entered directly in script but that effectively blocks it from being editable in editor. And people have severe issues editing script at all, making them rely on https://docs.rigsofrods.org/terrain-creation/race-generator/. I want to use the mission datasheet for this.

For the UI part, your best bet are OGRE overlays combined with AngelScript bindings in branch #3030. I'm intensively working on that one, not on the overlays in particular but other OGRE bindings - scene graph, entities and Manual object.

MyGUI isn't really welcome in this project, it's a constant source of build and porting issues and I hate it's API, see #1333 for my rants. Our current HUD systém depends on it but I see the future in Overlays for HUD, imgui for UI and AngelScript for both.

Race times are stored via LocalStorageClass API which reads and writes .ini files. Docs: https://developer.rigsofrods.org/d1/d7f/class_script2_game_1_1_local_storage_class.html

Heh, sorry for dumping all this on you, I've been a solo dev for years and I'm kind of "in the middle of something" with every part of the game. If I may ask, consider contributing a doxy doc page on the race system. There is raw APIdoc https://developer.rigsofrods.org/da/d2a/group___script2_script.html but a more friendly intro page would help.

cryham commented 4 months ago

Okay, thanks. I didn't know there are started improvements. And I'll focus on ImGui not MyGui. But does this interfere with my ideas? I'm not sure, I think these could be small things to do maybe (e.g. 7, 2, 5, 3, 1). IDK if I manage to implement any just curious. I think I'll first finish (or do as much as possible) my SR3 Track Editor track export to RoR, as started in that topic.

ohlidalp commented 4 months ago

Hi, no it doesn't interfere, I'm just pointing you to existing docs and research for inspiration and friendly warning about things I intend to do.

For sure, I'd like you to implement those extensions alongside existing config: https://github.com/RigsOfRods/rigs-of-rods/blob/master/resources%2Fscripts%2Fraces.as#L134-L145

I'd also like to have a definition file format for the races. I already implemented one for the mission system but as I wrote above, I changed my mind, so I'm going to ( in coming days) create PR updating the race.as with the ability of loading race config from file. I'll pretty much reuse this code: https://github.com/ohlidalp/rigs-of-rods/blob/missionzip/resources%2Fscripts%2Fmissions.as#L34-L83 except I'll set race attrs directly instead of going via the Mission object. The code for checkpoints already uses the races-format: https://github.com/ohlidalp/rigs-of-rods/blob/missionzip/resources%2Fscripts%2Fmissions.as#L110-L151

PS I'm also definitely going to update races.as to use script events SE_EVENTBOX* instead of the legacy callback func passed to spawnObject(), please read the intro of https://github.com/RigsOfRods/rigs-of-rods/pull/3081

CuriousMike56 commented 4 months ago
* Where and how is best time saved (on disk) for races on maps?

Race times are stored in /cache/raceTimes.asdata.

4. Damage mode off. IDK if possible?
   I would prefer to race without vehicle damage, or at least no driving damage to wheels. Or a less damage mode.

Technically possible if a script could override the deform and break values of all set_beam_defaults. May introduce instability with some vehicles though.

6. Somehow visualize on minimap (surveymap) where are different races, and their checkpoints. Or start places even in 3D?
   Took me a while to notice all of them on Auriga, even f1_testtrack, just from tiny 3d meshes at start places.

Minimap already displays races and active race checkpoints: RoR_2024-02-20_14-41-40 RoR_2024-02-20_14-42-06

cryham commented 4 months ago

Wow. How come I don't have it? Is it very new? I got 2024.02-dev build. 1106

CuriousMike56 commented 4 months ago

Uncheck "Declutter overview map" in settings -> graphics. Perhaps that setting needs to be renamed..?

cryham commented 4 months ago

Ah thanks, that did it.