Rope Game Prototyping
I started to work on a prototype of a game this week. I made my last game in Unity, but I wanted to give a try to Godot Engine for a while and so I thought that this prototyping phase was a great opportunity to play with Godot!
So here we are, as it is been several days I've worked on it, there is a lot that happens and I will summarise my week so far below.
Day 1: Getting Started
I am still unsure about the main character design, but the idea is to develop a 2 player games, in the same vein as Biped from Next Studio. The 2 player will be attached with a rope and the gameplay will focus on making the 2 players interacting to solve puzzle and defeat foes.
Here is what I could do in terms of concept art with my limited skills in a couple of hours.
Then after a long walk, I downloaded the GDQuest course on how to make a 3D character and got the State Machine ready.
Day 2: Getting the Controls ready
The next day I continue to follow the GDQuest course and I adapted it to control 2 characters with a separate gamepad.
Day 3 and 4: Getting the Rope ready
After reading about the Verlet integration methods, which looks soOOoo awesome, I realised that it would not work for me. First, the integration in 3D may get more complex. Second, I needed the rope to interact with the environment (e.g. monster, floor, switches, etc).
So I decided to use capsules and pinjoints:
However, I started to have bugs when I was creating the capsules and pinjoints from code (see the red rope above). I spend 2 days to get around them. I've learnt that:
- 1) the way you parent your objects is important for physics to go smoothly;
- 2) you need to align your root object correctly (z towards -z ??) in your scene for the look_at() method to work as expected!;
- 3) it is very easy to create a DebugLayer in Godot thanks to this KidsCanCode tutorial.
Hence, yesterday, I got my rope created from code between two cubes:
But I was still getting some weird things happening: the rope was not really helpful as you can see it above !
Day 5: Today's Morning Dilemma
It seems that the weird behaviour of the rope is solved if I replaced the KinematicBody node of the cubes with a RigidBody node:
It might not be exactly obvious (because I don't show the controls on screen), but the green and pink cubes try to move away from the rope, and this time, the rope keeps them from doing so! Again, when the green cube falls, I am moving the pink cube backward and the rope is holding the green cube. Then when I stop moving the pink cube backward, the pink cube slides to the cliff, pulled by the weight of the green cube ! hurray!
So now the issue is: KinematicBody works better for player control, but RigidBody works better with the rope...
How can I get good player control with good rope physics?