-
Notifications
You must be signed in to change notification settings - Fork 2
Contributing with New Content
Here are some guides on how to add extra types of content to the prototype.
First, add a new ItemData resource to scenes/powerups/item_data
containing the item name and display texture. You can add the textures to images/ui
.
Then, create a script extending Item(item.gd) at scripts/items
. This script handles how the item reacts in your inventory, and what happens if you press the Use Item button. Item inherits from Object so queue_free()
will delete the item from memory, preferably after it was used or all its charges have been expended. Then, link this script to the "Item Script" section of your ItemData from the last step.
Additionally, if your item creates a prop that exists in 3D world you can make a Scene extending PowerUp(power_up.gd) at scenes/powerups
, as it implements simple physics and contact detection with vehicles. It needs a CollisionShape3D to dictate how it collides with the ground, and an Area3D node named "ContactArea" with collision layer and mask set only to layer 12.
Sea Mine powerup scene
Sea Mine powerup script
Finally, for the item to show in-game it needs to be added to the item roll tables. The default table used in item boxes is same_weight_all_items.tres
found in scenes/powerups/tables
. You can add the ItemData to the table via the Godot editor. You can also add it to new tables.
Process for new tracks is a bit more in-depth, with many required steps.
First, create a new scene that extends the Track class (although it doesn't implement anything yet), save it inside scenes/tracks
in its own folder for organization. Add your environment and light nodes as well as your track model.
For the next step, I suggest grouping your track model's meshes by material, so all tarmac is one object, all sand is another object etc.
To create solid collisions, you can click any MeshInstance3D component and above the editor viewport find Mesh > Create Trimesh Static Body
; This will create a solid StaticBody which vehicles can drive over, as a child of that mesh node. Do this for all solid parts of the track. You can also drag those StaticBodies around in the hierarchy later, just pay attention to Transforms.
Any given StaticBody3D can also be assigned a RoadMaterial, which influences physics on the vehicles. All default materials are found in scripts/car/road_materials
, but you can add more to that folder. By default, Tarmac is used for all calculations. To assign a material to a StaticBody, find the "Group Name" for that material, then go to the StaticBody node, select the tab Groups, then add a group with the name you found before. It should be detected as that material.
To be able to spawn vehicles at the start of the race you need a StartingGrid node whose script can be found in scripts/race/track_starting_grid_simple.gd
. It needs Marker3D children, as many as the maximum amount of racers you want to support (in the example picture, 12), which dictate spawning position for those vehicles. The rotation is also important, as the positive Z direction of the markers (the blue gizmo) should face backwards.
The track will also need a node of class RacePath3D which tells both AI, items and lap tracker where the road is. It should start right above the starting/finish line on the track, follow roughly the middle of the road, and connect back at the start. The project has a few plugins to help manipulate 3D Curves as Godot is still working on their own solution.
When designing the track and placing the path, avoid split paths, they are not supported. Pay attention to not make parts of the track that cross above or below each other too close, as the AI may detect they're closer to the bottom than the top.
Then, place all the item boxes in the level, from the ItemBox scene found in scenes/powerups/box/item_box.tscn
(drag it into the viewport). You can group them inside a parent Node3D for organization too. You can also modify which ItemTable each individual box rolls from by dragging the table .tres file into the "Table" section of the Inspector.
Finally, to add the track to the Track Select screen, first add a new entry in the track_dict
dictionary with a name and the path to the track file. Then, add a new button to the scene inside "ButtonsVBox" whose name is the key to the dictionary with your new track.