Handmade Hero»Forums»Game
1 posts
Going through the series with Linux?
Hello everybody!

To get on the point quickly, I am going to stay short with introduction. I have always wanted to create something with code and starting with a few very simple scripts to ease my life I slowly moved to the point where I wanted to make a functional program or a game. But the problem was that with my wide variety of languages that I had "read a few random blog posts to understand what everything is about" I couldn't get myself interested enough to keep on. Things that interest me usually are in-depth (or so called "hard" ones) and with a ton of (not) amazing tutorials for every language I got bored. There was no challenge. So, when I discovered Handmade Hero project it was quite a bait for me. To build everything from scratch - that is what I had always wanted to try out, but had never really thought about (it might be because of negative effects of every tutorial telling me to depend on some kind of library or tool).

My problem is that OS on my computer is Ubuntu (really loving it and not going to change it in any foreseeable future) but the game is written mainly for Windows platform and only after it is built on Windows information about how to port everything to Linux and other platforms will be covered (at least I understood that from reading the introduction and watching a few videos). It is quite a bummer to me since I am incapable of installing Windows as another OS neither on computer nor on virtual machine. The idea of not being able to execute code that I write is not very welcoming.

Could anyone who started following the journey on Linux distribution tell me about their story? How has it been? Is it possible to set it up everything nicely and follow the tutorial without too many things to worry about? If it is not really Linux friendly, perhaps anybody knows a way to get my hands wet with some kind of books or other material? (I really like the idea of building everything from the ground)

I am very sorry, if the question seems too basic, but I do not have much experience in the field. Thank you everybody in advance for your answers!
David Butler
81 posts / 1 project
I love pretty much anything technical, whether it be programming, networking, hacking or electronics.
Going through the series with Linux?
I am on OS X, and have a similar issue. If you have Pre-ordered the game, then you can access alternate platform layers (SDL) via the private Github. You may need to go back to an earlier version of the platform layer in-order to be compatible with wherever you are in following along... :)
Kim
Kim Jørgensen
64 posts
Going through the series with Linux?
Hi Zyberg

I have been following the show on Linux all the way. I started using David Gow's Handmade Penguin, which I would recommend you to take a look at. When he fell behind I decided to maintain a port based on his work, and with a good help from this forum it turned into the SDL port in Github.

Casey has been very supportive when reporting issues with GCC and Clang, so there hasn’t been any major roadblocks so far.

/Kim
64 posts
None
Going through the series with Linux?
Hi,
I've done the serie from 1st to 50th episode on linux.

I just plainly used winegcc to compile it as a native executable.

Apart from the post I added to this thread I had no problems until episode 50. So you can go for it.

The firsts episode is only on making a prototyping windows platform layer. It's less interesting that what follows, so if you feel bored during this part you should skip it.

Once the platform layer is done, there is very few comeback to it, so it's save to just use the sdl platform layer someone made for handmade hero. (can't find the link right now) This way you can compile natively.


I kind of cheated on the linux only part as I use windows in a VM for the only purpose of using visual studio's debugger. (Today I would use nemiver instead I think)


Have fun following the serie. :)
11 posts
Going through the series with Linux?
Take a look at the blog of Banished, a game made by one single person. He has since ported his game to both OSX and Linux, and he says in his blog that after the OS X port, Linux was not that much of a deal. And he also said that Linux was quite good actually.

75 posts
None
Going through the series with Linux?
Edited by Mór on
Kim
Hi Zyberg

I have been following the show on Linux all the way. I started using David Gow's Handmade Penguin, which I would recommend you to take a look at. When he fell behind I decided to maintain a port based on his work, and with a good help from this forum it turned into the SDL port in Github.

Casey has been very supportive when reporting issues with GCC and Clang, so there hasn’t been any major roadblocks so far.

/Kim


I downloaded it and the first release begins at around episode 150, while Handmade Penguin ends at episode 19 or 20. Penguin requires some rewriting to make it work with episode 40, which is where I'm up to.


albatros
Hi,
I've done the serie from 1st to 50th episode on linux.

I just plainly used winegcc to compile it as a native executable.

Apart from the post I added to this thread I had no problems until episode 50. So you can go for it.

The firsts episode is only on making a prototyping windows platform layer. It's less interesting that what follows, so if you feel bored during this part you should skip it.

Once the platform layer is done, there is very few comeback to it, so it's save to just use the sdl platform layer someone made for handmade hero. (can't find the link right now) This way you can compile natively.


I kind of cheated on the linux only part as I use windows in a VM for the only purpose of using visual studio's debugger. (Today I would use nemiver instead I think)


Have fun following the serie. :)


I tried winegcc and it compiled and sort of works, but Handmade Hero didn't display any bitmaps. When I tried to debug it using nemiver, I couldn't get it to do anything but crash. Are the flags you set enough for nevmiver to debug it?

I also tried VirtualBox and it nuked my Linux install. A pox on Virtualbox! lol

Now I'm thinking of trying CLion Windows on Linux using Wine. I checked on the Wine website and there is one version of MS Visual Studio that works in Wine, so I thought I'd try it for a laugh, but I'm not expecting anything. I think the path of least resistance at this point is to dual boot Windows and Linux.
Abner Coimbre
320 posts
Founder
Going through the series with Linux?
Mór
Now I'm thinking of trying CLion Windows on Linux using Wine.
Dear god.
I think the path of least resistance at this point is to dual boot Windows and Linux.
Just do that.
75 posts
None
Going through the series with Linux?

I'll try any crazy thing to avoid running MS. lol
Kim
Kim Jørgensen
64 posts
Going through the series with Linux?
Mór

I downloaded it and the first release begins at around episode 150, while Handmade Penguin ends at episode 19 or 20. Penguin requires some rewriting to make it work with episode 40, which is where I'm up to.


Yes. I got an earlier version on my github account that starts from day 122. So there is still going to be a gap. In that time frame only smaller changes were required in the platform layer to keep it running on Linux as I recall it.

/Kim
75 posts
None
Going through the series with Linux?
Kim
Mór

I downloaded it and the first release begins at around episode 150, while Handmade Penguin ends at episode 19 or 20. Penguin requires some rewriting to make it work with episode 40, which is where I'm up to.


Yes. I got an earlier version on my github account that starts from day 122. So there is still going to be a gap. In that time frame only smaller changes were required in the platform layer to keep it running on Linux as I recall it.

/Kim


Thanks Kim. I was able to get it to compile using day 46 by commenting some debug code that doesn't affect anything, but unfortunately test_background.bmp displays upside down. Also the white border only displays on the left hand side and the entity doesn't respond to input.
Kim
Kim Jørgensen
64 posts
Going through the series with Linux?
Edited by Kim Jørgensen on
I remember the upside down problem and feel like we discussed it in the forum at some point. Anyway, I fixed it by advancing the pointer to the buffer and negated the pitch (see https://github.com/KimJorgensen/s...y_122/code/sdl_handmade.cpp#L1232).

If you have been following along so far you should be able to debug the two other issues yourself. Otherwise feel free to ask if there is some specific function in the win32 layer that you cannot replicate on Linux.

/Kim
75 posts
None
Going through the series with Linux?
Edited by Mór on
Kim
I remember the upside down problem and feel like we discussed it in the forum at some point. Anyway, I fixed it by advancing the pointer to the buffer and negated the pitch (see https://github.com/KimJorgensen/s...y_122/code/sdl_handmade.cpp#L1232).

If you have been following along so far you should be able to debug the two other issues yourself. Otherwise feel free to ask if there is some specific function in the win32 layer that you cannot replicate on Linux.

/Kim


Thanks again. 122 is the SDL version I am using, so that line to invert the bitmap is there. Must be something else in

handmade_hero_day_046_source/code/handmade.cpp

and

sdl_handmade-day_122/code/sdl_handmade.cpp

Edit:
I figured it out. This code makes it work. Casey must have inverted the bitmaps later in the series.


1
2
3
4
5
                  Buffer.Memory = GlobalBackbuffer.Memory;
                        Buffer.Width = GlobalBackbuffer.Width;
                        Buffer.Height = GlobalBackbuffer.Height;
                        Buffer.Pitch = GlobalBackbuffer.Pitch;
                        Buffer.BytesPerPixel = GlobalBackbuffer.BytesPerPixel;


Still not moving, but perhaps that was how Casey left that episode. He was working on multiplayer.

Edit:
I want to thank David Gow and Kim Jørgensen for doing the SDL port. Its much appreciated.