New Soccer Games! Get The Source Code In The Store!

The “Soccer Game Source Code Contest” launched by the Cocos Store has ended recently. During the month and a half, many developers submitted their source code to the Cocos Store, along with detailed technical explanations.

Today, we have selected a few quality source codes from this event. You can head over to the newly updated Cocos Store to download them, hopefully bringing you some inspiration and reference.

Football Frenzy

bd0943be3725c83307e9ea98500a1192a4a7092e_2_690x346

Developer Rock has developed this 3D 7V7 football game based on Cocos Creator 3.6.2 in one month. The player controls one player of the team, and the rest of the players are controlled by AI. During the game, the player can change players to the closest player of the team.

Developers Notes:

1. Roles

For many individual developers, the most significant shortage when it comes to game development is probably commercially available model resources. Since I am not from an art background, I can only say that the simpler you make it, the better. Let’s start with character design.

After designing the model, it needs to be colored. Considering that we want to publish this to the WeChat mini-game, we want to make the resources as small as possible, so we don’t use mapping here but just set the material ID for the face and assign different colors to it.

The face has a flat surface applied to it for applying expressions. The advantage of doing this is that you can dynamically change expressions later by changing the face mapping. The current face is simply drawn with an expression.

image

2. Movement

Then comes the main event - character movement design, of course, using the site Mixamo!

image

Just upload the finished model, and select a few key positions on the model. The website can intelligently bind bones to the model, so you don’t have to make your own bones, skin, or paint weights. There are various actions on the website that you can assign to the model directly, then save it as FBX and import it to Cocos Creator. Of course, you can also use other 3D software to make further modifications. The site is all free, and many of the game’s character actions are downloaded from here.

  1. Scene

After I drafted the characters, I started to build the game scene by hand with materials in Blender, and in less than a week, my modeling was done!

image
image
image

The scene is put together in Cocos Creator after each part is made, or you can make the whole scene and then import it into the engine. Still, I personally prefer to build it in Cocos Creator. I used Cocos Creator to develop my own mesh for all the models I could put together with cubes, and the final look is very good.

  1. Technical points

The whole game does not use the physics engine. It’s all collision detection and motion logic. The main difficulties are: ball rolling, long parabolic shots, touching object bounce, character’s motions, goalie logic, etc.

Because this is a 3D game, goalkeeper logic is the most basic. Not only to guard the ball on the ground but also to guard the ball against all directions in the air, which requires the goalkeeper to judge the ball’s trajectory before blocking.

The game project will continue to be updated and iterated with the updated content and the implementation of crucial logic code. I will also share it with you on the forum post. I hope this source code will help you!

Resource Links

Source Code Download - Cocos Store.

Cocos Store

Forum posting dedicated to the game.

3D足球小游戏《足球快斗》微信和COCOS商城同步上线,分享我的制作心得~! - Creator 3.x - Cocos中文社区

Goalkeeper

Goalkeeper is a 2D soccer goalkeeping game developed by White Jade No Ice using Cocos Creator 3.6.1. The gameplay is simple: watch the screen and swipe to control the glove position and block the incoming soccer ball. The resources used in the game are all 2D resources, and the implementation is a 3D physics simulation with 2D images synchronized.

Developers Notes

White Jade No Ice provides a detailed analysis of the game’s implementation in sequence frame animation, synchronized 2D performance (position synchronization, scaling), touch synchronization, and core code.

Resource Links

Source Code Download - Cocos Store

Cocos Store

Qatar World Cup

640 (3)

The casual mini-game “Qatar World Cup” from the developer carolsail is entertaining to play and has strong playability. The player presses the screen to build up power and releases it to play the ball, avoiding the defenders, passing to our player, and putting the ball into the goal. Each successful pass will automatically add up energy. When the energy is full, the next pass will be a “sure kill pass,” which can directly break the defender.

The logic of the defensive player is mainly to intercept the soccer ball, and the AI mode is currently set to two kinds of straight-line movement and circular movement. During the game, players can use various props to interfere with defensive players or give themselves more energy, such as red cards to make a defensive player leave the field, yellow cards to slow down a defensive player, etc.

Resource Links

Source Code Download - Cocos Store

Cocos Store