[LIVE] Code-It-Yourself! Sliding Block Puzzle Games

  Рет қаралды 57,537

javidx9

javidx9

Күн бұрын

In this stream, I build the basic mechanics of sliding box puzzle games like Sokoban. I pay particular attention to making it an easy to modify framework. I also get distracted by viewer questions...
Source: github.com/One...
Patreon: / javidx9
KZbin: / javidx9
/ javidx9extra
Discord: / discord
Twitter: / javidx9
Twitch: / javidx9
GitHub: www.github.com...
Homepage: www.onelonecod...

Пікірлер: 85
@javidx9
@javidx9 4 жыл бұрын
A big thanks to those who donated during the stream - it really caught me by surprise :D
@mabroorahmad2182
@mabroorahmad2182 4 жыл бұрын
You are realy impressive. i wish i could copy paste your skills in my head.
@adammarkiewicz3375
@adammarkiewicz3375 3 жыл бұрын
Hi, I'm looking through content of your channel, great material, interesting to watch and very nicely presented. I haven't checked the code in the final version, but I've noticed you're using vector of unique_ptr to exploit polymorphism and that's absolutely fine, but you haven't done it immediately and later it skipped out of sight: if you want unique_ptr to do its work correctly, block should have virtual destructor declared. In your particular case this could just work, as you use only plain attributes that do not require their own destruction, which does not mean this is correct approach. This should be declared off the bat just when you decided such implementation. Thanks for the content you produce!
@benoitb.3679
@benoitb.3679 4 жыл бұрын
I really like this (edited) quote from 17:03 (ish): "Okay, it's difficult to master, I won't argue with that, but getting it working for you... when you're starting out programming, one of the first t things you'll realise is 'hang on, everything seems like hard work'. But after a while, it sorta clicks and you go 'well, this is actually making my life much easier'. And you'll start developing tools that help you. Once you've hit that point, you know it's for you; it's going to be what you need to do for the rest of your life."
@Edzward
@Edzward 4 жыл бұрын
4:37 I have fond memories of this! From the time I used to program DOS roguelike rpg games entirely from ASCII characters! Man, so much fun!
@benoitb.3679
@benoitb.3679 4 жыл бұрын
17:03 Genuinely my favourite perspective on programming. Clearly heartfelt given the nature of the situation and what you were doing. Thank you.
@markpaterson2260
@markpaterson2260 4 жыл бұрын
Thanks for taking your time to do this even while you're so busy. It's much appreciated!
@return6005
@return6005 4 жыл бұрын
Reversing the direction (NORTH to SOUTH, EAST to WEST, etc) can be done by a xor with 0b10 (2) instead of adding 2 and mod 4 Block->Push(dirPush ^ 0b10)
@robertszacki1628
@robertszacki1628 4 жыл бұрын
Thank you for this great video. Much helpful and great inspiration. What I wanted to note is that "Push()" method could be called "Pushable()", because it just returns true or false and as the "Move()" method is there. Also like your Block representation. As for Goals, It is possible to use two layers of Blocks to achieve Goals functionality (independent Blocks and Floors), which is similar solution to the one presented in your video. Like the idea behind Horizontal, Vertical and Countdown blocks. :)
@javidx9
@javidx9 4 жыл бұрын
Thanks Robert, yeah that's what I like about this approach - its highly extensible, and yes pushable() is much better XD
@akjir
@akjir 4 жыл бұрын
​@@javidx9 This was even a suggestion in chat, moments after you wrote it. (41:42 kariboo84 "pushable" naming ?) :-D
@fburton8
@fburton8 4 жыл бұрын
Delphi is still very useful from a practical point of view and still well supported. I have used it to create commercial software that interfaces with laboratory hardware and does real-time data acquisition and analysis. It's less appropriate for games programming because most of the useful libraries and frameworks are designed for use with C/C++ (although Delphi can call them). You can also embed Lua in Delphi programs, and call python code. love the near instant compiles/builds.
@BudgiePanic
@BudgiePanic 4 жыл бұрын
I made this exact game in my first year at university, or more precisely, an undo and redo move feature. It’s actually very surprising just how similar OLC Pixel game engine is, to what we used in first year programming to start learning the basics.
@JurajOravecSGOrava
@JurajOravecSGOrava 4 жыл бұрын
When you press INSERT key in most text editors you can overwrite the string for the "map".
@akjir
@akjir 4 жыл бұрын
"X. X. X. Excellent." He he. Like your videos. Entertaining and educational.
@csgowoes6319
@csgowoes6319 2 жыл бұрын
I did the timed tile like this, under the default: switch option: if (isdigit(tile)) { vLevel.emplace_back(std::make_unique((int)tile-48)); break; } Then I could put any digit 0-9 on the map and it would work. I know you said you were keeping it simple but I figured this was pretty simples, though I have a feeling there must be a less cheesy way to turn a string into its equivalent ascii integer!
@RetroCoderTV
@RetroCoderTV 4 жыл бұрын
Hi Javid. I've been watching your channel for years and recommending it. But I recently started up my own Assembly Language coding live on Twitch. Anyway, was going to make you a recommended channel on my KZbin and Twitch just thought I would let you know haha :D Keep up the quality work. I love all your videos
@tiger12506
@tiger12506 3 жыл бұрын
A couple of thoughts: 1) Rather than nullptr empty blocks, create a block override that handles the do nothing situations. 2) The iterative approach to determining whether blocks can push looked pretty scary. I think the recursive approach would have been a lot cleaner. Also would tie in well with thought #1. Also, thinking in a more functional programming mode for a recursive approach would clean up all the random bools you had to add to make your iterative approach work. Interesting that without solid blocks on the level boarders, your code would wrap-around the pushing. 3) Copy/pasting the renderable argument into every DrawSelf function smells. Would have been better to leverage the fact you have a base class, block. i.e. block constructor takes renderable, stores in instance variable that the subclasses could access. 4) This was really cool, regardless. :)
@M1SMR
@M1SMR 4 жыл бұрын
Hey javid, what do you think about the features added in the new C++ standards C++14/17/20? Do you think they improve the language or do you think they are unnecessary and complicate the language?
@T3RRY_T3RR0R
@T3RRY_T3RR0R 2 жыл бұрын
Can't believe I've missed this video. Been meaning to make something like this with batch for a while.
@laureven
@laureven 4 жыл бұрын
So looks like the next project will be to simulate Gravity and Space :)
@richardj.rustleshyman2026
@richardj.rustleshyman2026 4 жыл бұрын
Javid, perhaps in the future could you do a video on 2D elastic collision for balls and non axis-aligned walls?
@javidx9
@javidx9 4 жыл бұрын
Hi Richard - Already did, check out Programming Balls #2
@danielesquivel3155
@danielesquivel3155 4 жыл бұрын
yes ywy
@budman85
@budman85 4 жыл бұрын
Hi, when I tried compiling on Linux, I was getting no operator!=, in the header file you're missing these: bool operator == (const v2d_generic& rhs) const { return ( this->x == rhs.x && this->y == rhs.y ); } bool operator != (const v2d_generic& rhs) const { return !( this->x == rhs.x && this->y == rhs.y ); }
@javidx9
@javidx9 4 жыл бұрын
Hmmm. Good catch. I was using 2.07 in the video, so i guess its time to upload that to the repo.
@sewkokot
@sewkokot 4 жыл бұрын
@@javidx9 Another linux user and new follower of your channel :) Update the github repo to 2.07, please! You do great job, thank you :)
@bruno_kid_
@bruno_kid_ 4 жыл бұрын
thanks
@agent-33
@agent-33 2 жыл бұрын
This is awesome. I will try to code it in javascript. Good luck to me.
@KC-vq2ot
@KC-vq2ot 4 жыл бұрын
Javid, what are your thoughts on "best practices"? I started coding with Java, moved to C++ and Python in university, but use pure C for work. I am still learning and do (truly) professional stuff for less then a year with most of my expirience in small or personal projects. Code seems so much more clean, when you throw all that OOP/clean coder/never manage memory/whatever-best-practice-academia-farted-out-this-week garbage out the window. It is smaller because there are less then a million levels of abstractions, easier to understand because there are less dog-extends-table-because-it-has-four-legs gems and you can start developing a lot faster, because you don't need to spend a hundred years evaluating all the (theoretically) reusable components and passive agressive class hierarchy. I work nights as a bouncer, but that thing makes me want to cry. Also, I hope the guy who made unit testing a thing burns in hell. Don't get me wrong. I subscribe to the spirit (and not the letter) of SOLID and am big supporter of stuff like deep project planning so often ommited in methods like SCRUM. Being honest, I don't even know how people live(d) without polymorphism. It is such an obvious way of making games and other real time simulations. Overloading is also great and I really miss it. It is just that "best practices" seem perpendicular to common sense and fail to make case for themselves. With unit testing, if your functions are so complex that some non-obvious bugs emerge requiring unit testing to pinpoint them -- you failed as a person. If your function is actually complex (like a lot of graphics staff) you will need something of equal complexity to test it, defeating the purpose. With OOP, inheritance is just bad and "reusability" that gets shoehorned in because "don't repeat yourself" slowly corrupts whole project by adding unnecessary complexity via workarounds like factory pattern and inability to evolve code separately. All of them look good only next to some strawman code. Am I right to treat them more as general guidelines or are they called "best" for a reason that is not obvious unless you make something the size of "Witcher 3"?
@mansirrabiu7412
@mansirrabiu7412 4 жыл бұрын
Thanks very much! I am dying for the networking video you promised in the rect collision video.
@javidx9
@javidx9 4 жыл бұрын
Promised??
@mansirrabiu7412
@mansirrabiu7412 4 жыл бұрын
Oh I am sorry sir! I re-watch the video and here comes the correct version of my words, ( I doff my hat sir, programmer like no other in the whole universe(atleast to me). I am dying for the networking video you tipped us(not promised) on in the rect. collision video. May God help you again and again in all your endeavours). Your biggest admirer: Mansir
@isaiasdimitri4110
@isaiasdimitri4110 3 жыл бұрын
VCode: It cannot do this. David: Yes, it *does* ahhaha
@russellabraham9208
@russellabraham9208 4 жыл бұрын
How long have you been programming? You have a lot of great knowledge thank you for sharing.
@yhezelmabajen2627
@yhezelmabajen2627 5 ай бұрын
is this applicable on visual basic? i badly needed some source code to make as a reference in my school project, thanks!!!
@ciaragarrity6425
@ciaragarrity6425 4 жыл бұрын
Big question: Is java slower than C, C# and C++? Java is easier to understand in my opinion and I wouldn't like it if my game was slow Thanks for your channel!
@javidx9
@javidx9 4 жыл бұрын
Hi Ciara, technically yes, java and c# are slower than c++, but it doesnt matter unless your project is large, complicated, resource intensive.
@ciaragarrity6425
@ciaragarrity6425 4 жыл бұрын
@@javidx9 oh well, whats the difference between C# and C++?
@akjir
@akjir 4 жыл бұрын
@@ciaragarrity6425 www.guru99.com/cpp-vs-c-sharp.html
@ciaragarrity6425
@ciaragarrity6425 4 жыл бұрын
@Aramis Razzaghipour hey i heard that Minecraft ported to consoles, they used Java as their programming language. They apparently converted its code into C. If, I did make a game in Java, would my hard work go to waste? Could I convert the code, and how? Thank you.
@streetfashiontv9149
@streetfashiontv9149 4 жыл бұрын
@@ciaragarrity6425 depends what platform your making it for. If its to deploy as a mobile app then no because Java is the official language of Android (although Kotlin is increasingly becoming popular). If your making a AAA title for console then C++ is the industry standard. Indie games for PC can be made in either although C#/C++ is the most common because these languages are indigenous to game engines like Unity and unreal engine.
@pierreyao7221
@pierreyao7221 3 жыл бұрын
Great work Javid
@roamingcelt
@roamingcelt 3 жыл бұрын
Seeing that all blocks are the same size and the block size is global; why did you need to pass the block size in the DrawSelf?
@iProgramInCpp
@iProgramInCpp 4 жыл бұрын
The std::unique_ptr removes the need for deleting stuff, as it's being done already, right?
@backwardspy
@backwardspy 4 жыл бұрын
Yes, unique_ptr frees the underlying memory for you when it is deleted, assigned a different pointer, or reset.
@iProgramInCpp
@iProgramInCpp 4 жыл бұрын
@@backwardspy nice
@ishc3ice
@ishc3ice 3 жыл бұрын
yes, same for shared_ptr
@codeguppy
@codeguppy 3 жыл бұрын
You make C++ coding so fun ;-)
@jayasribhattacharya2048
@jayasribhattacharya2048 4 жыл бұрын
I missed the live stream due to History class :-(
@tijani3141
@tijani3141 4 жыл бұрын
Class on a sunday
@jayasribhattacharya2048
@jayasribhattacharya2048 4 жыл бұрын
@@tijani3141 yeah our school is kinda wierd
@iProgramInCpp
@iProgramInCpp 4 жыл бұрын
In July?
@jayasribhattacharya2048
@jayasribhattacharya2048 4 жыл бұрын
@@iProgramInCpp yeah bro I am in India :-)
@iProgramInCpp
@iProgramInCpp 4 жыл бұрын
@@jayasribhattacharya2048 do you ever get summer vacation or something?
@philtoa334
@philtoa334 4 жыл бұрын
So nice
@bonus5804
@bonus5804 4 жыл бұрын
26:47 I am learning c++ and I don't understand why you captured everything in the lambda with '&', because I don't think you needed it, because the lambda doesn't use any external value ?
@Wosser1sProductions
@Wosser1sProductions 4 жыл бұрын
He used `(this->)vLevelSize.x` inside the lambda, which is from the scope of the lambda.
@vitacell1
@vitacell1 4 жыл бұрын
javidx9 love your videos, those help me. Please more of those videos but written in C.
@8lb6ozbabyjsus
@8lb6ozbabyjsus 4 жыл бұрын
Don't you have a video of Arcus playing in the background?
@javidx9
@javidx9 4 жыл бұрын
I do. Arcus is great! Swag staaaaaaaaarrrrrrr! Its my 8bits of advice for new programmers video.
@8lb6ozbabyjsus
@8lb6ozbabyjsus 4 жыл бұрын
@@javidx9 thanks I was on his stream today and was talking to someone about seeing him on a video but I couldn't remember for the life of me what one!!
@_girnetix_
@_girnetix_ 2 жыл бұрын
Hi, can you make video about game timer with solution this problem for me? :)
@ZomB1986
@ZomB1986 4 жыл бұрын
Sokoban is a lazy spelling of Soukoban, Japanese for Warehouse Duty
@matttherat9533
@matttherat9533 4 жыл бұрын
javidx9 : using c++ to program . me : using Holy c .
@vittorioromeo1
@vittorioromeo1 4 жыл бұрын
Good video! However, not a fan of the use of polymorphism here. For example, you could represent the blocks with a `std::variant` of all possible block types. You were forced to use dynamic allocation and introduced the complexity of dynamic memory management via `std::unique_ptr`, which I do not think is necessary for a simple game like this one.
@muhammadhaider5677
@muhammadhaider5677 4 жыл бұрын
Go watch his channel trailer.
@robertszacki1628
@robertszacki1628 4 жыл бұрын
From what I've seen the Blocks are constructed just once at the game beginning, and then they are just moving on the array, so I guess there's no overhead because of dynamic construction.
@morball6668
@morball6668 4 жыл бұрын
I really wish we wouldnt be “learning” bloody scratch at school
@iteratedofficial
@iteratedofficial 4 жыл бұрын
Thankfully we have the internet :D
@adamdux5216
@adamdux5216 4 жыл бұрын
nice
@zystemd3172
@zystemd3172 4 жыл бұрын
Holly shit you made in 2 lines and some notes what i try to do since 2 month : some kind of polymorphisme. I am really a dickhead :(
@puncherinokripperino2500
@puncherinokripperino2500 4 жыл бұрын
WE'LL DO IT LIVE! F*** IT!
@RecycleBin0
@RecycleBin0 3 жыл бұрын
net yaroze pushy 2
@danielesquivel3155
@danielesquivel3155 4 жыл бұрын
Yo te amo uwu, tas hermoso. Sigue asi.
@banabana4691
@banabana4691 4 жыл бұрын
i coming
Code Review: Saving Sedit Platform Game
45:20
javidx9
Рет қаралды 30 М.
Остановили аттракцион из-за дочки!
00:42
Victoria Portfolio
Рет қаралды 3,3 МЛН
Шок. Никокадо Авокадо похудел на 110 кг
00:44
BIG PROJECT 2-in-1! Top Down City Based Car Crime Game #2
1:32:44
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
50K Live Code Party
2:11:51
javidx9
Рет қаралды 35 М.
Harder Drive: Hard drives we didn't want or need
36:47
suckerpinch
Рет қаралды 1,7 МЛН
Forbidden C++
33:07
javidx9
Рет қаралды 1 МЛН
Clean Code is SLOW But REQUIRED? | Prime Reacts
28:22
ThePrimeTime
Рет қаралды 306 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
100K Live Party! Code-It-Yourself: SHMUP
2:18:40
javidx9
Рет қаралды 72 М.
Reverse emulating the NES to give it SUPER POWERS!
22:21
suckerpinch
Рет қаралды 1 МЛН
Остановили аттракцион из-за дочки!
00:42
Victoria Portfolio
Рет қаралды 3,3 МЛН