Post news RSS Football coding game for programmers

I want to tell you about my new game - FuncBall. It is a game for programmers about coding football. You do not control the players, but write scripts that contains conditions and actions to control them. The player programming language is very simple, but powerful. Even a novice can create a team and then play in the championship. This game is for true football and programming lovers. Everyone is welcome!

Posted by on

FuncBall - Coding football

Hello! I want to introduce you to my football coding game for programmers.
When long ago (more than 15 years), I had idea to write a soccer game, in which you do not control the players, but write scripts, that contains conditions and actions to control them.
Such games are called as games for programmers. This phenomenon is very interesting, but not new. One of the popular old games is Colobot. Now games for programmers are more widespread, because there are more people studying programming. But these games are not as popular as shooters and simulators, and it is understandable - not everyone interested in programming. However, I think that many of the experienced computer users can play games for programmers. Many such games are designed for children and are used to teach programming.
That first version of my game was very primitive: there was no full-fledged programming language in it, that would allow implementing complex branched algorithms with nested conditions. I often recalled that idea and, years later, decided to implement it, as I had originally intended.

FuncBall coding game

1. For each of the 4 players, you need to write a script, which is executed every 50 msec.
2. Each player controls only himself and does not have access to the memory of others, but can give them signals.
3. All players move at the same constant speed, but the one with the ball is slightly slower. No goalkeepers.
4. Scripts of players are executed in random order. The code of kickoff player is executed first.
5. The speed and duration of playing can be adjusted. There is an option to record matches.
6. I tried to make the language as clear as possible for beginners. Built-in script functions allow you to program almost any player behavior.
7. There is an opportunity to compete with other teams on the game website.

The language syntax is traditional:

Can write without brackets:

One more example:

In this case, it is checked, that if the ball is not with the third player, then player should run to the 10th square of the field. The dollar symbol exits current player's script executing.
Example with nested conditions:

In this example, there is a condition "player3_is_open". This is a function with the inclusion of an argument (3 is player number) in the name. In my opinion, it is readable.
In the code you can use arithmetic expressions in square brackets (I call it as macros), instead of which the concrete values are substituted at runtime. Example of through pass to player-4:

[X4+50] is the X coordinate of player-4 increased by 50, and [Y4] is his Y coordinate. Before executing this code, the macros will be replaced with concrete values, and it will look, for example, like this: If(ball_owner){kick:255,170}.
Macros can use built-in macro functions. Example, if the distance from the player to the opponent’s goal is less than 150 pixels, then shot on goal:

X and Y will be replaced by the player’s coordinates, and D(X,Y,559,188) will be replaced by the calculated distance from X,Y point to the point with coordinates 559,188 (goal coordinates). If it is less than 150, then the macro will be replaced with True, and if not, then with False, and it will turn out: If(True){shoot_goal}.

You can set your own variables. Each player can use only own variables. Variables are non-public, i.e. accessible only in code in which they are defined. Variables lifetime is until next kickoff (after a goal or leaving the ball out of bounds):

I decided the field be in the usual horizontal view. The origin (point 0,0) in the top left corner. When programming players, you should assume, that your team start on the left half of the field. Numbers of your players are 1-4, and enemies are 5-8. When playing on the right, all coordinates, square numbers, angles and numbers of players are reflected, i.e. your team will play exactly the same as on the left half of the field.
The editor allows you not to write all the code with your hands, but to insert the necessary functions by click. There is help for each function.

FuncBall team editor

When a team editing is finished, you can upload team file to the server (using team editor). After that, your team will participate in the regular championship. All uploaded teams will play among themselves, and the results and records of matches will be published on the site.
On the site you can also order matches with selected teams at any time (it's not free). Teams are automatically sent to execution server, where the matches are played, and then you can download match records.
So, I invite everyone to play! I think that there are many people who may be interested in this game, and I hope that this post will help to find them. I will also be very grateful for the reposts because the project is non-commercial and and really needs free advertising to attract more participants.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.