Creating Solo Game

Hi,
I’m trying to create a solo game, it is the first time i’m making a “solo game” contribution.
I’m following this documentation : Coding Games and Programming Challenges to Code Better
First i want to say that the given skeleton in the documentation is made for multiplayer game, not solo game. Maybe CG could give another skeleton for solo games ?

I’m studying the example (fishy adventures) but i think it’s too light, so i’ve just downloaded an other contribution from CG’s puzzles. I won’t criticise the example, since i’m just beginning to watch it, but there is something i didn’t find : where do we write the statement for a solo game ? I saw that the optimisation puzzle “block the spreading fire” is traducted in french, is it possible to do the statement in english and in french for solo games too ?

Thank you in advance for your answers, i think i’ll have a lot of questions to ask.
(and sorry for the english mistakes).

3 Likes

Hi Remi,
for the statement you can access it by going to localhost:port/statement.html
for the stub (inputs) you can access it by going to localhost:port/stub.html
the default port is 8888.
To have two statements you need to name one statement_en.html and other statement_fr.html , e.g. GreenCircle/config/level4 at master · societe-generale/GreenCircle · GitHub
For solo game I would probably use 2048 as a reference https://github.com/eulerscheZahl/2048/blob/master/src/main/java/com/codingame/game/Referee.java

1 Like

Thank you for your answer. I downloaded Escaping the cat but i’ll take a look to 2048 too.

Hello,
as the author of 2048: there are some extra twists in it, which you probably don’t need (if you watch the full replay, it can take you over an hour - you need some javascript to fit that into the 1MB limit).

For a more basic example I suggest Sokoban. It uses the common things like Group, Sprite, SpriteAnimation which you will probably need, but nothing too fancy.
Of course there are many more to look into, most of which are open source.

If you start from something else than the official skeleton, make sure to insert the most recent SDK version in pom.xml.

I start from the official skeleton, i think i found what to change to do a solo game.
Thank you for the examples, i’ll watch it too.

When i ran the example it started without asking question, but when i run the skeleton, i have to choose something. Do you know what is the good choice ? I tryed the two first.

Sans titre

It seems that i have to choose java application then web server, but it doesn’t work, i probably missed to configurate something.

Why does gameManager.getPlayer().getOutputs() return a List(String) instead of String ?
Does the player can enter several lines in one turn ?
I can’t launch the game so i can’t verify by myself.

Is there any documentation about this ?

Thank you in advance.

Yes you can change the amount of lines of output you want here

public class Player extends AbstractSoloPlayer {
    @Override
    public int getExpectedOutputLines() {
        return 1;
    }
}
1 Like

Ok thank you, i didn’t know it was possible to configure the number of lines.
I saw this function in Player class but i didn’t understand it was for that.

Any idea for my other question above ? about how to launch the application in eclipse.

I have no idea sorry, I use IntelliJ and it works pretty well for cg sdk, it downloads all the required dependencies and all you need to do is run the SkeletonMain.java.

On the projects I worked on, mvn clean install (so I guess it’s your Maven clean, followed by Maven install) would usually clean up the previous target then install all the dependencies and build the project. Then you might be run the Java Application after all dependencies are resolved.

1 Like

Ok thank you, i’ll try that, when i’ll be on the good computer ^^ i’ll tell you if it works or not.

Actually it was not necessary to install dependencies, i had to do the good choice after “java application” (the Main class). I didn’t see it before, because of the lots of possible choices.
Now i’m not stuck anymore … (until the next question lol)

1 Like

Please i need help ! I hope this is the last time.
I can’t export the project to upload on CG.
“Error: Bad Request” when i click on “Export Project”

Some informations from the console :

Can someone tell me what happens ? It is the last difficulty for me to finish the contribution.
Thank you in advance.

I dowloaded another contribution (2048, optim), and when i launch it the export works … so it is not a problem with the browser. I’m checking every file to see what can be the difference, but i see nothing.

check with euler or someone else on the discord, it’s past Old Man Euler’s bedtime now but if you tag him he’ll see it tomorrow. Or put it in the game_puzzle_creation thread

1 Like

Thank you but Zorg just helped me to find it was from a JSON file bad formatted.
Problem solved. :slight_smile:

4 Likes

Awesome! @Zorg1 to the rescue :slight_smile:

2 Likes

my skill : reading obscure java message to undestand strange and unrelated error message (seriously ‘400 Bad Request’ why not ‘1515 Taco not edible’ ?)

3 Likes