Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Advance Battle Robot (Personal Challange)

A topic by Primal created Dec 11, 2020 Views: 613 Replies: 18
Viewing posts 1 to 15
(+2)

A Simple game that is made entirely from code only. No external graphics files not external sound files. Graphics are drawn sounds are generated.

Try to find and decode the weakness on the enemy robot, then choose the correct missile to attack.

This is part of my personal challenge to create a simple game and the create variations of the game in different Programming Languages/Dialects. I am doing this out of curiosity to see what it takes to create the same thing in various languages and get the same game running on different platforms. My initial idea was always to make exactly the same game but I thought it would be more interesting if I made some changes to each version. Different enemies and advancing the plot a little bit each time.

This Version is made with Javascript+Html+Css

I chose to start with Javacript because I am very familiar with and html canvas is very easy to use together with JS . This made it easier to create what I wanted. Still I had to do some research on how to generate sound, which I had never done before.

Each version will be different and unique but will have similar gameplay.

next version I will see what c can do.

source code:https://github.com/fildubek/abr/tree/main


Deleted 3 years ago
(+1)

Thanks, yes feel free to copy it. :)

Deleted 3 years ago

nice

Kudos for making a game using code only! It's nice to make a game where you understand what every line does instead of a game engine where you are building on the shoulders of giants using prefabricated functions and features.

Regarding the game itself, I played it about 3-4 times. A few observations:

-- It's not really clear what is being looked at in the main screen. It appears to be an enlarged version of the robot face? 

-- I noticed the targeting reticle moves, but I'm still not sure how that relates to selecting the right missile. Do you have to fire certain missiles when the targeting reticle is in certain spots? 

-- I figured out that the 3 bars are the Player health, but only after several playthroughs of trial and error.

-- I was able to beat the robot once. I guess I got lucky that time!

Thanks for your comment. You bring up some valid points:

1. Yes it enlarged robot face. It supposed to be a zoomed in view of the enemy robot. Basically this is done so I do not have to draw the whole robot.

2. The target is only for decoration. You cannot move it. Basically what you have to do is look on the enemy robot for a symbol/s it can small or big. This symbol/s represents a number. For example it could be an X for the Latin numeral 10, in that case the correct answer would be missile 10 or could be something else like Morse code.  It needs a bit of thinking to find the correct solution.

3. I need to make changes so that it is clearer that the bars are health.

I made a small update.

-Added text description "Energy" above the 3 bars on the right. So that it is clear, that those are energy bars.
-Add text description under enemy robot head "Target on enemy. Zoom factor 10x"

Added in the game description, a link to a hint page. For those who have difficulty figuring out what to do.

https://github.com/fildubek/abr/wiki/Hints

Small update just to fix typos.

A screenshot of the game in the programming language C. Still Work in Progress

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.

(1 edit) (+1)

After the not so smooth process of coding the game in C. In the Python version everything went very smoothly.
I used the PyGame libraries for everything, to draw the lines, write text using fonts, no problem at all with the fonts here in contrast with C and SDL, so this time the game is again played only with the keyboard like the web version and not with menus and the mouse like the c version.

I did not draw a target on the enemy this time because it was distracting only.

I used cxfreeze to build binaries for Windows and Linux so you simply download the and play. I might add a raspberry pi version in the following days. The hint page has been updated for this version of the game.

Next version it is back to the basics with qbasic and qb64

It's interesting to see you make the same game in different programming languages. That's a very good exercise and I imagine you've learned a lot by doing that. Excited to hear that you're even going to try a Qbasic/QB64 version of it!

(+1)

Definitely have learned a lot from this and interesting seeing the ways different languages handle everything. The Qbasic/QB64 version in coming along time nicely but it still need some time until it is completed.

I compiled part 3 of advance battle robot python using cx-freeze and created a raspberry pi executable. Itch.io is not letting me add more executable files to the project so I will add link here. I have also added it to the game description.

(1 edit) (+1)

Another version is done! :) This time advance battle robot is written in Qbasic. I used the modern QB64 compiler to write this version. QB64 is a open source compiler for Window, Linux and Mac Os X and it is something like 99% compatible with original Qbasic. I also used Dosbox to run the original Qbasic and check if my code is compatible.      Writing the game in Qbasic was rather easy, since qbasic contained all the functionality i needed to create the game, such as support for drawing the lines and and generating sounds. The only inconstancy I faced between QB64 and Qbasic was the Paint command that is used to fill and specif area of the screen with a color. In QB64 the command used 3 parameters and a fourth optional one, but in Qbasic it needed all 4 parameters to run.       After finishing the game I used QB64 to create executable files for Linux and Windows. Then I thought it would be fun to create an executable file for Dos. Since Qbasic can not compile the code, only run it. I used Quick basic in dosbox to compile the code for dos, it should also run under OS/2 according to Quick Basic but I have not tested it.         Finally I noticed that there is a mac version of quick basic that runs on Mac Os 4 to 7, so I downloaded an Mac emulator and managed after a while to get quick basic running on it. Unfortunately the were compatibility issues and some of the commands were not recognized from the Mac quick basic and I was unable to compile the game.

Gameplay wise everything works with the keyboard like all previous version except the C version. This time there only 1 enemy boss robot that changes it weakness after every hit instead of 3 robots.

Next time a return to C but this time with 2 lovely pluses in C++

So here a link for google drive with all the compiled files Linux, Windows and Dos.

https://drive.google.com/drive/folders/1vkmuu4hPc9V64KXKtPc3Cw0M8AELCGNg?usp=sha...



Awesome to see the QB64 version! I found combat much more intuitive this time around and actually beat the game:

Are you on the QB64 forums? You can talk about/promote your QB64 game at this link.

(1 edit)

Thanks :). I made some small changes to the battle since people had trouble figuring it out. Though I have a hint and solution wiki page for each game. No I am not QB forums but I will check them out.

https://github.com/fildubek/abr/wiki/Hints

Still working on c++ version, I am trying to learn to use the SFML graphics library but I find how everything strange and confusing so it will more time until this is finished.

It has been a while since I wrote an update. I am still working on the c++ version slowly because I am busy with other stuff but I am getting closer finishing the game. This version we be the first to have color instead of being black and white.