Lets Code A Multiplayer Voxel Game in C++ - Breaking And Placing Blocks

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 มิ.ย. 2024
  • In this episodewe optimize the network code a bit, and also implement voxel world editing
    =========
    DOWNLOAD:
    SOURCE CODE:
    github.com/Hopson97/open-builder
    =========
    RESOURCES:
    UDP Packets Being Dropped: jvns.ca/blog/2016/08/24/find-...
    =========
    MUSIC USED:
    Donkey Kong Country - Forest Interlude
    Geographer - Airline - • Geographer - Airline
    Final Fantasy IX - Dali Theme
    Donkey Kong Country- Stickerbush Symphony
    =========================================
    LINKS:
    GitHub: github.com/Hopson97
    Discord Server: / discord
    Support me on Patreon: / hopson
    Follow me on Twitter: / hopson1997
    Follow me on Twitch: / hopsonn
    Community Channel:
    / @hopsoncommunity8184
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 194

  • @Hopsonn
    @Hopsonn  4 ปีที่แล้ว +48

    Big thank you to everyone who has contributed on the GitHub so far!
    github.com/Hopson97/open-builder
    A few issues are on the github.com/Hopson97/open-builder/issues page for those who want to get started contributed, hope you all enjoy the video! Thanks!

    • @Sirvierl0ffel
      @Sirvierl0ffel 4 ปีที่แล้ว +1

      Why isn't the bell working on your channel?

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว

      TheLappinator *•TH-cam*•

    • @quinn4571
      @quinn4571 4 ปีที่แล้ว

      Hopson Nice video👌

  • @Danidev
    @Danidev 4 ปีที่แล้ว +412

    This is so cool! Can't wait for the next episode

    • @KelvinatorIsTaken
      @KelvinatorIsTaken 4 ปีที่แล้ว +5

      Wow u is here

    • @gael8
      @gael8 4 ปีที่แล้ว +1

      @@KelvinatorIsTaken no

    • @mwguy
      @mwguy 4 ปีที่แล้ว +8

      Oh, hello milk man

    • @Warwipf
      @Warwipf 4 ปีที่แล้ว +24

      I bet you can't make a 4d multiplayer game

    • @ERN468.
      @ERN468. 4 ปีที่แล้ว

      @@Warwipf 5d

  • @ViralVibesReal
    @ViralVibesReal 4 ปีที่แล้ว +35

    Friend 1: "Let's play Minecraft"
    Friend 2: "But we don't have any money"
    Friend 1: "Let me code it real quick I'll be back"

  • @TheBcoolGuy
    @TheBcoolGuy 4 ปีที่แล้ว +39

    I admire programmers who lean as little as possible on engines and frameworks and just create their own things like this. It's very impressive.

    • @Sharku5
      @Sharku5 4 ปีที่แล้ว

      Yeah!

    • @petlahk4119
      @petlahk4119 3 ปีที่แล้ว +2

      I'm actually here because I wanna learn to program during the ongoing pandemic and make a game that I've had floating around in my head, but I'm wary of getting myself too backed into a corner by existing engines and frameworks.

    • @LegoDinoMan
      @LegoDinoMan 2 ปีที่แล้ว

      @@petlahk4119 How’d that idea end up?

    • @anon1963
      @anon1963 ปีที่แล้ว +2

      @@LegoDinoMan probably idea was too complicated and was scrapped

    • @LegoDinoMan
      @LegoDinoMan ปีที่แล้ว +2

      @@anon1963 Such is game dev life.

  • @stacyardus3898
    @stacyardus3898 4 ปีที่แล้ว +12

    Your earlier videos where you make an engine in a week, and the 5-6 minute series videos "creating minecraft in openGL part one" and so on, have been one of the biggest drivers for my thoughts and actions and goals in game design, i dont want to just thank you and compliment you like one usually would, i just want to say that your work reaches a part of my soul not many things do. that being said, thank you for sharing your journeys in programming with us. and Keep us posted cos i wanna see where this goes q:D

  • @shmoobalizer
    @shmoobalizer 4 ปีที่แล้ว +231

    Better title: How to pirate Minecraft classic

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว +75

      How to pirate cheap, offbrand Minecraft classic

    • @keastie6671
      @keastie6671 4 ปีที่แล้ว +24

      @@Hopsonn Minecraft: Tesco Value Edition

    • @diddlenfiddle7311
      @diddlenfiddle7311 4 ปีที่แล้ว +10

      Nah, he's making it in c++ (I think) much better than in Java

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว +2

      @@diddlenfiddle7311 yeah C++, the thing is he is making the server in the same language as the client, so he a smart boy. i make client in C# and server in C++. its 100% doable, trust me. it just makes you wanna die a little sometimes, lol
      but great cos i get to use my 2 faverout languages :D

    • @garorade
      @garorade 4 ปีที่แล้ว +4

      Yeah but everyone can agree java is better than c++

  • @nicks4727
    @nicks4727 4 ปีที่แล้ว +58

    The only problem with your channel is that you don't have that silver play button yet

  • @fbob987
    @fbob987 4 ปีที่แล้ว +80

    But there was terrain in the thumbnail... we've been cheated lads

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว +37

      I been found out oops 👀

  • @BradenLehman
    @BradenLehman ปีที่แล้ว +2

    This is looking really good! Once you implement procedural terrain generation you'll reduce the number of packets you have to send initially because instead of the server sending the position of every block to the client it will only have to send the world generation "seed" (a number) that the client can use to generate the initial pseudo-random block placements. After that, the server will only need to tell the client about blocks that were added/removed manually by players 🙌🙌

  • @Pipin06
    @Pipin06 4 ปีที่แล้ว +7

    The Legend is back

  • @SuperZachgames
    @SuperZachgames 4 ปีที่แล้ว +5

    youre channel really inspired me to get into coding again. thank you very much :)

  • @ammarassi7095
    @ammarassi7095 4 ปีที่แล้ว +44

    No Unity or any other engine
    You're a legend

    • @ammarassi7095
      @ammarassi7095 4 ปีที่แล้ว +16

      @killmoo No,he is using C++/OpenGl

    • @cacnus
      @cacnus 4 ปีที่แล้ว +1

      @killmoo He is using Unity, but not in this series.

  • @ThatGuyDownInThe
    @ThatGuyDownInThe 4 ปีที่แล้ว +20

    this is beautiful man, really.

  • @_alnmgdev5236
    @_alnmgdev5236 ปีที่แล้ว

    man. this is the best minecraft recreating i ever seen

  • @cryptonicchronic8111
    @cryptonicchronic8111 2 ปีที่แล้ว

    i just found this series, youre a god send brotha!!!! looove your work
    inspiring for someone looking to get into game developing

  • @johncola1634
    @johncola1634 4 ปีที่แล้ว

    Great work, it's awesome to be able to follow along with your journey.

  • @barry_crisp
    @barry_crisp 4 ปีที่แล้ว

    Super hyped for the next one, great progress so far!

  • @et118
    @et118 4 ปีที่แล้ว +1

    These videos are very intresting to watch. Im looking forward to the next video.

  • @floatingpointerror55
    @floatingpointerror55 4 ปีที่แล้ว +3

    I thought that you wouldn't update anymore. Anyway, this channel has been an inspiration and thank you for this

  • @giganooz
    @giganooz 4 ปีที่แล้ว +4

    You may have accidentally added "WORK WEEK IN MY LIFE: my 3 am to 12 pm job
    " by "Clancy Burke" to your "Making minecraft with OpenGL" playlist

  • @Blaxpoon
    @Blaxpoon 4 ปีที่แล้ว

    The music... I see you are a chosen one, congratulations on reaching the edge of internet, I wish you luck for your project and I am sure you will achieve it

  • @n0n3x
    @n0n3x 4 ปีที่แล้ว

    I love your videos, because you are coding a big game and explaining us what u do at the same time! I love to watch ur Videos! Go on!

  • @jakehall44
    @jakehall44 4 ปีที่แล้ว +1

    Love these vids man.

  • @user-qv9ho1lj3z
    @user-qv9ho1lj3z 4 ปีที่แล้ว

    I love this series so much

  • @CharIie83
    @CharIie83 4 ปีที่แล้ว +2

    brilliant, inspiring

  • @creativity5155
    @creativity5155 4 ปีที่แล้ว

    I can't wait for the next episode :D

  • @Kevroa1
    @Kevroa1 4 ปีที่แล้ว +3

    Woah.. a second episode within 1 month!?!

  • @MrOnlineCoder
    @MrOnlineCoder 4 ปีที่แล้ว

    Good job, waiting for next episode, especially the scripting part and how you would share same sctipt data between client and server)

  • @SPACEGAMESstudio
    @SPACEGAMESstudio 4 ปีที่แล้ว +1

    This is so cool. nice job

  • @beron_the_colossus
    @beron_the_colossus 4 ปีที่แล้ว +2

    Oh yeah it's all coming together

    • @beron_the_colossus
      @beron_the_colossus 4 ปีที่แล้ว +2

      Great work btw, looks like the finished product will be amazing!

  • @jackson1124
    @jackson1124 3 ปีที่แล้ว

    I saw people in the last video talking about the packet kick exploit. You realize replacing every block in the map with air is also really possible.

  • @SDFTDusername
    @SDFTDusername 4 ปีที่แล้ว +2

    yes! thanks for part 2

  • @raduhabinyak6860
    @raduhabinyak6860 4 ปีที่แล้ว +1

    For the block modification you could just store all connected clients or at least all withing a certain proximity and just have one client send the data to all especially when the server is busy so goast blocks don't happen because then all clients would have the most up to date data no matter how backed up the server is and even if the server goes offline, basically pear to pear data transfer. and it would also a low you to play with others while in the same network.

    • @lengors1674
      @lengors1674 4 ปีที่แล้ว

      He can still play with others while on the same network even with a dedicated server, and p2p is a lot harder to make sure that everyone is on the same page

  • @rhuib
    @rhuib 4 ปีที่แล้ว +2

    love this

  • @chrismorris5241
    @chrismorris5241 4 ปีที่แล้ว

    Keep up the good work.

  • @LideCantFly
    @LideCantFly 4 ปีที่แล้ว +1

    A very very great video. You really inspire me to work on stuff with all that power you put into that video!

  • @vitiacat
    @vitiacat 4 ปีที่แล้ว

    Very cool!

  • @SuboptimalEng
    @SuboptimalEng 4 ปีที่แล้ว

    This is epic

  • @ctenebrous6888
    @ctenebrous6888 2 ปีที่แล้ว

    Hi, love your videos. Wanted to mention though you probably don't need the server to send down any block data from the generated world. If the world is deterministically generated, given a seed that both client and server have, the client should be able to independently figure all the blocks and arrive at the same conclusion. All they need from the server is the world seed and of course a stream of block changes for any that are not deterministic. Like players placing and breaking.

  • @EpicVideoGamer7771
    @EpicVideoGamer7771 ปีที่แล้ว

    5:34
    *cursed diagonal block placement*

  • @RamiSlicer
    @RamiSlicer 4 ปีที่แล้ว +1

    Nice!

  • @alessi4249
    @alessi4249 4 ปีที่แล้ว +1

    It would be great if you could include block physics. Many voxel clones don't have this and it would be a great exercise and really make yours stand out great job

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว +1

      What sort of physics?

    • @alessi4249
      @alessi4249 4 ปีที่แล้ว

      @@Hopsonn I was thinking primarily liquid, sand, perhaps adding physics to have floating objects fall however it could be expanded in many ways you could have physics of portals perhaps it could be turned into a FPS where they're would be grenade, blast physics bullet drop. It depends how far you want to take the game and in what direction. But I think it's a great series you're doing and these could make for great videos. Focusing on the multiplayer aspect there's some great detail in having an efficient, reliable and anti-cheat netcode in implementing any of these ideas. Keep it up!

  • @garorade
    @garorade 4 ปีที่แล้ว

    Very nice

  • @pb-vj1qs
    @pb-vj1qs 4 ปีที่แล้ว

    I love it!

  • @coxcopi
    @coxcopi 4 ปีที่แล้ว

    Yaaaas finally!!

  • @fleskimiso
    @fleskimiso 4 ปีที่แล้ว +1

    Tho amazing!

  • @theshinro
    @theshinro 4 ปีที่แล้ว +1

    FF9 - Dali theme

  • @WaffelEdits
    @WaffelEdits 4 ปีที่แล้ว

    episodewe uwu

  • @redandcyanpower
    @redandcyanpower 4 ปีที่แล้ว +1

    POGGERS!

  • @Rekongstor
    @Rekongstor 4 ปีที่แล้ว

    You can try to compress and send more than one chunk. Maybe it would be helpful to compress all surrounding chunks.
    Also you want to start collecting chunk updates after the moment you started transmission to the client, and after the operation was completed you can combine all the chunk updates in one but big update, compress this thing and send this data to the client until the latency would be really low. Maybe you want to compress every queue of chunk updates for each client at the runtime instead of sending each chunk update separately.

  • @iDontProgramInCpp
    @iDontProgramInCpp 4 ปีที่แล้ว

    Why not send the compressed data through ENet? This reduces the overhead from other libraries. Additionally, you can use CRC32 checksums and enet_compress_with_range_coder, which is definitely useful.

  • @holden_fella
    @holden_fella 4 ปีที่แล้ว +1

    still better than CubeWorld 1.0

  • @hoseja
    @hoseja 4 ปีที่แล้ว

    Also be wary of network MTU. If your packets are too big (32kB definitely are), they get split up and reassembled, which costs performance.

  • @kathipaw
    @kathipaw 4 ปีที่แล้ว +29

    Couldn't you just have used a common compression algorithm like gzip?

    • @orocimarosay1447
      @orocimarosay1447 4 ปีที่แล้ว +12

      I guess yes but it might be better to use a custom thing for custom data because for example you know for a fact that 99% of the time the chunks are going to be half filled with a lot of air and you might want to take advantage of that.

    • @dekrain
      @dekrain 4 ปีที่แล้ว +3

      @@orocimarosay1447 The DEFLATE algorithm (used in gzip, zlib and ZIP) already takes care of that (uses something very similar to the RLE).

    • @kathipaw
      @kathipaw 4 ปีที่แล้ว +1

      @@tarunchand3159 but it's strictly worse than gzip, and gzip can be made to run in a few minutes using zlib

    • @jonathanberkeley4109
      @jonathanberkeley4109 4 ปีที่แล้ว +7

      He could make many aspects of the project far easier with various libraries and plugins, though I get the impression that this project is supposed to be as vanilla coded as possible, with the exception of SFML

    • @eliaswenner7847
      @eliaswenner7847 4 ปีที่แล้ว +1

      I guess his custom alhorithm is faster for what it is ment for.

  • @alizardguy
    @alizardguy 3 ปีที่แล้ว

    nice

  • @orocimarosay1447
    @orocimarosay1447 4 ปีที่แล้ว +1

    Also where have you learned networking from ? I would like to try it miself

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว

      google search [language name] tcp/udp example. or anything along those lines, its how i learned

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว +1

      Multiple resources and a few months of random experimenting.
      Started off by making a terminal chat application that used tcp,
      then udp
      The made a few other random projects like pong using sockets etc
      Starred this project when I was confident enough to do such a thing. (which was about 3 or 4 months)

  • @Z_Z.t
    @Z_Z.t 4 ปีที่แล้ว

    Can we have marching cubes collision?

  • @yh_hat_trick491
    @yh_hat_trick491 4 ปีที่แล้ว

    That thumbnail tho

  • @ianminnis48
    @ianminnis48 4 ปีที่แล้ว +1

    when you can't afford Minecraft but you're smart af

  • @KALTBLUTWOLF1
    @KALTBLUTWOLF1 4 ปีที่แล้ว +2

    Did you just put a block at the corner of another block at 5:35? Your game already has more features than MC lol

  • @mihail2607
    @mihail2607 4 ปีที่แล้ว +1

    Have you ever considered doing OpenGL tutorials? I feel like yours would be really easy to understand. I tried TheCherno's but I can't understand anything he says.

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว

      I did try to make some before but was not very happy with the quality of my own code and didn't want to promote these bad practices to other people.
      Besides, there are plenty of other opengl tutorials out there.
      Have you seen the ones by ThinMatrix? That's where I originally learned from.

    • @mihail2607
      @mihail2607 4 ปีที่แล้ว

      @@Hopsonn I have seen them, however I haven't watched them as they were in Java. I guess it shouldn't really differ from C++. I could give them a try :)

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว

      @@mihail2607 Yeah I managed to follow in C++, it is basically exactly the same from an OpenGL code point :)

  • @ZelvMC
    @ZelvMC 4 ปีที่แล้ว

    arround the end of the video, he builds a tower of grass and then places a grass block diagnolly????

  • @BenjaminGoldberg1
    @BenjaminGoldberg1 4 ปีที่แล้ว

    Instead of having the server store uncompressed chunks, and compress them as they are transmitted, why not have the server store blocks in some form of compressed data structure, and throw away the uncompressed data?
    The first such structure which comes to mind is an octree, which can be thought of as a three dimensional version of run length encoding, but where the "length" doesn't need to be stored/transmitted, since it's implied by the depth in the tree.

  • @silviogames
    @silviogames 4 ปีที่แล้ว

    Hey how about you compress a chunk and then send either the uncompressed or the compressed. Whoever of those two is smaller. So you will always send a max size that is equal to the uncompressed chunk. Since you are compressing all's chunks anyway, this should not add an overhead

  • @philipbrunn8706
    @philipbrunn8706 4 ปีที่แล้ว +6

    I wish i could code like you.

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว +1

      start, trust me, start. heres your tasks , each one will make you better and better at programming because they get harder and harder, until you know enough to start what learning by your self
      TASK-1: Hello world.
      TASK-2: ask for user input and say hello users name
      TASK-3: asks for 3 inputs does random number and picks one.
      TASK-4: Read file, display file, ask for input, write file out with input added
      TASK-5: simple calculator plus, devide, minus, times
      TASK-6:Quiz game, ask question check input, correct next question, wrong backto start
      TASK-7: you get the idea, the rest of journey is yours friend

    • @thecakeisalie6392
      @thecakeisalie6392 4 ปีที่แล้ว +1

      @@stacyardus3898 Well anyways they're years and years of learning and programming to do such thing as in the video, you really must be that type of person, bcs there're a lot of people who give up in the middle of the progress...

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว +1

      Byeffel 100% agree. Wich is fine, cos if some people arnt interested its okay. You can do what you wanna do. And thats great, its called freedom. :D and right now we have it. So if you wanna try programming, try, if you change your mind, stop. Do what you wanna do :D just dont make me pay for it ahahahahaha.

    • @thecakeisalie6392
      @thecakeisalie6392 4 ปีที่แล้ว +1

      @@stacyardus3898 Oh, of course I'll do whatever I want, but don't try to sneak out, you're involved in this now.

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว +1

      Byeffel involved in what?

  • @aleksitjvladica.
    @aleksitjvladica. 4 ปีที่แล้ว

    I was patiently waiting for this two years! I will give you mental support if you need, I truly want to see this video game bigger, better, stronger, since MineCraft is unplayable trash. Please give Me feedback so I know you read this.

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว +1

      Next episode potentially coming out Friday 👀

    • @aleksitjvladica.
      @aleksitjvladica. 4 ปีที่แล้ว

      Mate, I can't believe, it's too good to be true, I love you

  • @sleebyrose
    @sleebyrose 4 ปีที่แล้ว

    2:00 array of bloq ITs.

  • @bringmichzumlicht4490
    @bringmichzumlicht4490 4 ปีที่แล้ว +1

    :)

  • @elektrikliklavye8406
    @elektrikliklavye8406 4 ปีที่แล้ว

    Which ide?

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว

      Visual studio

  • @neelixchicote1776
    @neelixchicote1776 4 ปีที่แล้ว

    How can i download it

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว

      Atm you have 2 options
      1. Download source code and compile (I have a guides on how to do this in the github repo)
      2. Join my discord server, I regularly post random updates on it and test out multiplayer stuff with people

  • @cringyclips777
    @cringyclips777 4 ปีที่แล้ว +3

    I wish I could code

    • @Raizazel
      @Raizazel 4 ปีที่แล้ว +10

      I'm a genie! Wish granted! Now you are able to code, you just need to follow some random tutorial on how to make any language say "hello world" and keep coding until become good at coding when you reach that point just keep coding, it's fun.

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว +2

      i am also genie second! i tell you this is correct! and along the road always compare yourself to yourself a week ago. and never compare your programming skills to people who are 4 years ahead or even 3 weeks ahead of you. after hello world you should do a dice simulator or something, to learn random numbers and if statments, so if random number is 6 then say 6 or whatever. :D good luck

  • @ThatGuyGEWP
    @ThatGuyGEWP 4 ปีที่แล้ว

    Saw this shit clicked on it right away

  • @lal12
    @lal12 4 ปีที่แล้ว

    I think instead of using ENet (over UDP) you just should have used a TCP connection, you wouldn't have run into that issue. Yeah for some realtime games there might be issues, but I personally think they would not have been any issues for you. (AFAIK Minecraft PC only relies on TCP). And especially for getting started this might have been the better choice. If you really would like to get realtime data faster it would be probably a good idea to use TCP for the larger data like the chunks and a UDP based connection for player position and so on. Obviously compression should be used anyway.

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว

      I think TCP would have had the exact same issue

    • @lal12
      @lal12 4 ปีที่แล้ว

      @@Hopsonn some googling shows that the same option actually also applies to TCP, so I assumed wrongly there.
      However I wrote many different networking programs (for linux) transfering much more data. The ones I remember on the top of my head are actually a TCP program transfering a firmware update, a TFTP Server (UDP) and a protocol which is purely ethernet based (directly above ethernet layer, so no IP or transport layer (TCP/UDP)). All of them handled transferring multi megabyte data very well.
      So I guess it is either the way you handle the packets or it is the way ENET handles the packets, what causes the problem.

    • @lal12
      @lal12 4 ปีที่แล้ว

      Of course it also might be a completly different problem. Did you investigate the problem it with a packet analyzer like Wireshark?

    • @tlacmen
      @tlacmen 4 ปีที่แล้ว

      I had similar issue with enet. It was able to send only few KB/s and started dropping packets afterwards. It perhaps is possible to fix it with just some configuration options, I do not know, but I did not care any more because I also wanted ipv6 support, and so I wrote my own connection (and optional reliability with guaranteed ordering) on top of udp mysef. I can now handle 12 MB/s which is the limit at where the server is hosted.
      However, I would not recommend doing that this early in development. It took me several weeks to make it work good.
      You may look at it here: github.com/ucpu/cage/blob/master/sources/libcore/network/udp.cpp for inspiration (it is part of a much larger project, so not suitable for integration).
      BTW, most operating systems allow to enlarge the buffer: search for SO_SNDBUF and SO_RCVBUF, but again, I do not know if that can be done when using enet.

  • @marceid3578
    @marceid3578 4 ปีที่แล้ว +1

    Second

  • @williamv.4234
    @williamv.4234 4 ปีที่แล้ว

    Why not just use unity or any other game engine?

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว +4

      Because I enjoy creating things from scratch a lot more than using a game engine.
      Additionally, one of the goals of this project is to learn how how all this works, and doing it myself and working out how different systems fit together is best way to do this for me.

  • @kristupasantanavicius9093
    @kristupasantanavicius9093 4 ปีที่แล้ว

    Your explanation for why chunks were slow is incorrrect.
    The real reason is enet. The library is built on top of UDP, which is a lossy and unordered, meaning packets could be dropped and they are not guaranteed to arive in the order they were sent. Enet, however, builds abstractions on top of this to guarantee losless and ordered transmission. What this means is that if the server sends packets A, B, C, D; and the packet A is dropped, client will not receive B, C, D until packet A is received. Enet does provide an option to disable this functionality for specific packets being sent.
    ENET_PACKET_FLAG_UNSEQUENCED is the flag you want to set when sending a packet.

  • @huntserston3579
    @huntserston3579 4 ปีที่แล้ว +1

    This seems to rum better than minecrafts multiplayer

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว

      It's an unfair comparison, Minecraft is doing a lot more than what this program does, so naturally would be slightly slower, but more what it does, minecraft is a pretty well running game

    • @huntserston3579
      @huntserston3579 4 ปีที่แล้ว

      @@Hopsonn you have a point

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว +1

      @@huntserston3579 plus minecraft usually works over far distances, hopsons game is working on the same machine, and obvoisly local loopback times are way faster then wlan.

    • @huntserston3579
      @huntserston3579 4 ปีที่แล้ว

      @@stacyardus3898 never really thought of that I don't really know the code in minecraft because I kind of just lack the knowledge of java and just assumed that c++ was jusf fasy

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว +1

      Huntsers TON c++ is alot faster, as in the program runs faster the java, but network and internet speeds have nothing to do with the program, so yes c++ is faster then java, but the internet is what it is :p

  • @ajen003
    @ajen003 4 ปีที่แล้ว

    i'm the guy that tried to implement gamepad support and failed

  • @benkyd7874
    @benkyd7874 4 ปีที่แล้ว +4

    First!

  • @orocimarosay1447
    @orocimarosay1447 4 ปีที่แล้ว +2

    I think your oop manner of doing things is getting out of controll why do you need a ray class ? You are probably just going to use it only once or twice but you add a lot of code and I don't find it more convenient to read. I am not hating here because I love your videos but this is just my personal opinion.

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว

      Believe me man, I try very hard to get out of control :P I actually started this project in ~November but started again in December, simply because my OOP has gotten out of hand and I was like "Nope nope nope this is terrible" and started all over again.
      Since then I have been very careful about what to make a class and what to not, and have been trying so hard to NOT get out of control with this, and tbh I think the code has become a lot more minimal as a result of this. (For example, I haven't bothered creating a bunch of rendering abstractions [eg, "ChunkRenderer" and "EntityRenderer" etc] and have just kept it all in one place in the Client::render function)
      In some cases, it has made creating this project a bit slower as it means I am more careful with code design decisions, but it is worth it in the end.
      But you are right, I don't really need a ray class at all, and I have no reason why I made one except it is "what I have done in the past", so I probably will remove that and whack that in place of where the block editing code is.
      Thanks for watching!

    • @orocimarosay1447
      @orocimarosay1447 4 ปีที่แล้ว +2

      Some friend of mine recomanded me to use c from time to time so that I can concentrate more on the the real problem and less on what abstractions to make

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว +1

      @@orocimarosay1447 Yeah definitely. It's been a really good way to make things easier to deal with.
      I find oop a lot of the time just sort of "blocks" certain solutions to problems, but just keeping everything together rather than spread over 182818 files has made life a lot easier and the code more easy to follow

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว

      @@Hopsonn use a simple function or something instead

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว

      @@Hopsonn make sure to be careful, because if you end up with a main.cpp that is 86KiB and 4 thousand lines long, which houses your entire program, your gonna be in for a bad time. so its all about finding the perfect ballence between to much, and just enough. like all things :)

  • @garorade
    @garorade 4 ปีที่แล้ว

    Wtf short

  • @kholland4235
    @kholland4235 4 ปีที่แล้ว

    Dude this is impressive. Keep it up. Also if you wanna check it out I've been working on something similar in JavaScript (albeit much poorer in quality; the core engine is pretty broken) -- kholland4.github.io/mc4/ -- any feedback would be appreciated

  • @halted_code
    @halted_code 4 ปีที่แล้ว

    block updates shouldnt be sent to all players, only the players that have that chunk loaded, with just your self it doesnt matter too much, and probably with less than 10 people it wont impact the server performance too much, but get enough players breaking or adding blocks, and you will start to see lag, you want to send the least amount of data as possible, further block updates shouldnt be done by the players, this can create a game vulnerability down the road with dupes, or greifing of protected spaces should you implement that, you might want to set up some sort of protocol for client server interactions, you should probably have a few messages at minimum: block update ( from client to server), Chunk fetch ( from client to server), Chunk (from server to client), block update accepted (from server to client), block update denied (from server to client), reload chunk x (from server to client). This way you can ensure that the updates are done by the server, and that the server can send the least amount of data over the network as possible, while still ensuring that all players that need to update do, this can also help with race conditions, what happens if 2 people try to place 2 different blocks at the same coordinate? with a well set and documented communications protocol you will have time stamps of each action and can determine which happens first.

  • @JustSomeAussie1
    @JustSomeAussie1 4 ปีที่แล้ว

    why does it sound like you have something in your mouth

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว

      Not sure what you mean :(

    • @JustSomeAussie1
      @JustSomeAussie1 4 ปีที่แล้ว

      @@Hopsonn I don't know... Just kind of sounds like you've just been to the dentist and you still have gauze in your mouth.

    • @Hopsonn
      @Hopsonn  4 ปีที่แล้ว

      Thanks for the kind words

    • @JustSomeAussie1
      @JustSomeAussie1 4 ปีที่แล้ว

      @@Hopsonn Not trying to be an asshole. Just telling it how it is. Hey I like your videos, though. :)

  • @doot3122
    @doot3122 4 ปีที่แล้ว

    A.K.A making a minecraft rip off

  • @MaxMatti
    @MaxMatti 4 ปีที่แล้ว

    When adding compression all you're doing is essentially pushing the problem further into the future rather than actually fixing it. Later when you add chests or books or other large structures it will come back. It think you should either use an own (larger) queue or implement a system where you can just render the parts that are already there while waiting for the remaining chunks.

    • @stacyardus3898
      @stacyardus3898 4 ปีที่แล้ว

      when there are complicated structures available then only chunks with the structures will be big, the rest will still be small, and the structure will be smaller still because it would have air inside or around it, and chest data is sent as a request for a chest id, and then the chest data is sent, so chest data not in chunk, and chest id is made of the chests world position. boom done, :D

    • @lengors1674
      @lengors1674 4 ปีที่แล้ว

      Adding chests won't really increase the size of the compressed data that much, the only way that would happen would be if every block is different from the next, which in a normal game world won't happend ever, and most of the blocks will actually be identical to the previous one (and this problem could me mitigated with more powerfull compressing algorithms). But yes, I agree that he should render the chuncks as soon as he receives them!