13 ms·
Craft: A simple Minecraft clone written in C using OpenGL shaders
- enriquto 8y agoThe screenshot is an infuriatingly aliased image, wouldn't it be easy to fix?
- tbrock 8y agoFogleman has some really cool side projects in a variety of areas written in a variety of languages... and I noticed he’s got two kids! As a new father, how is this possible? Really boring/easy day job? Having a daughter is an amazing experience that is rewarding in its own right but something that really scares me about fatherhood is not being able to do any deep work for the rest of my life. Doing deep work is another part of living I really enjoy and I’m somewhat petrified that I’ll never experience it again. Maybe it doesn’t matter.
- dilap 8y agohe works at formlabs, which doesn't look easy and DEFNLY doesn't look boring! he also does carpentery and neat plotter art. pretty impressive guy. very inspirational!
- beaconstudios 8y agomy money's on him spending an hour or two every morning or evening, when the family are still in bed. I've learned recently how much more productive you can be by spending small time consistently compared to large time inconsistently (ie starting new projects full of excitement).
- tbrock 8y agoIt takes me an hour to even ramp up with all the context for anything of value... color me impressed.
- beaconstudios 8y agoI'm fairly new to this process myself but I'm finding the trick is to keep your designs extremely clean and easy to mentally model using types you can reason about. Then your software's features can emerge as interactions between "systems". That way (along with many other benefits) there's less to remember as you start coding. I find this post from the other day explains the principle better than I can: https://danshumway.com/blog/design-is-implementation/ https://danshumway.com/blog/design-is-implementation/ [edit] not that that is necessarily how Fogleman does it. It just helps me.
- laumars 8y agoAs someone who also does side projects with 2 young kids, all I can say is you get used to optimising your free time. You might be working through a problem while you sterilise bottles or other chores so that once you're sat down in front of your code editor, you can hit the ground running. A few tricks I've found: * Don't commit stuff to memory. Write notes, eg use githubs issue tracker. So you spend less time retracing your steps * Get used to working without spending half an hour restoring your environment. Whether that means you just Dev in a simple environment or use an IDE which supports workspaces, or you just sleep / hybenate your PC each night. Essentially you want to maximize your device time. To that end it also helps to rationalise your codes directory and class structure. It's a bit like working on projects with larger teams, because you cannot guarantee how much you'll remember (nor even how awake and switched on) when you next get dev time you then have to treat each next session as if you're handing over a project That all said, be flexible too. I break the above rules as often as I follow them. Sometimes I curse myself for it but sometimes it's just not practical to follow a process (time constraints or whatever).
- ryandrake 8y agoHaving a daughter helped me to learn how to be productive in 15 minute chunks, rather than needing a block of hours to “get into the zone.” It’s a skill like any other—learning to work productively without the zone. This is probably also why open offices and a afternoon peppered with meetings doesn’t bother me. I don’t need 30 minutes of quiet just to ramp up and start working on something. Thanks, fatherhood!
- k__ 8y agoOne of my professors would work two jobs, have two kids and do a major amount of side-projects at university. He told me his secret was that he only needs to sleep 5h a night.
- gameswithgo 8y agoIt is really hard to do deep work with kids, unless you have a spouse who is willing to do 100% of parenting and house upkeep, or can afford a nanny
- Keyframe 8y agoWe're expecting our first in December. Is it really like that? Don't scare me man, I have big plans!
- bovermyer 8y agoChildren, big plans, or sleep. Pick two.
- ztoben 8y agoFrom my experience having children and sleep isn't even always an option ;)
- bluGill 8y agoChildren are big plans. You don't get to pick sleep, and you don't get any other big plan. Fortunately Children for all their work are rewarding. You won't grow as much at work. However you get to see and do many interesting things in return. If you are lucky you can get your kids interested in your hobbies (this isn't that hard) One reason to never become CEO: they travel 200 days/year and thus don't get to see their kids much - at less than $10 million/year they are grossly underpaid for the time away from family.
- eismcc 8y agoOne is a lot easier than two
- swalsh 8y agoWhen the kids are at daycare, you'll get 8 hours a day at work to do your work. One of the hardest challenges I had to overcome after becoming a parent is learning to get everything I need to get done actually done in those 8 hours. But it's going to be hard, you'll have less sleep. Sometimes I stare at the monitor and my head is so cloudy I have no idea what I need to get done. To add stress, your younger coworkers are going to be working 10-12 hrs a day, and will probably be more productive than you. You'll look bad, and you'll feel worse. At about 3 years of age, things start to get better. Of course that's when my second was born :(
- guildan 8y agoWhat I find is really helping is if one of the parent is at home. You can do so more things that way during family time and personnel time. Oh sure you say goodbye to restaurant, travels and other "expansive" things, but it's really crazy how I prefer that lifestyle. It helps that I commute too so I have some free time for leisure, so back at home I don't need/want to pass as much time on "wasteful" activities.
- Rattled 8y agoI don't know how old your kids are, but if they're younger than 3 it gets easier. Never is extreme, you will surely have time for side projects at some point, but if you really care about it make it a goal to be part of your working day. That could be by expanding the scope of your current role, or cutting your working week to work for yourself a few days a month.
- nomel 8y ago> Maybe it doesn’t matter. Having a few people pass on me the last few years, and realizing I missed my first kids early childhood from poor work/life management at my dream job, I don't think it matters. You'll never eventually regret spending time with someone you love, but you may regret that writing <some program> made you miss out on that time. Maybe I'm getting old, or just burning out, but my kids are quite literally disappearing in front of my eyes, slowly turning into young adults. Trading them for some cash and some now obsolete product/device seems less and less "worth it". I'm not sure where that balance between myself, my kids, and money is, but it seems like a "pick two" type scenario, but in this case you have one short chance before the kids are no longer kids.
- freedomben 8y agoRecently felt this way. I looked at my 9-year old and thought of that tiny infant baby with a quivering lip and helpless cry. It seems like only yesterday he was being born. Also had some friends pass as well. One good friend from work committed suicide. Workplaces have a way of forgetting all about you, and what you accomplished, but family (and friends to some extent) don't. It's human relationships that really matter in this life. Don't miss out on your family for work. It may seem like a good trade, or simply what you must do, but in the end you'll regret the high cost.
- nvusuvu 8y agoI've got 5 kiddos. I use silly traditions/rituals to bond with them. We play a nightly game of ball tag. We have a couple of foam balls we throw at each other for 2-5 minutes. Its frantic and we all love it! We've made up all sorts of rules (Calvin-ball style) to go along with it. Afterwards, I tuck each of them in, the girls want hugs and kisses, the boys say they don't, but I know better. They usually get wet raspberries if they resist! Other traditions: Family Home Evening on Monday nights. (Rotate through the family members on whogets to lead a simple spiritual lesson. Even the 5 year olds get a turn and love being the center of attention.) Friday night is movie night. Some cheesy Disney movie from the 80s fit the bill most of the time. Lately, the kids have been asking for the movie Bedtime Stories. Sunday afternoons are board-gaming time. The kids pick the game.
- TaylorAlexander 8y agoI am one of those people who is very productive with side projects. I operate a YouTube channel and website and I design 3D printed robots which I am building all the time. It does take a lot of energy. People often are surprised I can do it, and say “ah you must not have kids”. Which is true, I don’t have kids. And I know that having kids means devoting a significant amount of your attention to them. Still, I feel like I will continue to crank out new projects even once I have kids. I’m sure my time spent on those projects would drop, but I doubt I’d stop entirely. I have friends who have no kids who don’t work on projects like I do. I think some people are just wired to churn and others aren’t. I have a friend who struggles to get much done on weekends, while I am kind of non stop moving. I think it’s a personality thing.
- minor3rd 8y ago> I am kind of non stop moving. I think it’s a personality thing. Yeah, I know people who are like that... I'm not one of them. I certainly can get obsessed with an idea or project and go nuts on occasion, but a lot of time I like to "just chill" on the weekend. Play some computer games and guitar, go on a bike ride or hike, etc.
- treespace8 8y agoSince my daughter was born, I no longer have free time for meaningful side projects. She is almost 9, and I measure my free time in minutes. What I do have is: - A great relationship with my daughter - A great relationship with my wife - A daughter who is kicking ass in every area of life, and is having a fun, enjoyable childhood. (Unlike my own) - I have not missed out on a thing. I have no second thoughts on my parenting. - I sleep great - Stress free home. - Homecooked meals everyday. (We both cook) There should be tons of time in the future for me to go back to side projects. But the time I have to raise a family is limited.
- basilgohar 8y agoIt's truly a blessing to be able to have this kind of perspective. I think a lot of frustration with one's current situation has little to do with the situation and much more to do with the perspective applied to the situation.
- tbrock 8y agoThis is a life worth living, thank you for the perspective.
- cookiecaper 8y agoYes, this. Childhood is fleeting. It's a cliche that you can't really appreciate until there's a big disparity between the age you feel like your kid should be and the age they actually are. It's crucial to capture those moments. We should all do more to ignore anyone who implies that the time would be better spent struggling against a compiler.
- exikyut 8y agoThanks for using that few minutes to find this spot to reply, and sharing the insight you did. Now I just need to learn how to find myself in the little things. I think that's what I need to do in order to sustain motivation and engagement. Not sure though, still working on it.
- jpfed 8y agoShe's not going to need quite as much attention when she's in elementary school, and much less attention when she's in high school. When she is in high school, starting to pull away from you, I hope you can look back without regret about how you chose to spend your time. In software development, we talk about context switching in humans like a cache that might take 30 minutes to warm up. But just as a computer has many levels of persistent state, so do humans. It's not a perfect analogy. And this isn't going to be what you want to hear. But speaking as a fellow dad, this is what I did and what I wish I'd done sooner. Take your todos- your plans about side projects, open source contributions, everything to do with coding other than your day job- and evict it from your mental cache, put it in a swap file, archive it to tape. Keeping that stuff fresh in mind is wasting space that could be spent on what is needed now. I have a stepdaughter, a son, and a daughter. I wish I could have been more present for my stepdaughter. I wish I could go back in time and hold my then-toddler son. At least I'm here for my daughter. Years from now, all my kids will be grown up enough that I can work on side projects. As much as it would be cool to write a game or a programming language or whatever, I don't want that time to come too soon.
- fogleman 8y agoFogleman here. Funny to see an old project in the #1 spot (again?). I hesitate to comment about this being productive while having kids thing, but some people seem to be implying that I must never spend time with my kids. It's far from the truth. A week ago my son (age 5) and I went camping in the backyard. Coincidentally, he and I have just recently started playing the real Minecraft together on our own private server - every evening lately. (I had never actually really gotten into the real Minecraft before, believe it or not.) We've been playing lots of Thinkfun games like Rush Hour and Shape by Shape. I actually still lay with my son while he falls asleep every night. My daughter (age 7) and I walked to the playground and played for a while there yesterday. We go out and check my vegetable garden daily, and my daughter likes to play "baseball" (plastic bat and ball) in the backyard with me. I work from home currently which is nice because there's no commute and I can see my kids a lot. We have "dance parties" in my home office where there's lots of open floor space. I could go on of course. I fully understand the sentiment that time is short when it comes to spending time with your kids before they are grown. There are plenty of folks without kids who aren't super productive too - so the whole thing seems a false dichotomy to me. Frankly I don't even feel like I work that hard. Maybe "hard" is the wrong word. A lot of people are constantly busy and have no free time. Yet they don't seem so productive? I'm the opposite of that, somehow. I know I'm under no obligation to defend myself - but there you go.
- brookhaven_dude 8y agoSo how do you pull this off? How much time do you spend in coding side projects? What do you do when your kids try to grab your attention during that time?
- sbjs 8y agoMy personal guess is that most people need "warm up" time to make progress on their projects, the time needed to build up the mental model of the whole domain. This can go from hours to days to weeks depending on the person and the type of mental model. But some people have certain domains where they can just instantly build up that model in their head and immediately begin making serious progress. You sound like you're one of the rare ones that can do this for a large number of domains (3d algorithms, project architecture, database structure, feature interaction). I'm only like that with a few very specific domains and I suspect most other devs are like me in that sense, so we stand in awe when someone has that natural in-built capability. (I think this not only goes for making progress but also learning new concepts, as I have seen other graduate students who can blaze through certain things like Haskell where I struggle as through molasses.) If this theory is true, then you probably aren't spending more than 3-5 hours on projects like this per week, but you're making the same progress most of us would need 2-5 weeks for. Btw I'm the guy who posted your project and emailed you, thanks for coming here to answer our questions and thanks for making such a cool project and making it freely available for all of us to learn from!
- z3t4 8y agoProgramming can be very relaxing, you forget about the real world for an hour or two. If you have children you can take turns. And let the kids get used to fall asleep alone, it will feel like torture at first, but when they get used to it you will get an extra hour of free time every evening.
- daeken 8y agoI have an 8 month old and I'm more productive now than I have been in ages, both in terms of side projects and day job. My wife and I both stay at home and split baby duties roughly 50/50; we alternate nights, then split the day pretty evenly. We also each get one day a week that is free of baby duties, so we can relax. I usually tend to use her naps as an opportunity to work on side projects, so I get a good solid 2 hours or so every day, plus any time I take after she goes to sleep for the night. These bounded, contiguous blocks of time focus me in a way that I find very helpful for productivity. I'm getting a ton done, spending a lot of time with my kid, and loving it all.
- sciurus 8y agoIt sounds like you have a very flexible day job.
- watwut 8y agoI have found that long hours at work or work that makes you very tired (or is very engaging) are bigger obstacles then kids. If the day job is easy, then you can have own projects in the evening. If the day job is tiring, then you cant. Kids require your time, but if you share duties with spouse, that alone does not make out-of-work projects impossible.
- legohead 8y agoI have 2 kids. They go to bed at 8:30. I stay up until 11, which leaves plenty of time to do my own stuff. I am usually too tired though and watch movies. Plus I still need to pay attention to the spouse :) But occasionally I work on my side projects/ideas.
- originalbryan2 8y agoI've got twin 3 year olds. Took a while to accept the fact that I have no time to do "things" anymore. And like another commenter, I measure free time in minutes. First time I got 30 minutes to myself (9 months into parenthood) I nearly wept. I'm at a point now that I'm happy to spend time with them and, after numerous false starts (that were crushed by repeat month long illness moving from person to person, random sleep problems/night terrors lasting weeks, etc) have abandoned all outside aspirations. And I'm ok with that. I do suspect things will lighten up in time. Perhaps I'll entertain side projects one day in the future.
- deleted 8y ago[deleted]
- souprock 8y agoWell, he only has two. I have 1.1 decachildren. Most blokes don't have more than ten kids, but if we need that extra push over the cliff...Eleven. One louder. I managed to be an open source contributer with kids. It slowed down shortly after the 4th and 5th kids (twins) were born, and it mostly stopped when I got to about 7 kids. I maintained Linux's procps package, added Tux Paint features, helped with the OLPC XO, did some Linux kernel changes, and other minor stuff. I wouldn't say I have a "Really boring/easy day job", but it does offer flexible hours and no expectation of going beyond 40 hours per week, and my commute is only 3 minutes by car or 15 to 20 by foot. (the job post: https://news.ycombinator.com/item?id=17442484 https://news.ycombinator.com/item?id=17442484) It helps to be in a place with low cost of living, so only one income is required. That gains back some time.
- t0mislav 8y agoTimes when you will have plenty of time will come back fast. :( Kids will start to play more alone or with friends, less with parents, soon they will also grew up, and you will remember the days when you were everything for them.
- kuwze 8y agoA great place to find stuff like this is r/tinycode[0]. [0]: https://www.reddit.com/r/tinycode/ https://www.reddit.com/r/tinycode/
- sbjs 8y agoI actually found it here https://github.com/uhub/awesome-c https://github.com/uhub/awesome-c
- sbjs 8y agoI don't understand how 3d games are written or know what shaders are, so this is complete magic to me, and I'm surprised it's only 5k lines of C code!
- diamondo25 8y agoDrawing cubes is basically one of the first things you do when starting with 3d rendering. Shaders are scripts that the GPU uses for translating your input (a cube in 3d data and your 'camera' and some more vectors) to viewport/screen coordinates. You can do a lot with it [0]. The classic OpenGL 1 framework had no shaders and a static pipeline. Its straightforward in doing things but reduces the amount of fancy things you can do. Maybe check out a guide like here[1]. [0] http://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/ http://www.adriancourreges.com/blog/2016/09/09/doom-2016-gra... [1] http://www.glprogramming.com/red/ http://www.glprogramming.com/red/
- bena 8y agoShaders are basically transformations performed by the graphics card. Or sometimes not. It gets real vague at times because like a lot of things there are no hard lines. You take a point and figure out if it needs to be colored differently based on certain criteria. Like if it was in shadow, or if it's being hit by a bright light, or you just want a sepia tone across everything. You can even shift everything. Take the screen and distort it according to some kind of function. Like make it all wavy. 3d games are no more or less conceptually different than 2d games in a lot of regards. There are more things to track and be aware of, but you're effectively doing a lot of the same things. If you've ever messed around with making 2d games, you can even begin simple experimentation by just making another layer of depth. Like LittleBigPlanet, it's ostensibly a 2D game presented with 3D graphics. But it allows you to shift between 3 layers to give you some depth.
- gameswithgo 8y ago> Or sometimes not. No, shaders are always done by the 3d card =)
- deleted 8y ago[deleted]
- a_r_8 8y agoI fondly remember looking through this a few years ago as it was one of the first posts I found at the top of HN
- _bxg1 8y agoVery cool. The beauty and draw of Minecraft have always come from the way it emerges from such simple elements. Reimplementing it in any language would be quite fun, I'd think. It's almost the new Doom.
- ilaksh 8y agoAs someone who built a Minecraft-like project (but I was careful not to call it a Minecraft clone because it was missing many core features) in JavaScript several years ago and a fan of actual Minecraft, I feel I need to say something. This is not a Minecraft clone. 99% of the projects out there that claim to be Minecraft clones are not close enough to be called clones either. The real draw of Minecraft comes from a number of core features, most importantly the crafting and the survival needs that motivate the crafting and building. Minecraft would not have become a hit if it was just a creative sandbox alone. This project has neither of those aspects of the game. Another thing missing is the diversity of biomes. And another thing-- all of the underground features like caves and mines are missing. So it doesn't have Mine or Craft, don't call it a clone. You wouldn't call something an IBM clone if it was missing core features of that computer. I think people do the part with just the blocks and rudimentary generation and call it a clone, it's almost like they are giving themselves credit for recreating Minecraft when they haven't even implemented 1/3 of the features, and they didn't even recognize the most important ones.
- jklinger410 8y ago>So it doesn't have Mine or Craft, don't call it a clone It does both of those things. You can mine blocks for resources and then make new blocks out of those resources. Your other points may be relatively salient, but a beta/alpha clone of a game does not have to implement every feature for it to be a clone. It seems like you've taken this too seriously and really did not need to say anything. It's not really a productive point. Say you've managed to brow beat OP down to calling his clone something like "A Minecraft-esque Resource Building Game." What have you done, at that point? Nothing. Calling something a Minecraft clone might be sensitive for you, and others, but it does not automatically make that sensitivity valid in any sense just because you feel it.
- Karrot_Kream 8y agoFor folks who want something a bit less pedagogic and more fun to play as a game, I highly recommend Minetest [1] which gives you a programmable layer on top of the base Minetest engine to make Minecraft-like game modes. [1]: http://minetest.net/ http://minetest.net/
- BuckarooBanzay 8y agoFor those interested in the educational part (as with minecraft) there is an article about using it in schools: https://wiki.minetest.net/MinetestEDU https://wiki.minetest.net/MinetestEDU
- dustfinger 8y agoThank you for pointing out this article. I am going to be teaching my kids to program and recently installed lord of the test so that we could have an interesting environment to work in. For other's interested, minetest has a channel [1] on freenode where you can connect with the community in realtime. [1] #minetest
- tills13 8y agoReminds me of spending countless hours messing around in ComputerCraft. So much fun.
- sergiotapia 8y agoInteresting choice of sqlite, what's the story on concurrent updates these days? Last I tried to use it for a project was in 2009 and even at a measly 3 concurrent people, sqlite had trouble with data lock errors. How does sqlite mesh well with Craft multiplayer?
- nautilus12 8y agoCan microsoft come after him for this?
- bachmeier 8y agoThey could sue Github's parent company for hosting it.
- nautilus12 8y agoLol
- pome 8y agoFogleman also have awesome Minecraft-clone[0] in Python/pyglet in just 900 lines of code. [0] https://github.com/fogleman/Minecraft https://github.com/fogleman/Minecraft
- srcmap 8y agoThis is very cool. I got it build/running in < 3 minutes in Linux. My boy love Minecraft. I like to use this as base to teach him more about programming. Any suggestion on small projects that can be addon / mod use this code as base. I am thinking a series of coding exercises that can be hack/add on to this: Add a command/mod to: 1) Draw line, Square, Triangle. 2) Draw Circle, Ellipse, Cone, Cylinder 3) Build Car, Airplane 4) Build Space Ship 5) Putting picture of his own face on the block. ... Any other suggestions? Each small projects take about 1-2 hours build on skill sets that learn before. It should be simple and fun to do with goals of encourage kids to learn programming. My boy finished all the CS classes in Khan Academy and seems to enjoys them. If anyone else has strong interested in this, I will see if I (we - group of us) can develop this as a new Khan Academy CS class and contribute it to KA.
- fogleman 8y agoTry running server.py locally. Then check out builder.py which will send commands to your server to change blocks. You can rapidly build all sorts of shapes with a few function calls. https://github.com/fogleman/Craft/blob/master/builder.py https://github.com/fogleman/Craft/blob/master/builder.py
- hwc 8y agoI really want something like that for vanilla minecraft. here's the closest I've come: https://github.com/HalCanary/mc-labyrinth https://github.com/HalCanary/mc-labyrinth
- andrew_wc_brown 8y agoI'm working on a Modded Minecraft series using AWS If anyone has an interest in playing on my server ping me. We could use a few more players. https://medium.com/@andrewbrown_78670/2018-modded-minecraft-server-on-aws-introduction-considerations-syllabus-e55545265a88 https://medium.com/@andrewbrown_78670/2018-modded-minecraft-...
- pwaai 8y agois there a realistic mining/digging simulator? I love minecraft but sometimes I wish I was digging a real mine with buttresses
- louisstow 8y agoI actually compiled this project to Emscripten a few years back: http://s3-us-west-2.amazonaws.com/ingame-data/emcraft/game.html http://s3-us-west-2.amazonaws.com/ingame-data/emcraft/game.h... Here's the code: https://github.com/louisstow/EmCraft https://github.com/louisstow/EmCraft
- sytelus 8y agoMy 5 year old kid is addicted to minecraft and there is no way to prevent violence (you can always keep killing animals even in Creative + Peaceful mode). The problem is that 5 year old have little context on consequence and they really get intrigues in exercising new power they have. I'd like a pre-schooler mode which actively discourages any violence. May be if you try to kill something, an alien would descend and take away all your assets. So only thing you can ever do in Minecraft is just build something :). If someone can add this feature, it would be AWESOME!
- dietr1ch 8y agoOn Zelda you have little incentive to attack the Cuccos (chicken).
- sytelus 8y agoMineCraft also has incentive: you get meat when you kill animals.
- deleted 8y ago[deleted]
- nitwit005 8y agoIf that sort of thing bothers you, I'm not sure it's possible to make a version that totally avoids it. Even breaking blocks is "enjoying destruction". I certainly enjoyed smashing all the bricks in Mario when I was little. That said, I suspect most 5 year olds can figure out that virtual cube pigs aren't real, and that there's no consequence to punching them with virtual cube arms.
- BillBohan 8y agoYou might want to try the free game Minetest [1]. It is very similar to Minecraft but the basic version, minetest_game, has no animals. You can add mods that give you animals if you want them but they are not necessary. There are hundreds of open source mods to choose from or you can write your own mods in Lua. I learned Lua by examining the mods that come with the game and changing them. You can play in a mode where you can't take any damage. Multiplayer games can enable or disable PvP. [1] http://minetest.net http://minetest.net
- partycoder 8y agoThis has a much brighter future than Minecraft on Linux or Mac (completely neglected after Microsoft acquisition).
- everyone 8y agoI'm assuming this runs about a jillion times faster than actual Minecraft? They should re-write minecraft like this; its performance has always been so awful.
- matrixagent 8y agoThey did. These days “Minecraft” officially refers to the new version, while what you are talking about is called “Minecraft: Java Edition”. As of now, both are maintained, though people are afraid that Java Edition is being phased out in favor of the new one. Main reasons for people preferring the Java Edition is modability and availability of an official server software for self-hosting.
- simplify 8y agoI am in awe at how the executable is less than 1mb to download.