Where to get a tutorial?

Before you start linking me gamefromscratch, the official docs, etc., I’ve already read all of them, and I found them enlighting! The only problem with them is that they simply showcase some really basic features, nothing more, they don’t provide the workflow for using cocos2d-x.
So I wanted to ask, how did you learned cocos? Can you suggest me something? Thanks in advance :slight_smile:

P.S. I don’t know, maybe I find this all confusing because I come from libgdx, and to succefully build a game, it was a good pattern to declare the WorldController, Rederer, etc. and write all the code

2 Likes

I very much agree with you.
The official coco tutorials are very basic.
@slackmoehrle are there plans to improve them?

@Andrea98, in my case, I am an active user in this forum and I ask all my questions here. But I agree with you, if we had better documentation, it would be better.

1 Like

When a person asks for more documentation, especially when there is a decent amount of it (including demos), they actually mean to ask one thing:

“Where is the step by step guide to help me write MY game?”

The answer to that is: It does not exist.

Cocos2d-x is a game engine, and it’s no different than any other game engine. Think of it as both a toolbox and a set of building blocks. How you use it is completely up to you, and the current documentation, along with the demo application, are there to show you what is possible with this game engine; they are not there to guide you step-by-step in writing your game.

Think about this example for a second: How many different ways does one need to document the creation and movement of a sprite? Once you see how it’s done, what else do you need? How you use this knowledge is really up to you.

The current documentation may not be comprehensive, but there are plenty of demos and related source code (cpp-tests for example) that demonstrate the majority of the core parts of Cocos2d-x. Nothing about these demos is hidden from you; the source code is right there for you to browse through, and it’s quite easy to understand (assuming you know the C++ language, and if you don’t, that’s no fault of Cocos2d-x).

Now, I know that many new developers tend to go through the same motions when working on any kind of application (not just games). What happens is that they aren’t quite sure where to start, being a little overwhelmed by the different aspects of their project. Their focus tends to be on everything… literally everything… which IDE should they use, which framework, which platform etc etc. Sometimes it’s because they really don’t know, but more often than not it’s because these things already exist, so not much thought has to go into it. It becomes about wasting time choosing something, for example, engine X vs Y vs Z, and discussing the finer points of X, Y, Z engine, than to have to think about the design of their game or application.

It’s easy to lose yourself on what is irrelevant (at least in my opinion). If you take a step back and really think about it, you may come to the conclusion that none of those things really matter (note, they do, but not for the point I’m trying to make here).

When you design a game, you are creating the structure and flow of the game, and that should not be tied to a specific programming language, framework or engine; how your game is supposed to play has nothing to do with rendering, audio, platforms, or whatever other technical aspect that is used to implement the game.

So, start planning out your game by work out the game design. Once you have this, break it down into manageable pieces, and repeat this process until you get to the most basic functionality. For instance, does your game have a player character that can move around and hop over things? Great, let’s break that movement down: left, right, forward, back, etc etc… and let’s not forget jump. Assuming you did break down the movement into the most basic functionality, this is where you should end up:

player.jump();

Once all of this is worked out, guess what? Now we get to the other fun (?) part, how do we implement this “jump” in the game engine we have chosen to use? You know what you’re looking for, so you can check the documentation and demos to see if there’s an example of this functionality, and there most likely will be. If for some reason you can’t work it out, then guess what, you know exactly what question to ask to enable someone to help direct you to the answer.

Documentation, while it’s great when it’s there, is not really going to help you write your game.

1 Like

It’s not that I need a step by step guide.
As I said, I already developed a game using LibGdx (Java), and I already know the game development principles. What I would really need is a “template” to follow. I know that there are many ways to achieve the same things. As a matter of fact I can put everything in the “HelloWorld.cpp”, without caring to much that this is probably the worst approach, even if it would work just fine. But anyway, I bought a book that seems to work for me, even if it’s for cocos2d-x 2.x, it should work just fine

1 Like

The thing is - there will be no any tutorials or good docs, examples and support of them. This engine actually already dead for me, but I need to finish my current game with it and then move to Unity. No other options. My publisher works only with Unity, when I said that I’m using cocos2d-x, they asked - what is this? why? Now I have a lot of pain working with them because of that and overall with the engine.
Nowadays 99% of games developed in Unity and you should realize that this engine is just trying to look like not abandoned, but it is and support of it is just low quality overall, no real contributors with real improvements. Try to ask some real technical question here and you will not get any real response.
Ask yourself why any good tutorial sites also stopped creating tutorials and example for this engine?
So, I’m highly suggesting you to skip this engine and use Unity. This will bring your game to complete and finally published with some good publisher and intergraded any SDK or ads will be easy. Saying that - check just top SDK’s for iOS and android, they all have Unity plugin as integration option, its like mandatory, they should and will support Unity.

I wish to hear in my direction the same advice 1 year ago… just run from here!

I’m almost certain that what you stated is not true regarding the 99% of games being made with Unity. Making such a claim with backing it up with factual data just causes people to not take your posts seriously.

Andrea, I understand what you’re getting at, but in your initial post you’re targeting Cocos2d-x, stating that there isn’t enough documentation etc., but you quite literally just stated that you want a guide on how to structure a game, even giving the example of putting everything in “HelloWorld.cpp”. How does that have anything to do with Cocos2d-x? That would be the same issue regardless of which engine you choose to use.

What you’re after is a more general software development book that helps you learn good coding practices. Any decent development book will suffice, and one that may help you a lot is Code Complete 2nd Edition.

We hear this a lot. Documentation doesn’t include enough information for new developers. We don’t advertise that we are Unity or Unreal. You definitely need c++ (or javascript) knowledge when you start working with our engine. We seem to attract a number of developers that are very new to programming and want to make their first game.

I am starting on this: https://github.com/cocos2d/cocos2d-x-docs/pull/185

I’m adding making a complete game start to finish as part of the documentation. Each chapter, at the end, will have a section that uses the concepts you learned to work step-by-step towards a complete game.

It may help with understanding concepts, but the API calls will be different. How you handle events is different. How you deal with the dispatcher and rendering and and and and is different.

Well, I know that a lot of games are made with unity, but (and this is just an impression) I think that unity forces you to go through a “scheme”, which is something you are not forced if you directly coding your game. And another thing, is that I can’t pay for unity (not because I actually can’t, but because being a student, every thing has to be paid by my family, and I can’t afford it).

That was an example I made regarding the fact that, yes, you can code however you want but no, not all solutions are good. I’m not saying this is something related to cocos. And I think that every game engine has his own pattern of workflow, depending on how much stuff is already made by the engine and what not. Making again a comparison, LibGdx, the only thing that offered was a Scene class, which had a constructor, an update and a render method, everything else had to be made by hand. Lucky I found a good book/tutorial, which gave me a starting point, after that, I went alone with the docs. I know that this issue is not of cocos, just saying that it would be way easier for me not to discover by myself a good pattern code with cocos, but having a “template” to start with

I’m not so strong with c++, but I can code with it and understand others code without any problems. The problem, as I already said, is that, since I don’t want to end up with a messy code, I would really enjoy a template of a project (a real template, not a simple showcase of features) I can study and copy, nothing else.
Yeah I know that a lot of things will be different, but again, I just need to see how the book sets everything up

The project setup will be different as well. I’d just run cocos new ... and take a look at that project. That will get you started. Then use cpp-tests as needed to see how features are implemented correctly. The Docs and API Reference can also help. Best of luck!

I dunno man, cocos is great, I’ve made 3 games in it, but the docs are easily the weakest bits.

How do you use ui::RichTexts, and what is the XML format? It’s not the one you see on the Creator docs, its actually <font color='#FF00FF'>colored text</color>, instead of <color=#FF00FF>colored text</color>.

If you wanted to set your ui::Layouts up to use the layout manager, how does that work? How do you change the font of a Label, when there’s 3 different ways to do depending on the type of font you’re using. Why is ui::Button's label renderer ignoring my positioning for it? Why is my_sprite->setColor(Color3B::WHITE) doing nothing? When should I override onEnter, when do you need to use a scheduled function vs overriding ::update, etc etc

There’s a ton of little quirks of the engine that isn’t explained anywhere other than in cpp-tests sometimes. I’ve had to look through the source for answers to all of these sorts of things but having a comprehensive up-to-date docs would go such a long way.

In an unrelated project, Python’s Django, you can just look up just about any aspect of it and if there’s not a built in tutorial on how to use it, you’ve got a paragraph or two explaining every little thing, cross referenced to related concepts.

Cocos2d-x is great, but its documentation is seriously lacking.

1 Like

I totally agree with you regarding the written documentation not explaining how certain things work, but I personally consider the sample project to be part of the documentation, and like you, I’ve had to dig into the source code to figure out how things are done because they weren’t explained anywhere else.

After all these years (decades!) working in this field, I’ve come to realise that the problem with many projects, if not most, is that the documentation doesn’t quite keep up with the implementation. In those instances, once the issue is discovered, then it’s just a matter of notifying the responsible parties to update the documentation.

One this is for certain though, Cocos2d-x is great for what it is, and can only get better with constructive input from the developers using it.

1 Like

Sorry, I haven’t been very clear, when I say set up, I mean how the code is structured, the general pattern to follow. I’m not using that book to get API explenation or something else, just the general structure of a game made with cocos2d-x

I’m very much agree with @TankorSmash
@R101 , from my point of view, cpp-examples aren’t part of the documentation. It’s only examples.
Documentation is the explanation with words of how something works. Reading a code is not the same as reading explanations with words.

It’s only my opinion. Cocos is awesome, but if the team wants to promote it, they should put more focus on the documentation.

You should ask yourself, why? Open-source project can only live if it’s supported by donation, like patron service.

That being said cocos2d-x isn’t going away because we don’t get donations from our users.

I think when you develop something, and it’s shared with the public, you like it to be used. That’s what I mean with promotion :slight_smile:

If you are sharing your code with the public, you are promoting it, you would like it to be used. Ok, if you want it to be used, listening to the advice of each user is very important.
@slackmoehrle listens to users, I’m sure :slight_smile: