🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

game development

Started by
7 comments, last by rafaelsantana 4 years ago

how to build a 2d game like super mario from scratch in c++? what are the things i should know? Could anyone elabborately answer my question?

Advertisement

Hi,
(I have no idea how good you are at game development, so I am assuming you have 0 knowledge)
Probably I would start with SDL or SFML or any other library that will let you make a window with C++ and render / draw stuff on the screen.
(There is less need to worry about OpenGL / Vulkan which will make things even more difficult.)
Then I would make at least two of these: Pong / Breakout / Snake (or at least something along that level).

Just to build a platformer, the knowledge required is at least:

- How the game play loop works
- Collision detection
- Input (keyboard, mouse)
- Animation
- Game states (options, main menu, game levels etc…)
- Rendering text
- Entity management (Entity component system, scripting?, how are game objects deleted….)
- Camera movement
- AI (enemies)
- How to tie everything together

By making these small well know games (Pong, Snake, Pacman…etc) you will gain the necessary knowledge and have complete games which will boost your confidence. It will be much easier to build a platfomer as you will be able to see what you did wrong before, build up a better understanding how to structure the game and finish it.

Hopefully this useful :)

I suggest not to use bare C++, but use a game engine. Godot has support for C++, Unreal Engine has one too, but it seems like an overkill. Or you can use GameMaker, Unity or anything else if you are not afraid of learning another language, both GML and C# are quite similar to C++, so you won't have much trouble

On the other hand, if you want to go full low-level high-performance C++, learn OpenGL and use it for rendering

Still, all the advice from ZerohBeat is very much valid

As someone who, many years ago, tried doing what you're doing (going into to GameDev using C++ and DirectX only), let me please try to persuade you to use an actual engine, like @ruslan0 recommends.

I must admit, I became so discouraged from the amount of coding and API knowledge needed to even get a window onto the screen that I never even got round to trying frameworks such as those that @zerohbeat recommends. It took me several years before I even thought about looking at an engine such as Unity.

Do yourself a favour learn to make games using Godot or one of the other engines BEFORE you try to build your own game AND engine.

I honestly wish you all the best.

Mike.

I think I already gave you an answer here:

https://gamedev.net/forums/topic/707073-2d-game-development/5427297/

Now you have three posts, several answers and likely two user profiles.
If you need more help, you should be more specific.

SuperVGA said:
and likely two user profiles.

Damn you're good. I thought I was good but now not so much.

https://gamedev.net/forums/topic/707063-a-c-begginer-with-so-many-questions/5427251/

What are the things that I should know?

And other similarities to many to be a coincidence.

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

fleabay said:
And other similarities to many to be a coincidence

Agreed - I didn't even spot that one!

Tset_Tsyung said:

As someone who, many years ago, tried doing what you're doing (going into to GameDev using C++ and DirectX only), let me please try to persuade you to use an actual engine, like @ruslan0 recommends.

I must admit, I became so discouraged from the amount of coding and API knowledge needed to even get a window onto the screen that I never even got round to trying frameworks such as those that @zerohbeat recommends. It took me several years before I even thought about looking at an engine such as Unity.

Do yourself a favour learn to make games using Godot or one of the other engines BEFORE you try to build your own game AND engine.

I honestly wish you all the best.

Mike.

Great advice, while making a 2d game engine from scratch is a fun project. It's a good idea to make an actual working game using an engine like Godot or Unity, get really good at it and then attempt to tackle creating your own 2d game engine. You will have a better understanding of how the mechanics work.

I have been working on my own 2d game engine for 1 year and 6 months now. The core of the engine is complete and at the moment I am writing classes to represent objects but still much much work to do. I would say another 1 year and a half and it will be complete, the first iteration that is and we're talking a very general 2d game engine.

Sorry to hear that you became discouraged in the amount of code, I can speak from experience and say that yes, there is a LOOOOT of code you must write but most of the code that you write for a 2d game engine is very mathematically oriented, you'll be working with a lot of algorithms that you will have to code yourself, some of which may make no sense at first but then come into fruition later.

I can say the heart of your 2d game engine will revolve around the class that represents every single sprite on the screen, overtime you will implement a lot of features to represent/manipulate sprites to get them to do something on screen as a general rule, its best to work with square shapes for a simple 2d game engine for example base all your art work on a tile width of 100x100 or smaller depending on what you're trying to achieve and then render the tiles.

It has been a challenging but fun as well and I can't wait to churn out a game with it.

I plan to create a user interface that is compatible with Windows and release it to the public to allow individuals to create their own games with it and submit feedback to help improve the engine…this is still a long ways out.

This topic is closed to new replies.

Advertisement