Doraemon Speedster
Published: 2024-03-06 10:38:06

# Doraemon Speedster

> Type: Multiplayer Racing
>View: 3d
> Fun points: multiplayer online, racing, and fun scene exploration



![Style](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b78p3n97pxs6zzvokx50.png)



> Time: 2015-2018
> Personal Responsibilities:
> 1. Participate in native DEMO R&D and production
> 2. Participate in the discussion, development and optimization of the basic game framework
> 3. Responsible for optimizing the game physics system
> 4. Responsible for the in-game camera language function
> 5. Maintenance throughout the game life cycle
> 6. Responsible for the discussion and development of some functions of the game server
> 7. Develop animation editing tools. Special effects rigging tools
> 8. Optimize workflow, production management tools: animation state machine related, animation import, log management, etc.
> 9. SDK access integration and document writing


## Module division:
**1. Newbie guide**

![turn guide](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9896damm47a57ixogyl5.jpg)


Guidance is implemented in two parts, inside and outside the game. The game needs to handle the paused transition state of the game and different input methods. Outsiders only need to handle the button click process.
### In-office guidance

1. Press and hold the guide. The picture above shows a left turn. You need to keep pressing the left joystick for a period of time. If you just tap it lightly, you need to display the prompt UI again when you lift your finger. At this time, the state switching process is difficult.
point.

2. Press and hold multiple keys to guide


![Draft guide](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7rf9574p28v3yfn5z5wg.jpg)



The picture above is a drift tutorial. You need to hold down the direction key and the drift key at the same time. If you just hold down one side, the process cannot be triggered correctly. This type is similar to the hold type above, but there is one more case. The difficulty lies in one more input. Dimensions need to handle duplicate codes between types.

### External guidance


![Click](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v3ewptsak5330g28sl0q.jpg)



External guidance mainly controls player clicks, and is divided into forced guidance chapters and open guidance chapters.

The difference is that the forced guidance chapter is in the early stage of the game. After entering the game, the entire game process is under the control of the guidance and proceeds in sequence.
When a new functional page is opened later, a separate open guide will be triggered.

The difficulty of this system is to click on the production and use of the focus mask, click on the penetration detection button, and trigger the button.

**2. In-game physics**

- Body structure


![Body structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sdsqvs7zxq3defbula2v.jpg)



Body collision body composition:
1. Main body Capsule

This collision body is mainly responsible for collision physics, such as collision detection with walls, collision detection with the ground, and collision detection between cars.

> Simulate collision physics. When the car body is hit, use a script to obtain the collision direction and collision point. Based on the current speed of the car, calculate the motion state of the car after the collision, and set it in a physical frame after the collision.

2. Prop detection box
This collider is a trigger and is only responsible for detecting function triggers.

For example:
1. Hit with attack props
2. Pick up the prop box
3. Enter the acceleration zone
4. Enter the flight start zone

- Engine power

**Engine Power**, the value responsible for forward speed
If engine power = 1, you can move forward, and the acceleration is determined by the attributes of the car itself.
Engine power = -1, then retreat, the retreat speed is a fixed value (the official version does not have this function)
If engine power = 0, it will stay in place, such as when being immobilized by an item.

- top speed

The maximum MPH (miles per hour) value that can be reached, determined by the car's attributes. When the engine power of the car is 1, if the current speed is higher than the **maximum speed** value, the speed will decrease. If the current speed is lower than the **maximum speed**, the speed will continue to accelerate.

When in sprint state, the current maximum MPH value will break through and become higher.

- sprint state

There are many categories of sprints, including acceleration zones, props, and drift nitrogen. Each sprint has its own independent
acceleration,
Increased maximum MPH value,
type enum

The sprint state is a kind of status buff

- Steering power

**Steering power**, responsible for the value of steering angular velocity
Engine power = 1 then turn left
Engine power = -1 then turn right
Engine power = 0 then execute

The maximum angular velocity and angular acceleration of the steering are determined by the properties of the car.

- Drift

The implementation of drift is composed of animation + physical simulation + tire tracks.

After pressing and holding the drift button and any direction key, the drift is triggered. At this time, pressing the left direction will drift to the left, and pressing the right direction key will drift to the right.

The drift animation will cause the car body to tilt, and the tire marks that appear at the same time will show the state of burning tires.

Physical simulation is the essence of this design. When it is in a drifting state, the car body will exert a lateral thrust in the opposite direction of drifting to simulate out-of-control drifting.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iv6s8h467snzbpgzbplj.jpg)



- Bamboo Dragonfly


Bamboo Dragonfly is a gameplay mode specially designed for Doraemon IP. After entering the special flying area, all racing cars will temporarily disappear and be replaced by Doraemon's prop, Bamboo Dragonfly. At this time, the player is in flight mode, which can still be controlled, but drift cannot be used and only the direction can be controlled.


![Bamboo Dragonfly](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rgutc7u7pm5rpt6lgwpd.jpg)



The implementation of the bamboo dragonfly mode mainly uses path points, coupled with the lateral calculation of the movement range.

- anti-gravity

In the game, many maps can be designed against gravity, similar to going up a wall.

The realization of anti-gravity requires the use of an excessive gravity trigger. After passing this trigger, the direction of gravity received by the car will change. For example, after entering the wall gravity trigger, the direction of gravity will become perpendicular to the wall. direction. After entering the lower wall platform, there will be another gravity trigger to return the car's gravity to the normal negative Y-axis direction.

- All terrain

The anti-gravity design, coupled with the special design of the map scene, can turn it into an all-terrain similar to a space planet. In this special generation, cars can drive on both sides of the road, hang overhead, and so on.

- Ground adsorption

During the development process, it was discovered many times that the car would leave the ground, especially if there were collision joints on the ground, horizontal fluctuations, etc. When driving on curved surfaces, there is even jitter and the inability to climb hills.

In response to this situation, I used ground adsorption to solve it. The difficulty of ground adsorption is that under normal circumstances, the car needs to maintain ground adsorption, but on a high platform such as a jumping platform, or when taking off, it needs to be able to lift off the ground.

- Falling from a height

It is also difficult to deal with falling from a height to the ground. Due to the acceleration of gravity, the car falls too fast and can easily penetrate the ground collision body. During the experiment, thickening and multiple ground collisions were used. None of the physical methods has completely solved the penetration problem. Finally, the speed prediction method was used to completely solve the problem.


**3. Lens language**

Camera language is definitely the most important part of this game. In racing games, cars move very fast, so once the camera is not handled well, it can easily affect the player experience.

uphold
>The shots that players cannot discover are the best shots.

this principle. This part of the functionality went through many rounds of iterations.

From the initial FixedUpdate following, to the delayed following point, to the camera placed child node following,

From fixed rotation angle, to interpolation delayed rotation angle following,

During this period, a very strange screen "stuttering" phenomenon was also discovered.

Finally, through a lot of experiments and using the most critical patching needle design, the problem was solved.

I don’t know if there is any ready-made camera plug-in to solve this part of the problem.
(Most game development in the later period did not have lens-heavy language)

**4. Animation**

The animation structure is divided into racing animation and character animation.

There will be binding points designed to bind the character on the racing model. The character can be installed by placing the character into the racing binding point and returning it to zero local coordinates.

The biggest difficulty in the development process of character animation and racing animation is that there are no less than 20 animation control files for racing cars and about 10 character animation control files, which is a big trouble in modification and maintenance.

For this point, I specially developed a batch generation and binding tool for animation control files. I used a basic template file to copy and generate new files, and then obtained the animations corresponding to different models and placed them in the new animation files.

The debugged animation control files can finally be conveniently applied to all cars and characters in batches.

Both character animation and racing animation use animation layering technology. For example, when using props, the character's arm layer will play the animation of throwing props, but at this time, the player on the base layer will play idle.

**5.SDK**

The version at that time was connected to some domestic SDKs for data testing.