How I made a world with trillions of gems in C with Raylib

Поділитися
Вставка
  • Опубліковано 5 гру 2023
  • Wishlist Moose Miners on Steam:
    store.steampowered.com/app/25...
    In this devlog I talk about how I implemented a huge amount of minable gems in the game.
  • Ігри

КОМЕНТАРІ • 88

  • @lingonstudios
    @lingonstudios  6 місяців тому +5

    Help support me and the channel by Wishlisting Moose Miners on Steam: store.steampowered.com/app/2591410/Moose_Miners/?

    • @plasma1492
      @plasma1492 3 місяці тому +1

      please add reset to game demo i finished it in 2 days also should find way to reduce lag when lots of minecarts on screen :)

    • @lingonstudios
      @lingonstudios  2 місяці тому +1

      @@plasma1492 There is an option to reset the progress of the demo in the settings screen from the main menu. What cpu and gpu do you have? I have worked quite a bit on the performance for rendering the carts, but it will stil need decent enough hardware to run well when there are a lot of minecarts with a lot of gems. I will probably add some graphics options in the full game that will help it a bit, until then you can try running the game in a lower resolution that should help a bit

    • @Robert-pl1gd
      @Robert-pl1gd 26 днів тому

      I there an email or something where we can offer suggestions on improving the game

  • @ernesto_torres
    @ernesto_torres 6 місяців тому +33

    This is a great example of a game that really benefits from a custom game engine. Looking forward to more of your videos

  • @BlueprintProgrammer
    @BlueprintProgrammer 6 місяців тому +27

    Aa a raylib developer I would love if you would talk with ray about adding your custom functions into raylib proper, and adding your optimizations to existing ones. Thank you very much for your impressive work.

    • @lingonstudios
      @lingonstudios  6 місяців тому +11

      I'm not sure if those function would fit with the simplicity that Raylib strives for to keep. But I'll try to find some time at some point to package them together so they can be used as an extension to Raylib for those who want them

  • @CarlsSimGuides
    @CarlsSimGuides Місяць тому +1

    I had a lot of fun with your game. I didn't play optimally at all and it's the first idler where I feel like I'd want to go back and try another save file to see if I could create a better flow. As a dev myself i was constantly thinking of how you must have achieved all of this and I really appreciate the explanation as a result. I knew just drawing all these gems had to be taxing let alone all the moose and their AI. You did a good job explaining just how all that works and I respect you sharing those secrets. You definitely deserve praise for your hard work and making a game I can enjoy for a dozen hours at least for such a low price. Thanks for that. Please make it possible to toggle mine cart lanes and/or wand makers though. it'd be a big improvement for those of us who made mistakes but might not want to start over entirely :)

  • @Razvvannn
    @Razvvannn 2 місяці тому +4

    Very nice video, liked and subscribed!

  • @ghostpeppered4524
    @ghostpeppered4524 5 місяців тому +2

    This is incredible! I can't believe how underappreciated the programming work is here. I must know more about this data-oriented approach!

    • @lingonstudios
      @lingonstudios  5 місяців тому

      Thanks! I hope to get some time to do a few more videos about the different parts of it

  • @GonziHere
    @GonziHere 6 місяців тому +3

    Hey, about the limitation you've mentioned: I did something similar for my minecraft and my way of doing it was to only store the modification. I've asked my procedural function "what's here" and it first checked the handcrafted content and then the procedural algorithm. And the best part was that handplaced content that was the same as the procedural output was simply removed from the save file.
    Like in your case, I'd store only the modified lanes, for them, I'd store what's the first gem in the line (everything before is empty) and last space (everything after is procedural), inbetween, I'd only store where the missing/touched gems are and how touched they are.
    I'm not saying that you should do it, it's pointless for your game, I'm just mentioning that it's exteremely flexible way of storing even big changes without effort.

    • @lingonstudios
      @lingonstudios  6 місяців тому +1

      Yeah I was thinking about a system like that at the start of development. The issue is that will still result in a lot of data needed to be stored if you start mining a substantial part of the map and mine horizontally at multiple places. Still of course nowhere near the data needed to store everything as a unique gem instance, but would end up being much more than what is needed with this simpler version.
      The solution you describe works really well in a game like minecraft where you have a really big world but you are only loading a limited area around the player at a time. Then you only need to worry about the data fitting on disk. In my game the whole world is simulated all the time, even if you don't see the miners they are still mining. So I am much more limited in how much of the data I can just leave on disk and pretty much need to have all in ram. It is also really beneficial to keep the data describing the game as small as possible so it better fits in the cpu cache when working on it, since having to grab the data from ram is quite expensive

  • @SystemsDevel
    @SystemsDevel 3 місяці тому +2

    Hello, amazing work and optimizations, really a lot to learn from this video. Looking forward to playing the final game!
    I have two questions:
    1) Have you considered adding a minimap?
    2) Have you used any Assembly mixed with the C code for this game?

    • @lingonstudios
      @lingonstudios  2 місяці тому +1

      Thanks!
      1. No haven't thought about it actually. But now that I think about it, the world is too large to display in a minimap. So it would have to just cover a part of the world and then it does not feel that useful anymore since you can zoom out the game quite far already. What might work would be something like the zoom in Supreme commander where the whole screen basically turns into a minimap when you zoom out far enough. But that is not something that would be high on the priority list atm.
      2. There is no raw assembly in this project, but I do use intrinsics in a few areas, for example to speed up matrix multiplications. Intrsinsics are basically assembly since the intrinsic functions do directly correspond to assembly instructions.

  • @ThePotOwl
    @ThePotOwl 23 дні тому

    i cant stop moose-ing i love this game. i need to be able to zoom out more out and a button to select all moose

  • @ahmedsat4780
    @ahmedsat4780 6 місяців тому +1

    man, I really love your videos

  • @pr0r1der
    @pr0r1der 2 місяці тому

    Looks great! Inspired me to finally install raylib and give it a go after not really feeling godot and giving up on blueprints only approach in UE! :D A bit of a noob question - how do you define a map so big? Does it load in chunks as you move the mouse, or are there some fancy optimizations like this. I am thinking about having a big map with all kinds of BOIDS doing their own thing in different places of the map and was curious about your approach.

    • @lingonstudios
      @lingonstudios  2 місяці тому +2

      The data for the map is explained in the video and then when it comes to rendering I just calculate what part of the map is visible on the screen and get the needed data to render that. Basically just view frustum culling. Same goes for the moose and the base, I just render what is actually visible to the camera. However I do process everything regardless if it is visible or not, so the moose and the part of the base that is not visible operates just the same way as the ones that are currently visible. Otherwise the game would not work. So it is only the rendering work that can be lowered based on what is visible. To handle a large base and many moose it is just written with decently optimized data oriented code and it is multithreaded running at 30 ticks per second

  • @fmilioni
    @fmilioni 6 місяців тому +2

    Your game looks amazing. 🎉

  • @Tottelbe
    @Tottelbe 6 місяців тому

    Very cool stuff! And definitely loving the data-oriented approach.
    Do you know if my progress in the demo can carry over to the full game?

    • @lingonstudios
      @lingonstudios  6 місяців тому

      Thanks! The plan is to carry over the progress from the demo to the full game. But I am planning a rather large addition to the full game that might make it tricky so can't promise 100 %, but I will do my best to design the new stuff in a way that allows the demo progress to carry over.

  • @l_t_m_f
    @l_t_m_f 6 місяців тому +1

    love C, such easy to grasp the code in one glance

  • @Robert-pl1gd
    @Robert-pl1gd 4 місяці тому

    I got soo hooked on the demo that I cleared the whole board. Can't wait for the full release. I wish I could start the demo over again but unfortunately even uninstall won't fix that. Guess I have to wait

    • @lingonstudios
      @lingonstudios  4 місяці тому

      There is a button in the settings screen from the main menu to reset the game

  • @TECHNOBOG
    @TECHNOBOG 5 місяців тому

    Your work is inspiring.
    It would look cool if the trail of carts had an increasing offset in its motion to simulate inertia. Think snake instead of the solid line you have right now.
    You should also have avoidance (not necessarily collision) so objects do not pass through each other.

    • @lingonstudios
      @lingonstudios  5 місяців тому

      Yeah I have plans on adding some physics to the carts so they won't be a rigid line, I just haven't prioritized that yet since in the demo there is only one cart anyways. I would like to have avoidance as well, but I'm not sure it is going to be worth first the development effort and secondly the cpu time. I'll have to see how much time the rest of the things planned takes first

  • @empireempire3545
    @empireempire3545 6 місяців тому

    Would you consider open sourcing your custom Raylib functions? I love them

    • @lingonstudios
      @lingonstudios  6 місяців тому +1

      Yeah sure, I'll try to find som time to do that at some point

  • @ryonagana
    @ryonagana 26 днів тому

    i love raylib. it's like DOS BGI but modern

  • @gryasl6231
    @gryasl6231 6 місяців тому +1

    Sidestep Legends wasn't suitable to me but I'm waiting very excitedly for this game. But I have 2 questions
    1- could you make a video about raylib+shaders? would be greatly appreciated if it can be much more like a tutorial.
    2- I got so many bug on demo of Moose Miners, is there anywhere to submit these videos/screenshots? or is it even important right now, because its already a demo and ofc it will be have bugs?

    • @lingonstudios
      @lingonstudios  6 місяців тому

      I'm glad you're excited for the game!
      1. I don't think there is much gain from this since there are a lot of great shader videos on youtube already and using shaders in Raylib is no different than using shaders in pure OpenGL
      2. I'm happy to take bug reports for the demo. The best way is to send an email to support@lingonstudios.com and if it is something that is actively happening in your save file please include the save file as an attachment (you probably need to zip it so it fits in the email). And any pictures or videos of it would be helpful as well

  • @madboxtv6853
    @madboxtv6853 6 місяців тому

    Do you use an ECS lib like FLECS or Entt ? Cuz i want to try to use Flecs but i think my programming skill are to low to implement this and use this. I saddly need vidz tutorial (youtube or udemy) for going forward. But i will try at least and spend some hundres hrs on it and see where i can go.

    • @lingonstudios
      @lingonstudios  6 місяців тому +2

      Nope I don't use ECS so no library like that is needed. I don't think ECS is that useful really if you are writing your own "engine" for your game. It makes more sense in a general engine like Unity, but if you are not using anything prebuilt like that ECS is not helping much really and is mostly just going to be in the way. Just thinking data-oriented and keeping the architecture of the game simple and straight forward will get things done both quicker code wise and usually with better performance in the end as you can make more specialised solution to the problems. I would suggest to just look at the problems you need to solve for your game as a transformation of data since that is really what all computer problems boils down to in the end. And really think about what data is actually needed and try to find the simplest and smallest form of it to solve the problem.

    • @madboxtv6853
      @madboxtv6853 6 місяців тому

      thx for this light. I was thinking that data oriented is automaticly ECS but seems i was wrong. Maybe i was induced buy the Unity Dot stack hipe. But i will make some research and read more about DO @@lingonstudios

  • @paraxodondev
    @paraxodondev 6 місяців тому

    is it possible to make the carts that follow the moose be more dynamic? i wonder if the optimization makes this impossible.
    Your work is incredible, i hope to become an engineer such as you to be able to come up with such complex optimization techniques (when i say complex i mean for me).

    • @lingonstudios
      @lingonstudios  6 місяців тому

      Thanks, I'm glad I can be an inspiration. Yeah I will make the carts move behind each other with some physics so they are not all one rigid train. It would be quite the optimization task to do that for all 32k miners where each can have maybe 5-10 carts (have not decided on the actual max number of carts yet). But fortunately the movement of the carts have no impact on the gameplay it will only be a visual one so I only have to calculate the physics of the visible carts so that should be doable.

  • @CYXXYC
    @CYXXYC 2 місяці тому

    0:51 the virtual functions bit is probably the only questionable, maybe premature optimization also (when its actual premature optimization; profiling is much better though)

  • @user-me8ru6fg1o
    @user-me8ru6fg1o 5 місяців тому

    Hello, i m sorry for asking for this under this video, but when you made a game in assembly, how did you managed to draw pixels on screen ? because i would like to make a 3D game in C and using assembly, to make it a bit faster and to learn . Thank you.

    • @lingonstudios
      @lingonstudios  5 місяців тому

      I use directX11 in my assembly projects. You can link any C api to assembly code really. But if you are going to use C and assembly you might as well communicate with DirectX or whatever graphics API you choose through C and use assembly for the most performance critical logic parts of the game. I have a video on the channel where I show how I setup DirectX11 with assembly if you are interested in that

    • @user-me8ru6fg1o
      @user-me8ru6fg1o 5 місяців тому

      thank you very much@@lingonstudios

  • @blueboy3990
    @blueboy3990 5 місяців тому +1

    RCE played your game!

  • @jurusco
    @jurusco 17 днів тому

    Let me ask you a weird question, do you think this kind of optimization would be possible using like just blueprints in unreal engine, or for this kind of optimization it must be done in code.
    Sorry if this is a dumb question i'm not a programmer.

    • @lingonstudios
      @lingonstudios  17 днів тому

      I don't think a visual scripting language like unreal blueprints would be able to achieve this. Blueprints are more suitable for setting up gameplay code for more traditional games where you already have components that handle the more expensive logic. But since the actual gameplay code of a game like this is quite simple compared to the simulation and by necessity quite heavily integrated into the simulation code it would not really make much sense to try to make it using blueprints. Maybe setting up the upgrades and UI stuff with something like blueprints would work after you have written the heavy simulation systems and gameplay in c++.
      In general if you want to get away with using only blueprints in Unreal, I think you'd need to make a first person game, preferably a first person shooter. Since then Unreal will have a lot of things ready to use for you to call from blueprints.

  • @steveskeletonneii6336
    @steveskeletonneii6336 5 місяців тому

    this is amazing wow

  • @liamcarter1322
    @liamcarter1322 4 місяці тому

    I LOVE how this game looks but unfortunately I can’t get it because I don’t have a pc… for now but if I ever get a PC this is the first game I get :)

  • @skwayesahmed5818
    @skwayesahmed5818 Місяць тому

    amazing game
    thanks

  • @sevvalpamuk1505
    @sevvalpamuk1505 Місяць тому

    Hello, I am trying to make Angry Bird in C language with raylib, but I had difficulty in making the sticks fall over in relation to each other and kill the pig. What should I do for this? Can you help me? This is my project assignment. 🥺

  • @michaeloconnell145
    @michaeloconnell145 2 місяці тому

    How do you handle animations in Raylib, do you use iqm/gltf? Or did you write your own shader using your own model loader?

    • @lingonstudios
      @lingonstudios  2 місяці тому +1

      I use the iqm format, but I have written my own code to handle the animation on the GPU by baking the animation data as a texture

    • @michaeloconnell145
      @michaeloconnell145 2 місяці тому

      That's so cool! So each pose or boneTransform is performed from a lookup similar to 2d animations with sprite sheets vs passing a boneTransform uniform for every mesh per evaluated frame?

    • @lingonstudios
      @lingonstudios  2 місяці тому +1

      @@michaeloconnell145 Yeah sort of, but the pixels in the texture holds the data for the transforms for each frame. So if you draw the texture to the screen it would just be a bunch of seemingly random colors. It is a very common technique, if you search gpu skinning you will find a bunch of explanations and tutorials about it

    • @michaeloconnell145
      @michaeloconnell145 2 місяці тому

      ​@@lingonstudios Thank you!! Also congrats on Moose Miners it is insanely fun can't wait for the full release!

  • @stank_it8114
    @stank_it8114 6 місяців тому

    Have you considered streaming? People might find it pretty interesting. Also if you cut the vlogs in parts it’s “free” YT videos ready to go.

    • @lingonstudios
      @lingonstudios  6 місяців тому

      Yeah I have though about it. I did do a stream explaining the code of my previous game Sidestep Legends, there is a vod of it on the channel. For more daily streams, maybe I'll try it at some point, I just have to get used to the idea of people watching me work live first and I think it might reduce the productivity for me quite a bit so we'll see if I find the time and courage to try it out sometime

  • @anzhel3268
    @anzhel3268 6 місяців тому +5

    finally a based programmer on youtube 🥰
    let's show those pOOPheads that we are not just control freaks!!
    love your content

  • @noobandfriends2420
    @noobandfriends2420 3 місяці тому

    This explains why the moose cannot mine adjacent gems.

  • @noobandfriends2420
    @noobandfriends2420 3 місяці тому

    People have cleared all of the gems in the Demo in just over an hour. Whatever you think, people will clear all 64 trillion gems in a couple hours once the full game releases.

    • @lingonstudios
      @lingonstudios  3 місяці тому

      I think those scores are done by using memory editors to cheat or something similar, but it does not really matter since there is quite the difference between the about 400 thousand gems in the demo and 64 trillion in the full version. Even if you had a moose that mines 10 gems per second, which is much faster than what the current upgrades in the game can allow, it would still take over 6 years for that moose to reach the end and that is if it did never have to turn around to leave the gems. And that is just for one column. Even just moving the camera to the end would take over 9 days of moving the camera with max zoom and increased camera speed button pressed.
      The good thing about it is that there is room for some crazy upgrades in the game to allow the moose to come a bit closer to the 10 gems per second I used in the example

  • @NNM42
    @NNM42 Місяць тому

    more devlogs

    • @lingonstudios
      @lingonstudios  29 днів тому

      Yeah I hope to get some time for more devlogs at some point. Currently it is very hectic with getting out updates for the game

    • @NNM42
      @NNM42 29 днів тому

      ​ @lingonstudios i'm will wait and logs and updates. Now need give last 3rd achieves on 10k.

  • @thebeardedatheist
    @thebeardedatheist 5 місяців тому

    I want to play this so bad

    • @lingonstudios
      @lingonstudios  5 місяців тому

      You can try the demo on Steam if you haven't already!

  • @derfiete111
    @derfiete111 5 місяців тому

    will the full game cost?

    • @lingonstudios
      @lingonstudios  5 місяців тому

      Yeah, the full game will be a paid game

    • @derfiete111
      @derfiete111 5 місяців тому

      do you already know the price@@lingonstudios

    • @lingonstudios
      @lingonstudios  5 місяців тому +1

      @@derfiete111 No, I haven't decided on the price yet. I will probably announce it together with the final release date when that is decided

  • @azhr9266
    @azhr9266 5 місяців тому

    When is the early access i have mined everything so far 😂😂😂
    I am ready to buy the game.

    • @lingonstudios
      @lingonstudios  5 місяців тому +1

      There won't be an early access for the game, but the full game will come out sometime in Q2 this year

    • @azhr9266
      @azhr9266 5 місяців тому

      @@lingonstudios so there is no way to play the game till then :L
      sad so fun tho

  • @dryoldcrabman6890
    @dryoldcrabman6890 5 місяців тому

    no git hub!? :(

  • @MHGames03
    @MHGames03 19 днів тому

    Has anyone mined the whole map, is it even possible xD I am only 2k depth at the minute

    • @lingonstudios
      @lingonstudios  18 днів тому

      It is very much possible at the current release, and I would guess that there are probably at least someone that has done it already based on how far some of the saves I've gotten from bug reports have been. But that is because the current depth limit is 4800 right now as I there is not any interesting content after that limit as of now. After a few content updates where I extend the depth limit it should be much harder clearing the map or even reaching the max depth

    • @MHGames03
      @MHGames03 18 днів тому

      @@lingonstudios How wide is the map?

    • @lingonstudios
      @lingonstudios  17 днів тому +1

      @@MHGames03 32768 columns wide

    • @MHGames03
      @MHGames03 17 днів тому

      @@lingonstudios a long way to go then haha

  • @chrisflory1268
    @chrisflory1268 5 місяців тому

    he spelled color wrong

    • @chrisflory1268
      @chrisflory1268 5 місяців тому

      colour

    • @lionzzz
      @lionzzz 5 місяців тому

      ​@@chrisflory1268same thing you can write both ways

    • @lingonstudios
      @lingonstudios  5 місяців тому

      Found the American ;)

  • @StitchesForScars
    @StitchesForScars 6 місяців тому

    🏳️‍⚧️ trans flag spotted ❤