User Generated Content

User Generated Content

By Olger Klok

Introduction

For my R&D I wanted to focus on procedurally generated content (PCG). But I wasn’t interested in the dungeon/room creation that normally gets created when talking about PCG, instead I wanted to create content that created by the inputs of a user, also called user generated content (UGC).

Table of Content

  • Game concept
  • User input
  • Mesh generation
  • Race kart
  • Game mechanics
  • Conclusion
  • Sources

Game concept

To realise UCG I first need to create a game concept in which I can use UCG. For this I took inspiration from Tron and Line Rider. The concept of the game I came up with was a local multiplayer game, where two people are driving a race kart and one person draws the track. The goal for the person that draws the track is to make the racers fall off the map/lose. While the goal of the racers is to stay on longer than the other racer.

User Input

The first decision I had to make was which input I wanted to take for the creation of the racing track. Eventually I decided to go with the mouse position since this gave me some different option in how the “drawer” should be able to create the track.

For the drawing of the track I had to ideas, one was to trail the mouse position in 3D, and use all these positions to create a track. The other one was to limit the mouse movement only to the x-axis and automatically move the points down and then once again use all these positions to create the track.

I ended up going for the second option mainly because this avoided a lot of problems. This way the track always had a minimum length and this way the “Drawer” couldn’t make 180° turns.

Another thing I looked into was a bezier curve. Bezier curves are mostly used to to make a curve look smooth. It does this by placing a lot of smaller points in between multiple control points. And it then draws the curve over all the small points.

While setting it up and getting it to work for my concept I realised that this was not that useful for me. The problem here is that my control points are already very close to each other. If I then were to add in the smaller points in between the impact it would have would be insignificant. And thus I decided to no longer use a bezier curve since it would only take more computer power.

Mesh Generation

Since the track is different every time I need to create a custom mesh. At first I created a new mesh every frame and moved the position of the attached game object forward. This way the user would fall off the track if they were too slow. However while reading this you probably already saw the issue here, creating a new mesh every frame, so I looked into chunking instead. In the first iteration of chunking I would create a new mesh for every 20 mouse positions that passed and to move them forward I would look at the position of the last mesh and add that to the new points.

This however had a few problems, but mainly that the two meshes didn’t connect with each other. So if the “drawer” made a quick turn at the end of a mesh it would leave a gap between the two meshes and it became impossible to drive across.

To fix this issue I came up with the solution to combine the two meshes. So every time a new mesh needs to get created I delete the old mesh and create a new one with the old points and the new points combined.

Race Kart

Because of limited time and because my focus wasn’t on making the racing kart I decided to take unity’s build-in racing kart template and tweak the values of the race kart to fit my game. The addition I made to it for my project was making it work for multiple players. For this I made changes to the unity input system and added in a second camera for split screen, these cameras are Cinemachine cameras which makes it easy for the camera to follow each player.

Note: To make two Cinemachine cameras work both need to have a Cinemachine brain and need to be on a separate layer. And the layer of the other camera needs to be added to the culling mask.

Game Mechanics

With the original concept of this being a Jackbox like mobile game, I wanted to stick to a shorter playtime game with a lot of replay-ability potential. So while looking into game mechanics for this game I tried to keep that in mind.

Win Condition
After having a basic set-up of the game I looked into what the win condition would be for every player. For this I had two main ideas, first was a basic start and finish. The racer who reaches the first wins, if no player reaches the finish the track drawer wins, pretty simple. The second idea was more survival of the fittest. The first racer to fall would lose and the track would become harder to drive the longer they would both survive.

Option one the start and finish simple but boring in my opinion. The game would always have a maximum length and if player get really good at it eventually it would become boring.

So I went with option two, here the track would be harder to drive the longer both racers kept going, being able to challenge themselves in how good they could become. Now you might already see a problem which is that the drawer of the track never wins. To “fix” this I added in a timer, each player would be the drawers once and can compare how long it took them to make one of the players loose.

Progressively harder
In the text above I said I wanted to make the track harder the drive the longer both racers would survive. To do this I had again two options in mind. Option one, increase the speed on how fast the racers need to be to survive. Option two, make the track more narrow the longer they continued.

After testing out both option I chose to go with option two. This option gave better visual feedback of the track becoming more difficult to drive and felt more fair while playing. Option one sometimes felt impossible and thus became less fun.

Because of the better visual feedback option two also made the drivers continuously more stressed which is great for party games like this.

Conclusion

Making a UGC game is pretty easy in my opinion, making a good UGC game not so much. In my concept I have a player which does all the creating and that works fine for a small 3-5 minutes game. But when you want your game to have a longer playtime that player will probably get bored if it is only doing one thing. And to integrate UGC into a single player game for example you need to completely think out your concept because you don’t want the UGC to get in the way of your player actually playing the game.

So in the future if I wanted to make which also has UGC build into it I would probably spend a lot more time on the initial concept idea and make the UGC not the main focus point of the game. It would just be a nice plus thing to have.

Sources

  • Cg Programming/Unity/Bézier Curves – Wikibooks, open books for an open world. (n.d.). https://en.wikibooks.org/wiki/Cg_Programming/Unity/B%C3%A9zier_Curves
  • Emergent Studios. (n.d.). Line Rider. https://www.linerider.com/
  • French, J. (2022, October 20). The right way to pause a game in Unity. Game Dev Beginner. https://gamedevbeginner.com/the-right-way-to-pause-the-game-in-unity/
  • Gregoryl. (2019, November 29). Can I use 2 camera with Cinemachine Brain? Unity Forums. Retrieved March 15, 2023, from https://forum.unity.com/threads/can-i-use-2-camera-with-cinemachine-brain.483241/
  • Jackbox Games. (2023, April 3). HOME – Jackbox Games. https://www.jackboxgames.com/
  • Karting Microgame – Unity Learn. (n.d.). Unity Learn. https://learn.unity.com/project/karting-template
  • Sebastian Lague. (2018, February 28). [Unity] 2D Curve Editor (E06: road mesh) [Video]. YouTube. https://www.youtube.com/watch?v=Q12sb-sOhdI
  • Technologies, U. (n.d.). Unity – Scripting API: Time.unscaledDeltaTime. https://docs.unity3d.com/ScriptReference/Time-unscaledDeltaTime.html
  • TRON (arcade game) | Tron Wiki | Fandom. (n.d.). Tron Wiki. https://tron.fandom.com/wiki/TRON_(arcade_game)

Leave a Reply

Your email address will not be published. Required fields are marked *