Learning C++ and making a GAME WITHOUT A GAME ENGINE

  Рет қаралды 107,826

Chadderbox

Chadderbox

Күн бұрын

I decided to finally take the plunge and learn C++. In this video, I use the Raylib game framework to make a simple space shooter.
//Links:
Source code: github.com/Cee...
Propulsion: bit.ly/Propulsi...
Barji's tutorial: • Video
Discord: bit.ly/Chadder...
Space Shooter Environment Asset: ansimuz.itch.i...
//Videos you might enjoy:
Inspiration for this video (aside from the countless requests too): • Making a C++ Game with...
Making a game without a game engine in Python: • Making a GAME WITHOUT ...
I Put The BIGGEST Game Devs in a Boxing Match (feat. Dani): • i made a multiplayer b...
Going all in on my Rust Voxel Engine: • Going all in on my Rus...
#chadderbox

Пікірлер: 132
@Chadderbox
@Chadderbox 3 жыл бұрын
I also learnt a bit of Python and made a game without a game engine in that, check out the video here: kzbin.info/www/bejne/qqDUqaFtoZqlfrc
@franklimburns7938
@franklimburns7938 2 жыл бұрын
Good video tho just thought maybe u could add that to ur next project. Very cool stuff man
@costelinha1867
@costelinha1867 2 жыл бұрын
Python with pygame is a blast, I was wondering if it was worth it to try and learn some Lua to make some short projects with pico-8.
@sky_beast5129
@sky_beast5129 2 жыл бұрын
C++: Have you ever heard of Memory leaks? Beginner C++ programmer: No. C++: *Would you like to?*
@greg77389
@greg77389 2 жыл бұрын
And then there's seg faults...
@skilz8098
@skilz8098 2 жыл бұрын
And there's invalid and dangling pointers and references...
@rmt3589
@rmt3589 Жыл бұрын
I think KZbin Shorts has a memory leak. Each short makes my phone run slower, till KZbin crashes, then it's better.
@dylancode
@dylancode 5 ай бұрын
​@@rmt3589 KZbin shorts definitely entice an "attention span leak"...
@Ich_liebe_brezeln
@Ich_liebe_brezeln Ай бұрын
tbf, good use of RAII makes it very difficult to have memleaks (unless you get the destructor wrong ofc). Segfaults can still be a problem, though.
@breadpebbles2603
@breadpebbles2603 3 жыл бұрын
I'm learning C++ to make games as I can't run things like unity and unreal
@spekulatiu
@spekulatiu 3 жыл бұрын
Me too... But i find no Tutorials on 3D game setups without Game Engine :(
@breadpebbles2603
@breadpebbles2603 3 жыл бұрын
@@spekulatiu openGL or vulkan C++ tutorials is the way to go if you have s old CPU openGL is the way to go and at first it may seem like vulkan is supported but later on you might find out some extensions you need are not
@أدهم-ح6ط
@أدهم-ح6ط 3 жыл бұрын
Me too very sad
@jossiefxd
@jossiefxd 3 жыл бұрын
my pc can run unity it's just it takes to much storage
@Chadderbox
@Chadderbox 3 жыл бұрын
@Jossiefxd same lol, I have tons of storage on my D drive but it still installs most of it to C and I'm running out.
@GamesBySaul
@GamesBySaul 3 жыл бұрын
Great video! I am learning/using C++ now so hearing this was quite a good way of me going back over some of the basics (and I surprisingly remembered most of it!)
@Chadderbox
@Chadderbox 3 жыл бұрын
Your superhot project does look awesome, I wanna see how far you can go with it.
@GamesBySaul
@GamesBySaul 3 жыл бұрын
@@Chadderbox Thanks I appreciate that! (I'm wondering too X) ) - What's next for you though? Try out a new language? Using C++ more?
@Chadderbox
@Chadderbox 3 жыл бұрын
I'm honestly not sure. I've been eying up Haxe, but I've also been challenged regarding my dislike of Lua, but I've got no internet and it is kinda hard to do both of those options right now.
@GamesBySaul
@GamesBySaul 3 жыл бұрын
@@Chadderbox Oh yeah I saw about your internet issues, not heard of Haxe, so I'll have to Google that. But you using Lua would be rather funny, maybe a video "proving" why your dislike of Lua is justified
@Chadderbox
@Chadderbox 3 жыл бұрын
I like this idea haha
@whenthethebeansstrikeback6728
@whenthethebeansstrikeback6728 Жыл бұрын
Reject Game Engine, return to C/C++
@iddjdjdjjwkejduwi
@iddjdjdjjwkejduwi 8 ай бұрын
Yes.
@qwerty273
@qwerty273 3 жыл бұрын
Collision is quite simple, and using AABB, it’s as easy as one ‘if’ statement. // If the first rectangle is in between the second rectangle horizontally // Meaning, that the left side of the first rectangle is to the left of the right side of the second rectangle // and the right side of the first rectangle, is to the right of the second rectangles left side if(x0+w0 > x1 && x0 < x1+w1 && // And the first rectangle is in between the second rectangle vertically // Vice versa for the Y, same algorithm, but replace ‘x’ with ‘y’, and ‘w’ with ‘h’ y0+h0 > y0 && y0 < y1+h1) { // Collision has occurred return true; } I know you probably know how to do this, but I just wanted to show an example of AABB with comments.
@Chadderbox
@Chadderbox 3 жыл бұрын
Yep, AABB is awesome and it is what Raylib uses, but my problem tends to be using it on a larger scale and making something that doesn't destroy performance and is also expandable. I have never actually implemented AABB and it is pretty interesting, thanks!
@qwerty273
@qwerty273 3 жыл бұрын
@@Chadderbox Oh ok, you’re welcome :). Yeah, using it on a large scale can be very expensive. One way that I’ve seen is to check the distance between the object (in your case, just x) then if it’s close enough calculate if it’s colliding. Player width + some large enough value like 64-96 could be what you might check against for example. It saves a bit on performance, but there are probably better ways.
@islandcave8738
@islandcave8738 2 жыл бұрын
Thats the basics of collission detection, but collission detection is a whole field in itself. Quadtrees, octtrees, mid-frame collissions, detecting which sides or edges collided, between-frame collissions of rotating or morphing objects, pixel perfect collission, etc and different combination of these concepts
@jonathanmatta7902
@jonathanmatta7902 3 жыл бұрын
The videos are short, entertaining and informative Noice Love it!
@Chadderbox
@Chadderbox 3 жыл бұрын
Thanks a lot :)
@VioletGiraffe
@VioletGiraffe 2 жыл бұрын
Managing memory in C++ is not hard at all (unlike C), but it requires that you use the right abstractions/tools and do not use the wrong ones, e. g. do not do raw memory management at all if you can avoid it (in 99.5% of the cases you can). So it is hard for a beginner until you learn what to do and what not to do.
@CharcoolDev
@CharcoolDev 3 жыл бұрын
Game looks cool! It’s amazing that you even made that without a game engine
@pekkak.1411
@pekkak.1411 3 жыл бұрын
"I don't like the way headers work". There is now new feature in latest C++ where you can use "modules". So no more #include nighmares :). I was just looking it myself, I like the idea.
@Chadderbox
@Chadderbox 3 жыл бұрын
Seems interesting
@barj
@barj 3 жыл бұрын
Awesome dude. Welcome to cpp gang
@Chadderbox
@Chadderbox 3 жыл бұрын
Thanks a lot, I think I might stay with it for a bit :)
@williammoiser8652
@williammoiser8652 2 жыл бұрын
Just an FYI on your code, switching out std::vector for std::list did not fix your issues, just covered them up. What is happening is two things: 1) When you delete an Enemy, you don't remove it from the list so the update function calls update on a "Dead" enemy. 2) When you do remove objects from gameObjects, it invalidates all the iteration references causing the loop to overrun the bounds of allocated storage. The main way you could fix this is by adding a "garbage" array that stores the pointers that need to be removed, then remove them after iterating, rather than removing them on the spot. Additionaly, if you are going to new a bunch of things, you can wrap them in std::unique_pointer or std::shared_pointer so that delete will be called automatically when it goes out of scope. I hope you do more C++ projects in the future as this was very entertaining to watch. Good Job!
@DrZygote214
@DrZygote214 Жыл бұрын
The way i fix this is by iterating *backwards* over the list. The crash probably happens when you wanna delete and remove the last spaceship in the list, but then your size became smaller and your current index is invalid. But iterate backwards and you can delete and remove at the same time and just continue on. I know it sounds weird at first but if you just spell out the code and look at it, you'll see how. I think this is a much better solution cuz no extra list to create and maintain, but you do have to remember the right order of the backwards list for important stuff.
@Scotty-vs4lf
@Scotty-vs4lf Жыл бұрын
@@DrZygote214 at first i thought it wouldnt work but 5 minutes later i realized the devils in the details. i forgot when u iterate in c++, your not just taking array[i--] ur actually iterating to the current previous object, so if index 4 removed index 3, then next it wouldnt do dostuff(array[3]) it would end up being dostuff(array[2]) if that makes any sense. ive been using c too much
@KeyserTheRedBeard
@KeyserTheRedBeard 2 жыл бұрын
fascinating content Chadderbox. I broke the thumbs up on your video. Maintain up the superior work.
@Chadderbox
@Chadderbox 2 жыл бұрын
Thanks a lot :)
@TylerGreen
@TylerGreen 3 жыл бұрын
This was really interesting. I agree about the library and headers with C++
@johnreyesogon8424
@johnreyesogon8424 2 жыл бұрын
Bro your really great starting from scratch that is so nerve cracking keep it up!!! you have a bright future up ahead
@achyuththouta6957
@achyuththouta6957 2 жыл бұрын
I tried making something like this using SDL libraries some time ago. It's really difficult and requires some linear algebra. There was a tutorial online too. Don't remember the name though
@MorganIron
@MorganIron 2 жыл бұрын
I just completed my Associate of Science in Software & Database Development and had a semester of C++, I remember it being fairly easy... but that's literally all I can remember about it.😅 I can't remember a single project that I did. It was my thickest textbook too. 🤷‍♂️ I've spent the majority of my time with Python(for PC and Raspberry Pi) and Java in Android.
@nikolais6452
@nikolais6452 2 жыл бұрын
c++ is super difficult, when you start to dive in to more complex code (bad error messages is huge oversight), a quote from the creator is: "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off"
@nubdevice7404
@nubdevice7404 2 ай бұрын
This guy knows. Raylib rocks.
@pauloassis7649
@pauloassis7649 Ай бұрын
Well done! But you need to make the destructor virtual if the class is part of inheritance.
@TimelessGamingSoftware
@TimelessGamingSoftware 5 ай бұрын
raylib is a game engine
@poopcoder468
@poopcoder468 17 күн бұрын
It's a framework
@danser_theplayer01
@danser_theplayer01 Ай бұрын
A list is apparently like a javascript array, an object with some hash shenanigans going on so when you add or remove values to it they have a designated ordered index. A vector is a solid block in memory (typed array in javascript) which is probably why you crashed, adding and removing from that is a bad idea... That's how I recognised what's going on, just to make sure I had to look up if a c++ vector is what I think it is.
@Ich_liebe_brezeln
@Ich_liebe_brezeln Ай бұрын
Actually, a list c++ is a doubly linked list (you also have forward_list which is a singly linked list), it's still ok to modify from one as the process of insertion and deletion does not change the place in memory of the other objects, keeping stuff like iterators and references to its contents valid. C++ also contains map and unordered_map which I guess they are closer to what you describe in your first point.
@georgecop9538
@georgecop9538 2 жыл бұрын
you can make something like a garbage collection in C++ : create a mem_area class and add free/delete in the destructor
@Steveplays28
@Steveplays28 3 жыл бұрын
Well done Chadder! :D
@Chadderbox
@Chadderbox 3 жыл бұрын
Thanks mate :)
@nachaboy2991
@nachaboy2991 Жыл бұрын
Im going to make my dream games with this
@oosubhisara
@oosubhisara 2 жыл бұрын
What I don't like about C++ is header files and build system. With Dlang I get things done faster and it's easier to maintain.
@Chadderbox
@Chadderbox 2 жыл бұрын
Fair enough
@gideonunger7284
@gideonunger7284 2 жыл бұрын
"didnt have a problem with pointers" "idk why vector crashes but list doesnt" dont think you did understand them after all buddy xD
@xaralabosxatzoglou3631
@xaralabosxatzoglou3631 2 жыл бұрын
Fr you are very underrated.
@Chadderbox
@Chadderbox 2 жыл бұрын
Thanks a lot :)
@thebricktop
@thebricktop 2 жыл бұрын
barjis video went private
@Chadderbox
@Chadderbox 2 жыл бұрын
Yeah I noticed a few days ago when I tried to send it to a friend
@thebricktop
@thebricktop 2 жыл бұрын
@@Chadderbox any good replacement for my students?
@Chadderbox
@Chadderbox 2 жыл бұрын
I've asked Barji to see if he can unprivate it, but for now it might be worth looking at mingw-w64.org Edit: I should add that I don't really intend for my content to be used for education since I am more of a "professional idiot" than teacher and often I don't really know what is going on.
@thebricktop
@thebricktop 2 жыл бұрын
@@Chadderbox so am I but I'm getting paid
@Chadderbox
@Chadderbox 2 жыл бұрын
The video should be unlisted now
@ChadderboxDev
@ChadderboxDev 3 жыл бұрын
what would you call the greatest video game ever (excluding that one about them things, you know, the one where you have to do something to complete the missions then when all the missions are over the game ends, you know, the game that was on steam and had music in it, you know, the one that was made by them people in that country with the government, you know, the game with the mechanics, like, you know the one where if you press buttons on your keyboard/mouse things happen, you know, excluding that one, and portal 2)
@Chadderbox
@Chadderbox 3 жыл бұрын
reply
@Chevifier
@Chevifier Жыл бұрын
Try Making a game with an arduino kit with an LCD display. It was fun. I dont even want to pull it down. It has 3 buttons(requiring 3 wires each) and the LCD display hooked up to a Breadboard and Arduino Uno😅
@ChiefAsian
@ChiefAsian Жыл бұрын
Hey, I would like to know if you made your own code from scratch for this project. I'm asking because I'm doing coursework for my Computer Science class in which my project is making a game in C++ - the marks for the project being your own code. If it is, could you give some tips? My own coursework is due in 2 months and i've had to switch project ideas entirely. Thank you.
@QUIZTIME184
@QUIZTIME184 7 ай бұрын
Can you make 3d game without game engine but in c++. I know you all redy uploded a video but in c.
@deaffatalbruno
@deaffatalbruno Жыл бұрын
using smart pointer is kind of a memory management for C++. shared and weak ones normally do the trick.
@Chadderbox
@Chadderbox Жыл бұрын
Interesting, I'll have to learn about them :)
@deaffatalbruno
@deaffatalbruno Жыл бұрын
@@Chadderbox def, they are bread and butter in C++,... shared pointer is the best to managed lifetime of object, while weak pointer is like an observer, that might want to interact with an object, but doesn't want to keep it alive.
@StarFury2
@StarFury2 Жыл бұрын
While the headline is not wrong, it can be a bit misleading - raylib is a framework but it could be considered as game/multimedia language as well.
@syaoranli7869
@syaoranli7869 2 жыл бұрын
Can you not allocate some of that memory onto an external hard drive to make room in your ram? Genuinely asking because idk what it means to run out of memory
@Chadderbox
@Chadderbox 2 жыл бұрын
Well, you only have a certain amount of bytes in your RAM, so when you use them all there is no memory left, and the program can't make new things so it crashes. Windows actually does have something where it will try to move some bits of memory onto your hard drive so you can use more, but it is ridiculously slow and not a good idea.
@LetThereBeMayhem
@LetThereBeMayhem 3 жыл бұрын
How'd you learn Raylib and C++? Did you read documentation or use tutorials? I'm having troubles with it.
@Chadderbox
@Chadderbox 3 жыл бұрын
Read the documentation (the raylib cheatsheet is amazing), along with talking to people in the community and generally having an idea of how object oriented languages worked beforehand.
@LetThereBeMayhem
@LetThereBeMayhem 3 жыл бұрын
@@Chadderbox Thanks.
@yukoshiii999
@yukoshiii999 2 жыл бұрын
you aren't a setup master without a set of cans around your neck.. I'm wearing a set now even though I don't know what I'm doing! LOL!
@hmmmidkkk
@hmmmidkkk 10 ай бұрын
As a consumer of your product(video) I think you should add more visual stuff instead of just having text that's just my thought tho
@makra42069
@makra42069 3 жыл бұрын
best of luck!
@menaced.
@menaced. 2 жыл бұрын
Im learning c++ to use openGL better than java so i wouldn’t need to worry so much about performance in the future. i thought this would give some tips.. maybe on ur next one
@meowninja2407
@meowninja2407 3 ай бұрын
Non-virtial destructors in non-final classes is a horrible idea
@islandcave8738
@islandcave8738 2 жыл бұрын
No boost libraries!? What about the stl!? Well its good practice to program things from scratch if you have the time.
@Chadderbox
@Chadderbox 2 жыл бұрын
No boost libraries, only pain.
@itsME-dc4vm
@itsME-dc4vm 3 жыл бұрын
nicee ;D
@eamon7629
@eamon7629 2 жыл бұрын
the cake was a lie
@craftyryte
@craftyryte 2 жыл бұрын
Raylib has collision sysytem inbuilt
@Chadderbox
@Chadderbox 2 жыл бұрын
It's not great
@discaymusic
@discaymusic Жыл бұрын
Where's the game?
@Chadderbox
@Chadderbox Жыл бұрын
Description
@DevlogBill
@DevlogBill Жыл бұрын
Hi Chadderbox, I've been programming on my own for about 1.5 years and coding for me is a hobby as well as an end goal which is it get a job. From time to time, I will stop what I am doing which is learning by creating projects which is now Kotlin and Android and sometimes Python with Django. But lately I've been itching to try out C++. I tried out both C and C++ and it seems C++ is more flexible, and C is harder to create an array, I just suck maybe you can create an array with C? I don't know? Anyways, I plan on playing around with C++ for only a couple of days maybe 2 weeks before returning to Android development with Kotlin. I need some ideas for making something. Are there any tiny projects you could recommend even if it is a console project? Google isn't being kind to me and won't give me any cool recommendations, thanks.
@Chadderbox
@Chadderbox Жыл бұрын
I love finding cool frameworks and making small games, because they often require you to understand a lot about the programming language, so you learn a lot.
@fatimanisar8399
@fatimanisar8399 2 жыл бұрын
Can we make a game in C++ without using classes
@Chadderbox
@Chadderbox 2 жыл бұрын
No
@arifkasim3241
@arifkasim3241 2 жыл бұрын
@@Chadderbox Why not?
@Chadderbox
@Chadderbox 2 жыл бұрын
Because otherwise it would just be C
@arifkasim3241
@arifkasim3241 2 жыл бұрын
@@Chadderbox Yes 😁, however I would like to know does any of that inheritance, polymorphism, abstraction stuff ever come into use for game programming. Classes are useful but that can be done using structs and pointers.
@Chironexe
@Chironexe 2 жыл бұрын
@@arifkasim3241 Yeah, for example you could create a Monster class that's inherited by Goblin. The monster class has a virtual void attack() = 0; that allows you to take that method and change it however you want. This is a veeeeeery simple example, but you probably get the gist of it.
@hitthemoney
@hitthemoney 2 жыл бұрын
I did something similar and it was soooo annoying
@franklimburns7938
@franklimburns7938 2 жыл бұрын
U should have had gameplay of ur game at the end
@Chadderbox
@Chadderbox 2 жыл бұрын
Probably yeah
@guisande
@guisande 2 жыл бұрын
Nice video bro, could you tell me the color scheme of the code in the blue background? I found quite beautiful. +1 subscriber
@Chadderbox
@Chadderbox 2 жыл бұрын
Likely monokai vibrant amped, you might recognise the creator. It's only available for VSCode though.
@Lita1
@Lita1 2 жыл бұрын
👍
@thg1nrediar
@thg1nrediar 2 жыл бұрын
good
@nitrogenez
@nitrogenez 2 жыл бұрын
muck.
@sampkr
@sampkr 2 жыл бұрын
700th like :D
@StellarHarbor
@StellarHarbor Жыл бұрын
Where is course lol, another useless video
So I Made My Own Game Engine...
10:19
Chadderbox
Рет қаралды 99 М.
Minecraft Clone in C++ // Code Review
40:29
The Cherno
Рет қаралды 349 М.
Walking on LEGO Be Like... #shorts #mingweirocks
00:41
mingweirocks
Рет қаралды 6 МЛН
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 77 МЛН
My MEAN sister annoys me! 😡 Use this gadget #hack
00:24
Which team will win? Team Joy or Team Gumball?! 🤔
00:29
BigSchool
Рет қаралды 15 МЛН
So I Made My Own Programming Language...
11:36
Chadderbox
Рет қаралды 86 М.
I Optimised My Game Engine Up To 12000 FPS
11:58
Vercidium
Рет қаралды 712 М.
I Spent 100 HOURS Making a Game With NO GAME ENGINE
13:42
Fuelvin
Рет қаралды 347 М.
Making My Own Programming Language and Coding a Game in It
10:19
AstroSam
Рет қаралды 1,3 МЛН
Learning C# In A Week... Otherwise I Fail University
9:04
How to make Minecraft in C++ or any other language
9:28
Low Level Game Dev
Рет қаралды 54 М.
Make Video Games
44:12
Pirate Software
Рет қаралды 1,4 МЛН
Should you learn C++?? | Prime Reacts
20:29
ThePrimeTime
Рет қаралды 388 М.
Learning C++ by making a Game... in 1 Week?!
10:14
Floky
Рет қаралды 552 М.
Walking on LEGO Be Like... #shorts #mingweirocks
00:41
mingweirocks
Рет қаралды 6 МЛН