ChessBall

Hi,

I started a new game. It is a mix between chess and soccer.
At the moment you can play against an “easy, dumb ai” and a medium ai.

Rules:
To accomplish a victory get three points.
To score a point set the opponent checkmate or make a goal
To shoot or pass the ball, place one figure beside it. THe ball can now move like the figure. (If there is the queen and a knight near the ball, the ball can move like the queen and like the knight)
In your turn you can move one figure and pass/shoot the ball three times.

Next plans:

  • better ai
    - demo mode to watch/replay old games to learn or to relax done
    - an interactive tutorial to learn how to move the the figures/ball done
    - give the opportunity to write your own ai and load the ai done
    - an android version done

Website
Chessball Website

Download:
Download the alpha. You need Java 8.
Download the android alpha.

Trailer:

SGsYjD0pUZQ

Screenshot:

The frame is resizable but the content is not :frowning:
Which means I cannot play, my screen being too small in height :emo:

Your screensize is smaller than 800 px height?
Mhh ok, I choose the resolution 480x800 because the plan is to make an android game.

I uploaded a new version with some improvements:
1.) frame not resizable :wink:
2.) better font
3.) interactive tutorial
4.) now you can write and load your own ai.
5.) I made a website where you can download the game and get a short explaination how to write an ai (at the moment only in german, but I will translate it later)
6.) some little ai improvements

Next steps:

  • much better ai
  • demo mode
  • a little puzzle mode with some given line up-formations and you have to score a goal in one or two steps
  • android version

Yeah, my screen is about 720 px in height hahah — and you still have to substract the taskbar height :wink:

Thats an awesome idea, i can imagine, that there could be a lot of different tactics.
Also the 3 passes per turn give you some nice posibilities.
You really have to think about future turns, before moving, so that you might be able to execute a pass-pass-shoot combination.
Looking forward for the android version, i will definitely give it a try then!

A little idea:
Wouldn’t it be cool to be able to combine 2 figures? So you could have a figure, which moves like a knight and shoots like a rook.
Not sure if it fits the game…

A few questions:

  • The king seems to be the keeper, so if you shoot him with the ball, you don’t score right?
  • If you “attack” the king, does he need to move out of the range, as in real chess?
  • Can you also “eat” other figures, like in real chess?

It is. The ball can move like the figures that are near. If for example a queen and a knight are near, th eball can move like both figures.

The ball can only shoot/pass on a field which is empty. So every figure can block the ball.

Correct. All figures move like in real chess with the same rules. One exception is the pawn. He can move not only straight forward. He can also move sideways.

You can try the game. An alpha you can find here.

[quote]It is. The ball can move like the figures that are near. If for example a queen and a knight are near, th eball can move like both figures.
[/quote]
With combining i meant some kind of hybrid-figure. That means it can move like one type and shoot like another type.

New version is online.

What is new?

  • demo mode

If you wait 5 seconds in the main menu and you can watch an old game.
When you play the game and finish it, the game will upload it and the demo of the game is available for all. So you can learn how to play the game.

Next steps:

  • android version
  • puzzle mode
  • better ai

I’m kind of intrigued as to what that means. Care to elaborate? :point:

I tryed the alpha yesterday and i wasn’t really able to play it.
In the first try, after my turn, the AI keeped “thinking” for a few minutes, using quite a bit of my processors capacity (it’s an i7 4710mq).
After quitting the game using the menu.button i was not able to restart it, the “play” button did not react.
I restarted the game and then started with moving the queen. Then, for some reason, my turn immediatly finished and the AI started “thinking” again…
Not sure if i did something wrong…

Anyways, as i said, i really like this idea and i guess it could become really cool. Especially a multiplayer would be really, really cool!

At first thanks for trying the game =)

The problem with the ai at the moment is, it needs between 5 seconds and 10 minutes. Like I said I try to speed it up because I know it isn’t really playable at the moment against the ai.
After using the menu button the game tries to break up all calculations. But this can take a while too. =(

Your turn is automatically over when you move one figure and no figure from you are near to the ball. You can play only the ball when one or more figures from you are near to the ball.

But with your feedback I will work on the tutorial. =)

Run some calculations of what happens when you subtract two rows from each side. I want to know how much a performance hit it saves you on.

[quote]Your turn is automatically over when you move one figure and no figure from you are near to the ball. You can play only the ball when one or more figures from you are near to the ball.
[/quote]
Seems logical… Did not think about that… You might want to show a little information like “no moves available” or something like that? But thats just a little “nice to have”.

A new version is online.

New features:

  • ai tells more, now you can see if the ai is thinking or if the game “freezes”
  • the ai has only 180 seconds per turn, after that the current best move is taken
  • removed many bugs
  • ai is a little bit faster, but too slow for “a normal gamer” who dont want to wait ~2 minutes per turn.
  • nice android alpha version

next steps:

  • better AI
  • puzzle mode

AI Speed Problem:
The problem isnt the size of the gamefield. The “problem” is that you can pass the ball three times and move one figure. All in all that means you can have more than 600k possibilities in your turn. At first you have to analyse all that possibilietes and after that you have to pick the x best steps and watch what will happen when its your opponent turn.
It is really a nice problem but I cant find a good, fast solution at the moment. I use the alpha beta search but it is slow …

Use as little data as you can. That is the simplest answer I have for you. Instead of allocating 4 bytes for int, use a short - if it doesn’t reach that high. You could also speed up by using switch when available, delegating variables to be overwritten so new ones aren’t created for no reason, and cutting down on logic statements.

if(something)then
-- do stuff 1
else
-- do stuff 2
end

Instead of that do…


if(not something)then
-- do stuff 2
end
-- do stuff 1

On another note, a problem you could reach is trying to do everything at once to where the processor maxes out trying to do stuff. You could use your gpu to calculate instead. Pause rendering during it’s thinking time too. Anything the CPU sends to the GPU is considered bulky in this case.

I don’t think using shorts or switch* statements will have any measurable influence on performance. You need to prune the tree of possibilities, and the easiest way to do this would be to tweak the rules to make the moves less complex. Perhaps, only allow two kicks, not three? Or allow move+kick or nomove+kick+kick+kick.

  • From my understanding switch is only faster for longer lists of conditions, i.e. it is quicker to do a lookup based on the switch condition than to go though a long list of if-else statements. If it is a single if-else, the if-else may well be faster than the switch. In any case, I don’t think it is advisable to write tortured code for insignificant performance gains (assuming this would yield any performance).

Also to take issue with Hydroque’s example the the first example means “sometimes do 1, other times do 2”, while the second one means “sometimes do 2, but ALWAYS do 1”. So they are not equivalent.

You don’t know what you are talking about.

[quote]I don’t think using shorts or switch* statements will have any measurable influence on performance
[/quote]
They do in bulk and especially in java.

[quote]erhaps, only allow two kicks, not three?
[/quote]
or he could bolster the most common types of moves first. That will definitely make the # of times the longer waits will occur.

[quote]If it is a single if-else, the if-else may well be faster than the switch.
[/quote]
I am assuming he is.

I also have another suggestion, use recursive function loops. It would be neat to have a redirection system.

ags1 is right: your “solution” guarantees that stuff 1 always executes regardless of the something statement. No need to put down people for pointing out a mistake.

Function calls are fairly slow because of pushing and popping parameters onto the stack, not to mention you’d run into stack overflow issues if you’re recursing too far.

Errr…actually, ags1 is right. There’s no else statement to prevent 1 from happening. 2 MIGHT happen, but 1 always happens because there’s no condition for it to happen; it just happens.

I see what you guys are talking about now.

It’s a method on its own. I am not saying replace all if-elseif stuff with that, I said replace it with switches. That is the other form. When you are not using switches, you are using if statements or if else statements. If statements are fine on their own, but if you are using if-else statements, it only has two forms. If it doesn’t happen, go on to the rest.