Craft: A simple Minecraft clone written in C using OpenGL shaders
github.com
github.com
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.
he also does carpentery and neat plotter art.
pretty impressive guy. very inspirational!
[edit] not that that is necessarily how Fogleman does it. It just helps me.
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).
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!
Also, if you watch TV, stop. There is way more time to get things done if you don't watch TV.
He told me his secret was that he only needs to sleep 5h a night.
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.
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 :(
He's only about 4 or 5 years older than me(I'm 30). But, that's what the culture's like where he's from though I suppose. He's been here for about ten years and spent just about all his time working to bring his family over and then support him. He impresses the hell out of me, though, i'm glad I don't have to do that.
Why? Do you like this?
Right now me and one guy have a couple new guys helping us who don't really know what to do and can't really be left to do a lot unsupervised. Each of us also relies on the person before us completing our jobs on time. I'm right in the middle of the process, so if I don't finish everything I need to the people that come after me have to work even harder to finish everything on time.
If we're even a couple hours late for a job, customers complain, contractors cancel jobs and the boss is unhappy. I personally don't like burdening my coworkers more than I have to and honestly we do high quality work, I like knowing my work is well done.
We're a small place, we all work together to get things done. The boss puts in his time with everyone he's probably the last one to leave at night treats his employees well. Anything we need anytime to get our jobs done he'll get it for us right away, if we've ever got problems in life or other things he's understanding and tries to accommodate or help out as best he can, they've taught me so many things since i've started here and everybody was patient while I learned and at this point the shop relies on me to be there to do my job.
Oh and my boss is one of the few people I know I can honestly say is a hero. He rescued is family from genocide by the Khmer Rouge in Cambodia in the 70's when he was in his 20's, escaped to China then brought them all to Canada and started his business with nothing. So the way I see it, I can't really complain to much about having to work hard or long hours, i've never had to deal with watching my friends and family get lined up and executed with an axe to the skull.
And honestly, I just enjoy my job. I get to make things everyday, I program, I do physical work, operate and maintain giant machines, I get to be creative and i'm pretty much left to do whatever I want as long as i get my job done. Plus it's pretty cool to work making things from one of the earliest materials shaped by humans.
The fact that he works longer hours than anyone else isn't justification for this. As the company owner his decision to do so is an option he has chosen and the benefit he gets from do so greatly exceeds the benefits you get from doing so.
You have to work around the schedules of other contractors and professions and if you don't well, your company doesn't get jobs. There's a lot of competition in the industry. He doesn't expect me to constantly work overtime, I won't be fired if I don't, i've been told any time I can't it's ok, i'm never told I have to. I either make the decision to do so myself so the next day will be easier or i'm asked if I can.
I've never gotten in trouble for saying no and there are days where we're slower and there's not much to do. We don't get shit for taking it easy on those days or when we're standing around chatting when we have nothing to do. I personally work as hard as I do because I know I capable of it and it'sy job. I'm being paid to get shit done, when i'm at work i do what i'm being paid to be there for.
I haven't always had to work by myself. There were others doing my job when I started, one became the manager and has pretty much forgotten how to do my job. The other one first got moved to a different position outside after months of not being able to learn this job, eventually he got fired for fucking around too much. I was by myself for a few months after that while they kept trying to hire people who would either stay or actually work when they showed up.
I ended up getting a friend of mine a job with me and she did well at it. She was here for a year and a half before she had to leave due to health and overwhelming life issues at the beginning of this year. Since then i've been alone we hired one guy a little while ago, turns out he was just interested in things like where the security cameras were, which doors get locked at night, how much everything was worth, needless to say he didn't last long. The guy working with me now's been here a few months, he tried a few of the other jobs in the shop but the other people that work here weren't big fans of his work so for the last couple weeks he's been helping me. He's been picking things up, but there's a lot to learn and it takes time which I have to find in between doing my job. It's the kind of thing where a tiny mistake can cost thousands of dollars.
It's just kind of how it is, i'm in a fabricators facebook group. The top complaints from just about everyone is the lack of quality employees. Finding people willing and able to learn as well as being willing to work is difficult.
I dunno, everyone I work with is pretty dedicated to the shop and everybody else there. We like doing a good job. We like knowing our work is respected and valued. People are happy with what we make and we do things other people can't do. It feels good working hard in a place like that.
If those in your industry are finding it hard to attract quality employees then it is likely that your industry is not offering the proper compensation to attract those employees.
Work/life balance is important for everyone.
This is kind of the place where I'm at personally. I used to be the "high performer". I was always the go-to guy. I got there by working extra hours. Now that I can't work those hours, and I'm starting to meet my physical limits, I'm getting talked to about my performance.
If you can afford daycare
I'm sure everyone's mileage (and relationships) differ here.
The nuclear family concept has its pros, it's also far from "raising kids in isolation", pros which these days are marginalized in favor of "alternative family concepts", but what all of them fail to address is the original reason why the nuclear family fell apart: Middle-class jobs can't support single income families anymore.
That is the actual problem, not in what constellations people chose to parent their kids.
As the economic pressure increases, more people from the family are forced into more work, leaving less time for the actual family and taking care of children.
In an ideal world work-load would have shifted, so both partners only work like half the time, leaving both of them time for family stuff. But that's not what happened, nowadays often both parents work full-time jobs and still make not enough to be able to afford a nanny, which would be an even worse solution.
Imho that's the actual problem, solve that and you will free up more times for parents so the question of "What to do with the kids?" doesn't even come up in the first place.
What I don't do is hang out in bars or watch sports on TV. You have a lot more time per week than you think.
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.
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.
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.
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.
One day when your kids want to remember fun times with you, they won’t have to try hard.
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.
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.
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.
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.
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.
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.
I'd add to that, sometimes people could get going faster if they really tried, but they're just a bit lazy or burnt out and need a rest. So they say OK, I've finally got an hour of free time, but I'll just check Hacker News first, check my email, read this article... and now they only have 20 minutes of work time left.
Whereas a few people either don't need so much time to recharge, or they just push themselves into getting started anyway, and usually once you actually start working it's not so hard to continue.
Getting enough sleep helps a lot with motivation to work. Although then you have less time! So I'll just stay up late this one time and get this thing done...
It also depends on what standards of productivity you aim for, and who you compare with. Many people say I do lots of stuff when comparing to themselves, and I feel unproductive 'cause I'm comparing to myself 5 years ago, working 14 hours/day.
I should try to get into The Flow faster (maybe leaving notes of what to do next when finishing a task? --and removing twitter and similar..)
Anyway, finding a good balance between family and work time is extremely difficult for me, one of my biggest endeavors, even after 3 years of parenthood.
(Of course this means that one is probably not always going to do "production ready" things, but it's for fun, so it doesn't really matter. Sometimes it's fun to just go nuts and sprinkle "undefined"[1] all over the code base and just go from types to implementation as fast as humanly possible.)
[1] This is a Haskellism, but basically means any of:
assert(false)
throw new NotImplementedException(...)
???
etc.I'm guessing this is the fundamental difference.
It even works well as the server backend for my NetCraft client, which is based on fogleman's Craft. The support plugin WebSandboxMC provides a WebSocket client for the web client to connect to, and it runs well on the Glowstone server, compatibility with Glowstone being a top goal.
So with these projects you can have both an open source client and server talking to each other, the full stack open source. The downside, of course, is neither are complete, but it is a start. Open source can only get better (contributions certainly welcomed).
Another project I'd recommend for those in the market for an open source server is Cuberite. It is written in C++ and supports plugins written in Lua. Also has a very active developer community, maybe slightly bigger than Glowstone. Last year I added Forge handshake support, so modded clients with Forge can connect send their mod list, while server plugins can register certain mods as required. Not full Forge mod support, but a necessary prerequisite. The downside of Cuberite is, without Java support, it doesn't have compatibility with Bukkit or Spigot plugins, so there is a vastly smaller ecosystem of plugins available, unlike Glowstone which can use many of them no problem.
Either way, both Glowstone and Cuberite servers, and Craft-based clients (shameless plug for NetCraft/WebSandboxMC), are very exciting and promising projects in my opinion. Personally I have not contributed to either recently, seeing this post I'm tempted to pick them up again, yet for better or worse I've moved onto other things. I'm certainly rooting for them to keep up their open source momentum, could turn into something very cool!
For anyone interested, last year I've taken fogleman's Craft and ported it to run in the browser using WebAssembly and emscripten: https://satoshinm.github.io/NetCraft/. It can be used with a Bukkit plugin to provide an interactive web-based interface to (a small section of) the world in Minecraft server. Have not worked on it recently, but could be a fun project to develop further, for all the open source contributors out there. I tried to merge most of the open pull requests and other forks of Craft, but life has gotten in the way...
You're literally an example of a "10x". I have a similar experience --- it doesn't feel like you're doing a lot, but the vast difference becomes noticeable if you compare. You can get more things done in a day than others can in a week. That's just your natural ability. Enjoy it.
Find that, and you already have the itch+curiosity+motivation+rationale+justification (mostly the itch) to just jump in somewhere.
[NB. Mis-typed Netflix, then left it in.]
Thanks for all the inspiration, keep it up.
Aside, yes there are a lot of false notions going around and good to have engineers like you to prove otherwise!
So far I have 18 b8 c4 23 86 1b 9c 60 f6 ec b0 (...11 octets...?), and I'm not sure what to do with them.
Looks like you can focus well and have stamina.
How do you keep motivated doing such a project for fun in your spare time?
Do you work 40h/week?
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.
Kids require your time, but if you share duties with spouse, that alone does not make out-of-work projects impossible.
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.
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)
It helps to be in a place with low cost of living, so only one income is required. That gains back some time.
[1]: http://minetest.net/
For other's interested, minetest has a channel [1] on freenode where you can connect with the community in realtime.
[1] #minetest
http://s3-us-west-2.amazonaws.com/ingame-data/emcraft/game.h...
Here's the code: https://github.com/louisstow/EmCraft
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.
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.
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.
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.
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.
Minecraft became big way before survival. I remember playing for hours on Classic just building stuff with unlimited materials and talking to random people about their buildings.
Just go to any creative mode server and you will see that crafting/surviving is just a minor part of the game.
But also, this is just a cool project, and you could probably stand to chill out a bit and just enjoy that fact :)
Playing on my own, I thought the same thing. But then a coworker hosted their own server and we had probably 12 people playing on the same map. It was amazing what each person was doing. Some built elaborate structures, some farmed, some raised animals, some cleared caves/mines. One guy would just dig - long straight tunnels, he mostly banked all the stuff he mined. Watching my young nieces play the game (not on the server with my coworkers), they simply enjoyed the free-form creative mode.
The glory of Minecraft is that it's so many different games to so many different people. If you like the survival aspect, that's great, but that's not how everyone plays the game.
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-gra...
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.
No, shaders are always done by the 3d card =)
Effectively, a shader is no different than any other bit of code you have. Anything you can do in a shader you can do on the main program thread (and vice versa). Now, things you typically want to do with a shader are better done by the GPU for various reasons. Better floating point math processor, pipelines more suited for the task, etc.
And you can make the shaders generic enough to reuse for multiple applications. Basically the shader says "Hey, here's where the light source is, here's the luminosity, here's the color, here's what it is shining on, here's how the color changes."
And being essentially dedicated number crunchers, people realized that not everything sent to a graphics card needed to actually render. You could make a shader to do something crazy, like solve complex equations more quickly than a generic CPU could. So if this was 8 years ago, you might decide to write a shader that could effectively mine bitcoins. Which is what people did and why good graphics cards have become crazy expensive.
Basically, I knew I was going to be slightly wrong about something somewhere.
I mean, effectively anything you can do with a GPU shader, can be done by the CPU, so it seemed reasonable to me that you could make something functionally equivalent for the CPU and call it a shader.
It started feeling like the difference between "programming language" and "scripting language" in my head.
https://blog.chromium.org/2016/06/universal-rendering-with-s...
How does sqlite mesh well with Craft multiplayer?
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-...