Tutorials/Building A Minigame Mod: Difference between revisions
m (Added category) |
m (Grammar) |
||
(9 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
This tutorial will take you through the steps of building a working minigame mode. It will start from a completely empty minigame mod and build up to a working minigame. This tutorial assumes basic understanding of the mod editor, including how to access and create a new mod. | This tutorial will take you through the steps of building a working minigame mode. It will start from a completely empty minigame mod and build up to a working minigame. This tutorial assumes a basic understanding of the mod editor, including how to access and create a new mod. | ||
== Creating the mod == | == Creating the mod == | ||
The mod template being used for this tutorial is the "Empty" minigame mod template. This template has default values for all mod settings and has no gameobjects in the scene. The minigame created is not immediately playable as it lacks | The mod template being used for this tutorial is the "Empty" minigame mod template. This template has default values for all mod settings and has no gameobjects in the scene. The minigame created is not immediately playable as it lacks spawn points and solid ground. | ||
=== Adding solid ground === | === Adding solid ground === | ||
Players will need some kind of solid terrain or objects to stand on when they spawn. | Players will need some kind of solid terrain or objects to stand on when they spawn. There are many props suitable for this. Add a new prop from the hierarchy window by right-clicking and choosing ''3D Object > Prop''. The object you created will be invisible in the scene view as it hasn't got a visible prob assigned to it. With the gameobject selected in the hierarchy, look to the inspector to see the [[Prop Component]] attached to the gameobject. Click on the ''Prop'' field button in the inspector to assign a new prop. Some good search terms for large terrain-like props are "Ground", "Floor", "Grass", "Terrain" or "Flat". Here I'll choose ''GroundMounds 05''. | ||
To make sure players can stand on this prop, check that the ''Collision Type'' isn't set to None. It defaults to Mesh, which makes the prop solid in a way that you'd expect, where the collider exactly matches the shape of the visible mesh. For simple props you can use simpler collision shapes, such as the Box or Sphere options. | [[File:ExamplePropInTheScene.png|600px]] | ||
To make sure players can stand on this prop, check that the ''Collision Type'' isn't set to None. It defaults to Mesh, which makes the prop solid in a way that you'd expect, where the collider exactly matches the shape of the visible mesh. For simple props, you can use simpler collision shapes, such as the Box or Sphere options. | |||
To quickly build a level for players, duplicate the prop using ''Ctrl+D'' and move the copy somewhere else. You can scale, rotate or change the prop each time to add variety to the scene. | To quickly build a level for players, duplicate the prop using ''Ctrl+D'' and move the copy somewhere else. You can scale, rotate or change the prop each time to add variety to the scene. | ||
[[File:SimpleTerrainUsingProps.png|600px]] | |||
=== Adding spawn points === | === Adding spawn points === | ||
Now that players have some solid ground to stand on, we need to add [[Player Spawn Component|spawnpoints]] to define where they should spawn at the start of the minigame. Add a | [[File:PointPlayerSpawn.png|thumb|400px|right| A single spawn point set to point mode.]] | ||
[[File:CirclePlayerSpawn.png|thumb|400px|right| A single spawn point set to circle mode. This can spawn along the edge of a circle.]] | |||
Now that players have some solid ground to stand on, we need to add [[Player Spawn Component|spawnpoints]] to define where they should spawn at the start of the minigame. Add a spawn point by right-clicking the hierarchy and choosing ''Minigame Object > Player Spawn''. You will see a white pummel party player appear. This indicates a player spawn point. | |||
With just this single spawn point, all 8 players will spawn in the same place. Changing the ''Spawn Shape'' to "Line" is better as it will space each player out along a line. | With just this single spawn point, all 8 players will spawn in the same place. Changing the ''Spawn Shape'' to "Line" is better as it will space each player out along a line. You can set the length of this line to space players out further. Alternately, you can use a ''Spawn Shape'' of "Circle" to place players in a ring. | ||
If you want finer control over the spawn points of players, the advanced option "Allowed Players" can be used to specify exactly which players are | <br clear=all> | ||
If you want finer control over the spawn points of players, the advanced option "Allowed Players" can be used to specify exactly which players are allowed to spawn at a specific spawn point. by creating eight spawn points, each only allowing a single player, you can define the exact spawn point for a single player anywhere in the scene. | |||
Make sure all spawn points are above solid ground. It's not very fun for the player who spawns beneath the ground and falls through the level. | Make sure all spawn points are above solid ground. It's not very fun for the player who spawns beneath the ground and falls through the level. | ||
=== Adding a goal or objective === | |||
When making a minigame you should decide on what the objective is. For this tutorial, the minigame will give players a point whenever they collect an item. We'll start by creating the item. Right-click the Hierarchy window and choose ''Minigame Object > Item'' This will create a new gameobject that contains an item component. The Item component has many settings and is very versatile. See the [[Item Component]] page for an explanation of all of the settings. We just want an item that rewards the player with a point for collecting it. We don't want the player to hold the item so it should be dropped straight away. It should also be destroyed when dropped to make it seem like the player collected it. | |||
* Under General Settings, set the ''Item Type'' to ''Worn''. This is the simplest item type that offers the least functionality. It is all we need. | |||
* Under Drop Settings, Enable ''Auto Drop After Time'' and set it to 0. This will make the item drop instantly on pickup. | |||
* Under Drop Settings, Enable ''Disappear when Dropped''. This will destroy the item so it can't be picked up again. | |||
* Under Pickup Settings, edit the '''On Pickup' Actions''. | |||
** In the action editor, add a [[Change Score Action]]. Give it the following settings. | |||
[[File:AddScoreAction.png]] | |||
Here is what your item should look like in the inspector at this stage. | |||
[[File:ItemSettingsModTutorial.png|400px]] | |||
The last thing this item needs is a prefab containing its visuals. Visuals here just mean some objects that can be seen by the players. The item currently has nothing assigned to the ''Item Prefab'' field, so it will use the default visual of a carrot. We should provide our own prefab for the item's appearance. | |||
You can create a new prefab in one of a few ways | |||
1. From the toolbar using ''Assets > Create > Prefab'' | |||
2. From the asset browser by right-clicking and choosing ''Create > Prefab'' | |||
3. By dragging a gameobject that you'd like to turn into a prefab, from the Hierarchy Window to the Asset Browser. | |||
I'll use the first option. This creates a new prefab. You can select it and use F2 or ''Right click > Rename'' to rename it. I've named the prefab "KeyItemVisuals" because I'm going to make the item look like a key. Double-click on the prefab in the Asset Browser to edit it. Add a new gameobject with a prop component to the prefab as a child. You could also add a prop component directly to the root gameobject. Here's how it looks. [[File:KeyPrefab.png|center|600px]] | |||
With the prefab created, return to the main scene view by clicking "← Return to Hierarchy" at the top of the hierarchy window. Now select the item and add the prefab you just created to the ''Item Prefab'' field. Now in the Scene View, the item should appear with the shape of the prefab visuals. | |||
=== Spawning multiple items === | |||
One item is good, but we want players to be collecting many items. We could just duplicate this item and place them around the scene, but what if we want to change the settings on the item? We'd have to go and edit every single item duplicate we made. A better way is to create a prefab containing this item and make many prefab instances. Then if we want to update something about the item, we can do it in the prefab and all prefab instances in the scene will update. | |||
To create a prefab of the item, we'll use the third method mentioned earlier. Drag the item gameobject into the Asset Browser. This Creates the new prefab, remember to rename it if you'd like. I'll call it "KeyItem". Now you can drag the prefab you just made into the Scene View to add a Prefab Instance to the scene. These appear in blue in the Hierarchy Window. You can also delete the original item gameobject from the scene since it's now stored in the new prefab. | |||
Here I've created eight prefab instances of the KeyItem and am testing the mod in play mode. | |||
[[File:KeyItemInPlayMode.png|600px|center]] | |||
The keys are a bit small, we can make them larger by editing the prefab they're using for their visuals. Double-click on the first prefab we made, "KeyItemVisuals", in the Asset Browser. Scale up the prop. I changed the scale to be 3 on all axis. | |||
[[File:ScaleToThreeTimesSize.png]] | |||
Now returning to the hierarchy and entering play mode, the keys look like this. | |||
[[File:LargerKeys.png|600px|center]] | |||
Much better! Walking into them also collects them and gives a point to the player, so they're working as expected. | |||
== Adjusting the Mod Settings == | == Adjusting the Mod Settings == | ||
Line 26: | Line 71: | ||
=== Minigame Details === | === Minigame Details === | ||
Here you can set the mod's name as it appears | Here you can set the mod's name as it appears in-game, along with the description and preview shown on the loading screen and in other menus such as the ruleset menu. | ||
To capture a preview image, you can use the screenshot button in the toolbar, or press F10. This will save a screenshot to the mod's Custom assets that will then appear when trying to set a new preview image. You can also import a custom image as an asset through the "Import Asset" button in the [[Asset Browser | To capture a preview image, you can use the screenshot button in the toolbar, or press F10. This will save a screenshot to the mod's Custom assets that will then appear when trying to set a new preview image. You can also import a custom image as an asset through the "Import Asset" button in the [[Asset Browser]]. | ||
===Minigame Controller Settings=== | ===Minigame Controller Settings=== | ||
Line 37: | Line 82: | ||
===Minigame Player Settings=== | ===Minigame Player Settings=== | ||
Here you can | Here you can change settings relating to the player, what they can do and what they will see. This includes whether the player is controlled using a third person or top-down camera, how fast they move and how high they can jump if they can punch if they should use health, and more. | ||
This minigame would be more interesting as a third-person style game, rather than a top-down minigame. At the top of the Minigame Player settings, change ''Player Type'' to "Third Person". This places the camera behind the player and has it follow the player around the level. | |||
== Improving the minigame == | |||
This should be enough to make our minigame playable. We have a basic scene with collectable items. The items give players points when they're collected, and the player who is the first to 10 points wins. We should make sure there are enough items in the level for all players to win. Remember games can have up to 8 players, so there should be at least 73 items to ensure someone can win even if all items are collected (9 players each and one player collects 10, winning the game). | |||
=== Respawning items === | |||
While the minigame is playable, it's a bit boring and predictable to have items in fixed locations all the time. Players might be able to memorize the most efficient way to get to 10 items and the minigame is no longer challenging or fun. We can use the [[Spawner Component]] to spawn items at many different locations around the level. We can choose ~20 positions to spawn items at, then only have about 5 items spawned at a time. This will force players to run back and forth looking for a new item to collect as they spawn. It also makes the minigame more directly competitive between players; rather than having them all spread out collecting items on their own, they will be more engaged in racing each other to reach the items. | |||
Create a spawner by adding an empty gameobject, then using the inspector to add a Spawner component. This component can be found under ''Gameplay > Spawner'' when you click the "Add Component" button in the Inspector Window. We won't be using the position of the spawner to spawn the items so it doesn't matter where you position this gameobject. | |||
Set up the spawner with the following settings. | |||
* Set the ''Type'' to "Spawn On Destruction". This will spawn an instance of a prefab whenever one of the previously spawned instances is destroyed. | |||
* Set the spawn count to 5. This is how many prefab instances can be spawned at once. | |||
* Add the item prefab to the ''Prefabs'' list. | |||
* Set the ''Locations'' to just "OnTargets". This will spawn the prefab instances on the given target objects. | |||
Here is how it should look: | |||
[[File:KeyItemSpawnerSettings.png]] | |||
Now we just need to add a set of spawn locations. These are just empty gameobjects that we can place throughout the scene for items to be spawned at. To help visualize these gameobjects you can place a [[Note Component]] on them. | |||
Here I've spread 18 around the scene. | |||
[[File:ItemSpawnpointsSpreadAroundScene.png|center]] | |||
The final step once these are placed is to give the spawner component a reference to all of these items. Select the gameobject with the spawner component and expand the ''Spawn Points'' list. Add elements for all of the spawn points and one by one fill each element with a reference to the spawn point. | |||
[[File:PopulatedSpawnPointList.png|250px]] | |||
Now when playtesting, only five items are present at a time and collecting one will spawn a replacement at one of the spawn points with no item after a short time. This is more engaging and much more frantic to play. | |||
=== Improving the level === | |||
Currently, the level is quite bland; a mostly flat landscape with a few small hills. By making the level more complex with walls, verticality and things to climb and jump over, the minigame will hopefully be more engaging to play. The focus should initially be on improving the layout of the level, playtesting, and once that is done the smaller details and visuals of the level. A good thing to remember is that if it's fun with basic blocks and level design, then it will probably still be fun when the visuals are polished. If it's not fun with basic visuals, improving the visuals is unlikely to make it more fun, it'll just make it look better. Aim for fun first, and make it look good later. | |||
To improve the level design of this mod, I'm thinking of adding verticality through multiple levels with stairs or ramps to navigate up and down between them. This will encourage players to climb up and down between the areas as they race for items. | |||
Here's an example of that: | |||
[[File:NewLevelForExampleMinigame.gif]] | |||
This is much more fun to run around collecting keys. You can jump between platforms on the upper levels and jump down from higher levels to grab keys quickly. After playtesting this, only requiring 10 keys to win feels far too low; the minigame is over in about 30 seconds. Raising the keys to win to a higher value or even removing the ''Obtain points'' win condition and replacing it with a timer, where the person who can collect the most points in an amount of time wins. You could even experiment with multiple short rounds instead of a single long round. | |||
== Download example mod == | |||
You can download and play the final version of the mod created by subscribing to it on the Steam Workshop [https://steamcommunity.com/sharedfiles/filedetails/?id=2897736329 here]. The mod is unlocked so you can use it as a template from the New Mod menu when creating a new mod (must be subscribed to the mod). | |||
[[Category:Tutorials]] | [[Category:Tutorials]] |
Latest revision as of 23:34, 15 December 2022
This tutorial will take you through the steps of building a working minigame mode. It will start from a completely empty minigame mod and build up to a working minigame. This tutorial assumes a basic understanding of the mod editor, including how to access and create a new mod.
Creating the mod
The mod template being used for this tutorial is the "Empty" minigame mod template. This template has default values for all mod settings and has no gameobjects in the scene. The minigame created is not immediately playable as it lacks spawn points and solid ground.
Adding solid ground
Players will need some kind of solid terrain or objects to stand on when they spawn. There are many props suitable for this. Add a new prop from the hierarchy window by right-clicking and choosing 3D Object > Prop. The object you created will be invisible in the scene view as it hasn't got a visible prob assigned to it. With the gameobject selected in the hierarchy, look to the inspector to see the Prop Component attached to the gameobject. Click on the Prop field button in the inspector to assign a new prop. Some good search terms for large terrain-like props are "Ground", "Floor", "Grass", "Terrain" or "Flat". Here I'll choose GroundMounds 05.
To make sure players can stand on this prop, check that the Collision Type isn't set to None. It defaults to Mesh, which makes the prop solid in a way that you'd expect, where the collider exactly matches the shape of the visible mesh. For simple props, you can use simpler collision shapes, such as the Box or Sphere options.
To quickly build a level for players, duplicate the prop using Ctrl+D and move the copy somewhere else. You can scale, rotate or change the prop each time to add variety to the scene.
Adding spawn points
Now that players have some solid ground to stand on, we need to add spawnpoints to define where they should spawn at the start of the minigame. Add a spawn point by right-clicking the hierarchy and choosing Minigame Object > Player Spawn. You will see a white pummel party player appear. This indicates a player spawn point.
With just this single spawn point, all 8 players will spawn in the same place. Changing the Spawn Shape to "Line" is better as it will space each player out along a line. You can set the length of this line to space players out further. Alternately, you can use a Spawn Shape of "Circle" to place players in a ring.
If you want finer control over the spawn points of players, the advanced option "Allowed Players" can be used to specify exactly which players are allowed to spawn at a specific spawn point. by creating eight spawn points, each only allowing a single player, you can define the exact spawn point for a single player anywhere in the scene.
Make sure all spawn points are above solid ground. It's not very fun for the player who spawns beneath the ground and falls through the level.
Adding a goal or objective
When making a minigame you should decide on what the objective is. For this tutorial, the minigame will give players a point whenever they collect an item. We'll start by creating the item. Right-click the Hierarchy window and choose Minigame Object > Item This will create a new gameobject that contains an item component. The Item component has many settings and is very versatile. See the Item Component page for an explanation of all of the settings. We just want an item that rewards the player with a point for collecting it. We don't want the player to hold the item so it should be dropped straight away. It should also be destroyed when dropped to make it seem like the player collected it.
- Under General Settings, set the Item Type to Worn. This is the simplest item type that offers the least functionality. It is all we need.
- Under Drop Settings, Enable Auto Drop After Time and set it to 0. This will make the item drop instantly on pickup.
- Under Drop Settings, Enable Disappear when Dropped. This will destroy the item so it can't be picked up again.
- Under Pickup Settings, edit the 'On Pickup' Actions.
- In the action editor, add a Change Score Action. Give it the following settings.
Here is what your item should look like in the inspector at this stage.
The last thing this item needs is a prefab containing its visuals. Visuals here just mean some objects that can be seen by the players. The item currently has nothing assigned to the Item Prefab field, so it will use the default visual of a carrot. We should provide our own prefab for the item's appearance.
You can create a new prefab in one of a few ways 1. From the toolbar using Assets > Create > Prefab 2. From the asset browser by right-clicking and choosing Create > Prefab 3. By dragging a gameobject that you'd like to turn into a prefab, from the Hierarchy Window to the Asset Browser.
I'll use the first option. This creates a new prefab. You can select it and use F2 or Right click > Rename to rename it. I've named the prefab "KeyItemVisuals" because I'm going to make the item look like a key. Double-click on the prefab in the Asset Browser to edit it. Add a new gameobject with a prop component to the prefab as a child. You could also add a prop component directly to the root gameobject. Here's how it looks.
With the prefab created, return to the main scene view by clicking "← Return to Hierarchy" at the top of the hierarchy window. Now select the item and add the prefab you just created to the Item Prefab field. Now in the Scene View, the item should appear with the shape of the prefab visuals.
Spawning multiple items
One item is good, but we want players to be collecting many items. We could just duplicate this item and place them around the scene, but what if we want to change the settings on the item? We'd have to go and edit every single item duplicate we made. A better way is to create a prefab containing this item and make many prefab instances. Then if we want to update something about the item, we can do it in the prefab and all prefab instances in the scene will update.
To create a prefab of the item, we'll use the third method mentioned earlier. Drag the item gameobject into the Asset Browser. This Creates the new prefab, remember to rename it if you'd like. I'll call it "KeyItem". Now you can drag the prefab you just made into the Scene View to add a Prefab Instance to the scene. These appear in blue in the Hierarchy Window. You can also delete the original item gameobject from the scene since it's now stored in the new prefab.
Here I've created eight prefab instances of the KeyItem and am testing the mod in play mode.
The keys are a bit small, we can make them larger by editing the prefab they're using for their visuals. Double-click on the first prefab we made, "KeyItemVisuals", in the Asset Browser. Scale up the prop. I changed the scale to be 3 on all axis.
Now returning to the hierarchy and entering play mode, the keys look like this.
Much better! Walking into them also collects them and gives a point to the player, so they're working as expected.
Adjusting the Mod Settings
If you have an idea of what the goal of the minigame is, the mod settings can be used to enforce that. See Mod Settings for a detailed explanation of all available settings.
Minigame Details
Here you can set the mod's name as it appears in-game, along with the description and preview shown on the loading screen and in other menus such as the ruleset menu.
To capture a preview image, you can use the screenshot button in the toolbar, or press F10. This will save a screenshot to the mod's Custom assets that will then appear when trying to set a new preview image. You can also import a custom image as an asset through the "Import Asset" button in the Asset Browser.
Minigame Controller Settings
Here you can set the win condition and placement rules.
For this tutorial, we'll make the minigame end when someone reaches 10 points. Set the End condition to "Obtain Points" and set the Points to Win to 10.
Minigame Player Settings
Here you can change settings relating to the player, what they can do and what they will see. This includes whether the player is controlled using a third person or top-down camera, how fast they move and how high they can jump if they can punch if they should use health, and more.
This minigame would be more interesting as a third-person style game, rather than a top-down minigame. At the top of the Minigame Player settings, change Player Type to "Third Person". This places the camera behind the player and has it follow the player around the level.
Improving the minigame
This should be enough to make our minigame playable. We have a basic scene with collectable items. The items give players points when they're collected, and the player who is the first to 10 points wins. We should make sure there are enough items in the level for all players to win. Remember games can have up to 8 players, so there should be at least 73 items to ensure someone can win even if all items are collected (9 players each and one player collects 10, winning the game).
Respawning items
While the minigame is playable, it's a bit boring and predictable to have items in fixed locations all the time. Players might be able to memorize the most efficient way to get to 10 items and the minigame is no longer challenging or fun. We can use the Spawner Component to spawn items at many different locations around the level. We can choose ~20 positions to spawn items at, then only have about 5 items spawned at a time. This will force players to run back and forth looking for a new item to collect as they spawn. It also makes the minigame more directly competitive between players; rather than having them all spread out collecting items on their own, they will be more engaged in racing each other to reach the items.
Create a spawner by adding an empty gameobject, then using the inspector to add a Spawner component. This component can be found under Gameplay > Spawner when you click the "Add Component" button in the Inspector Window. We won't be using the position of the spawner to spawn the items so it doesn't matter where you position this gameobject.
Set up the spawner with the following settings.
- Set the Type to "Spawn On Destruction". This will spawn an instance of a prefab whenever one of the previously spawned instances is destroyed.
- Set the spawn count to 5. This is how many prefab instances can be spawned at once.
- Add the item prefab to the Prefabs list.
- Set the Locations to just "OnTargets". This will spawn the prefab instances on the given target objects.
Here is how it should look:
Now we just need to add a set of spawn locations. These are just empty gameobjects that we can place throughout the scene for items to be spawned at. To help visualize these gameobjects you can place a Note Component on them. Here I've spread 18 around the scene.
The final step once these are placed is to give the spawner component a reference to all of these items. Select the gameobject with the spawner component and expand the Spawn Points list. Add elements for all of the spawn points and one by one fill each element with a reference to the spawn point.
Now when playtesting, only five items are present at a time and collecting one will spawn a replacement at one of the spawn points with no item after a short time. This is more engaging and much more frantic to play.
Improving the level
Currently, the level is quite bland; a mostly flat landscape with a few small hills. By making the level more complex with walls, verticality and things to climb and jump over, the minigame will hopefully be more engaging to play. The focus should initially be on improving the layout of the level, playtesting, and once that is done the smaller details and visuals of the level. A good thing to remember is that if it's fun with basic blocks and level design, then it will probably still be fun when the visuals are polished. If it's not fun with basic visuals, improving the visuals is unlikely to make it more fun, it'll just make it look better. Aim for fun first, and make it look good later.
To improve the level design of this mod, I'm thinking of adding verticality through multiple levels with stairs or ramps to navigate up and down between them. This will encourage players to climb up and down between the areas as they race for items.
Here's an example of that:
This is much more fun to run around collecting keys. You can jump between platforms on the upper levels and jump down from higher levels to grab keys quickly. After playtesting this, only requiring 10 keys to win feels far too low; the minigame is over in about 30 seconds. Raising the keys to win to a higher value or even removing the Obtain points win condition and replacing it with a timer, where the person who can collect the most points in an amount of time wins. You could even experiment with multiple short rounds instead of a single long round.
Download example mod
You can download and play the final version of the mod created by subscribing to it on the Steam Workshop here. The mod is unlocked so you can use it as a template from the New Mod menu when creating a new mod (must be subscribed to the mod).