Part 2 the C version is Realeased
Finally Part 2 of challenge is done and the C version is released. At the moment there is only Linux binary available for download, it requires Simple DirectMedia Layer to be installed on the System. This version is quite different, using mouse driven menus instead of keyboard.
Analysis
So this was a lot more difficult than I thought. The first Problem that I faced was which library should I use to draw the graphics. Most online tutorials recommended to use the graphics.h library, since it is easy to use. The problem was I wanted the code to run both on Linux and windows but unfortunately even though there some Linux implementations of the library, I could not get them to worked at all, with exception of one worked but it kept crashing after a few seconds with a long list of errors. After several hours trying to debug it I gave up.
Next try was the Allegro Library. This looked very promising and was cross platform but I had problems getting to display text with fonts properly, so eventually I gave up on that also.
Then I remembered SDL so I switched to that, SDL is also a cross platform library. So I started to working with that on my Linux system which is my main system. I managed draw the graphics easily with SDL. But when I tried to display text, again it did not work properly, not sure this kept happening bot with Allegro and SDL. This time though instead of trying out something different again, I came up with a work around, so instead of text directly on the window, I used menus to display the text info and instructions. The resulted a big change in the gameplay of the game and instead being a game that is using the keyboard for commands, it now uses mouse controlled menus for everything.
Next was the sound, I found on stackoverflow a good example on how to generated sound with SDL, so I did not need to find another Library for sound generation. I adapted the code I found for game and soon afterwards I had a fully working version of the game I had initially written in Javascript, now in running in C.
Then it was time to compile it for windows, since I used cross platform libraries, I did not think I would face any difficulties. I was wrong, when I tried to compile the code, there were several errors. All errors were related to the sound generation code I took from stackoverflow. So took another close look at it and found that I previously had not noticed that it had some C++ code it that was not compatible with C.
No idea why I had not issue compiling it on Linux. Anyway after a while I figured out how to modify the code to work with a C compiler. Now the these error where gone on windows but new errors came up. Even though the compiler could find the SDL library, it could still not use it for some reason.
At that moment I temporary gave up on releasing it on Windows. Instead decided to release the Linux binary and the source code and take another look at the windows problem another time. This is why at the moment there is only a Linux binary available.
Next version part 3 we will see if Python can bite.
Files
Get Advance Battle Robot (Personal Challange)
Advance Battle Robot (Personal Challange)
Simple game made with code only.
More posts
- C++ version releaseJul 18, 2021
- small progress updateMay 15, 2021
- Abr Qbasic/QB64 VersionFeb 27, 2021
- Part 3 the Python version Raspberry PiFeb 13, 2021
- Part 3 the Python version is RealeasedFeb 06, 2021
- Typos fixDec 19, 2020
- Hint PageDec 17, 2020
- Web vesrion 1.2Dec 15, 2020
- First vesionDec 11, 2020
Leave a comment
Log in with itch.io to leave a comment.