[ad_1]
Cocos3.6 has been on-line for 3 weeks, whether or not the brand new Surface Shader materials, or the CSM cascade shadow, or the brand new DCC materials system, and the animation state machine! !
I haven’t used any of those options but! ! !
So I’m going to spend 4 days to make a easy sport ! A jare chiken sport, which permits everybody to benefit from the scene and accumulate cash in it!
Demo Address : Jare‘s World! Free Giveaways!!!
1.0 Scene design
With the concept, the following step is the scene design. There must be a giant moon within the scene to exhibit the reflection of skybox, and with many buildings to indicate the ability of CSM, and there must be loads obstacles as effectively! Players want to leap to the flooring to gather the cash, the design drawing is as follows!
Character choice
Jare Chiken(Cocos’s PM Director!) is kind of just like the chicks within the design drawing!
DCC materials adaptation
The scene selected the Asian Buildings Collection type Noyou on Sketchfab, which has loads buidings within the scene and plenties of obstacles!(CC: Ancient Chinese courtyard Park – Download Free 3D mannequin by noyou (@zsm123) [55d8371] – Sketchfab)
With the most recent Dcc materials adaptation from Cocos, this scene can exported into Cocos with out further config!.
Then arrange the character and buildings in thescene, and add a full moon skybox.
Compared with the design drawing, which is kind of related!
Finally, draw a coin with moon in Blender, and adapt it via the Dcc materials, the entire scene is full!
Considering that the sport scene has greater than 1 million verts and the terrain is comparatively irregular.
The value of utilizing Bullet+Mesh Collider wll be fairly excessive, so the challenge determined to make use of a plug-in CollisionMaster from the shop (CollisionMaster | Cocos Store)
-
It is only some tens of KB in measurement
-
The built-in octree is optimized for giant scenes
-
Supporting ray detection, which is sufficient to write the logic of consuming moon desserts
2.0 Features Used
CSM Cascading Shadows
When CSM is turned off(proper within the image), the sides of the shadow are severely jagged. The motive is the low decision of the shadow map, when sampling the shadow map, a number of totally different vertices pattern the identical pixel, leading to aliasing.
After CSM is turned on, a number of shadow maps are used, high quality shadow maps are used close to the digicam, and tough shadow maps are used far-off from the digicam, which not solely optimizes the shadow impact, but additionally ensures rendering effectivity. This characteristic in 3.6 is souseful!
Animation State Machine
Player wants to manage the hen to leap up and down, and there are lots of states to be added. If we merely use skeletal animation, loads codes must be finished!
By utilizing the Marionette animation, the primary logic could be handed over to the state machine.
It solely must establish whether or not the character is on the bottom or leaping via a couple of easy states, after which the character motion could be switched simply with few codes!
In the sport, you solely want to change the state via ray detection. When the water floor or the bottom is detected, we are able to inform the present state to the state machine with out further codes!
Water reflection
The water floor materials extends the Standard PBR, and provides the UV circulate of the Normal Map, and the IBL of the sky field.
The fringe of the water is smoothed by AlbedoMap, (it is going to be unnatural to regulate the transparency of the sting by SmoothStep)
**My drawing for the water edge! **
Object Detection
Since collisionmaster doesn’t help bodily triggers for colliders, rays can be utilized for object set off detection.
Here, a ray is emitted from the highest of the top to the foot. When the grouping of the cash is detected, the space from the cash shall be returned in the results of the ray detection, and numerous logics could be written via the space.
Jump Detection
Jump detection additionally makes use of two rays, the blue one is used for roof collision detection, and the purple one is used for floor collision detection.
When the blue detection distance is simply too low, the upward motion pace of the character is decreased. When the purple detection is near the bottom, the downward motion pace is decreased, and the animation state is switched to strolling or idle.
Limited time ONLY!!
Free supply code Giveaways!!
During this week, till September 18th, the highest 10 participant with highest scores can get Jare’s Demo at no cost!
In order to make sure the equity of the sport, please ship the screenshots of your scores to the remark space to take part within the competitors!
How to take part
Upload your personal sport screenshots within the remark space ** (** ** Please don’t cheat** **, ** ** There are verification strategies hehe ** **), ** ** can take part This occasion ** **! **
Discord Server(Feedback on this Server!)
Demo Address : Jare Collects Coins! Click to jion the occasion!
[ad_2]