GLBasic forum

Main forum => Announcements => Topic started by: GarBenjamin on 2015-Aug-30

Title: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: GarBenjamin on 2015-Aug-30
Hey there GLBasic Community!

Some of you know I have been working on NOTE: I UPDATED THIS POST TO REMOVE THE LINK BECAUSE I HAVEN'T HAD MY OLD WEBSITE FOR SEVERAL YEARS NOW.

Mars Explorer is inspired by the old Moon Patrol. This game has only 2 stages in it because it was created just to (a) test GLBasic for 2D game development and (b) create a simple game project I can use to test Unity, Monkey X and HaxeFlixel.

There is a Windows executable version available for download.

Also, the full project source code is available for download.

If you are interested you can get them from my NOTE: I UPDATED THIS POST TO REMOVE THE LINK BECAUSE I HAVEN'T HAD MY OLD WEBSITE FOR SEVERAL YEARS NOW.

Hope someone enjoys this little game or at least finds the code useful!

Now, I am going to take a break for a day or two and start on the MX, HF and U implementations.

Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: GarBenjamin on 2015-Aug-30
I just spent 2 minutes making a couple tiny updates to the StatusBarControl and PlayfieldManager classes.

Geesh. I thought hey why not finally play this game and see how it is. And noticed when I did my code clean up I introduced a bug with the rocks not resetting!

And I noticed a compiler warning about creating a public variable because I left a "self." off the front a variable name.

Sorry about that.

If you pull the source down again these issues will be resolved. Also earlier I updated the download page to have the controls for the game.

Decelerate (brake) — Left Arrow or A
Accelerate —————- Right Arrow or D
Jump ———————— Up Arrow, X or Right Shift
Fire ————————— C, Space or Enter (Return)
Pause/Resume ——— P

Alright, now I am going to blast some aliens, jump over holes and rocks and maybe blast a few of them too. lol

Then probably go play some retro games and forget about programming for a bit.
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: Hemlos on 2015-Aug-30
Thanks!  :booze:

If you dont mind; fix the error, and put it in our showroom too since its open source?
Thatll give you a second copy on the web for backup :)

Did you use this game for any competitions? How did that go for ya?
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: GarBenjamin on 2015-Aug-30
Quote from: Hemlos on 2015-Aug-30
Thanks!  :booze:

If you dont mind; fix the error, and put it in our showroom too since its open source?
Thatll give you a second copy on the web for backup :)

Did you use this game for any competitions? How did that go for ya?


Okay, it is done: http://www.glbasic.com/showroom.php?lang=en&game=marsexplorer

I also went ahead and updated the Title screen real quick to include the controls.

(http://www.glbasic.com/data/games/marsexplorerimg.jpg)
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: spacefractal on 2015-Aug-30
I'm gonna thinks since this game is open source, would it OK for you to let me showcase how the GameInput api work for supporting game controllers?

This might require a change on the title screen (using the same font) because it's can been varied from platform to platform.

I'm will not touch anything other at all, nor impleneted touchscreen controls at all.
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: GarBenjamin on 2015-Aug-30
Sure you can add or modify it for whatever you want. I'd appreciate it if you left my name on it and certainly feel free to update the Title screen with your name (or spacefractal) crediting you for adding GameInput API support.

However, please grab the source from my website first because I fixed another tiny bug right after I submitted it to the Showcase.

I think this should be the last little issue. When I overhauled that Main method earlier today I should have play-tested it more but was in a rush to wrap it up. ;)

Anyway, the latest source is on the NOTE: I UPDATED THIS POST TO REMOVE THE LINK BECAUSE I HAVEN'T HAD MY OLD WEBSITE FOR SEVERAL YEARS NOW.

But yeah go ahead. In fact, anyone can feel free to update it to add a high score screen or whatever anyone wants to add. It's basically just an example game project. Kind of a template or starter kit for making a side scrolling arcade game. I needed something for my experiment and thought it might be helpful for new people interested in learning GLBasic.
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: GarBenjamin on 2015-Aug-30
Quote from: Hemlos on 2015-Aug-30Did you use this game for any competitions? How did that go for ya?

No I did not enter it into any competitions. Just made it for my experiment and figured it might be helpful for others to see how I program video games.
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: spacefractal on 2015-Aug-30
with GameInput. The input can been changed and remapped, depend on control and on platform. The only issue is, the main title with its controls seens to been drawed on, instead using PRINT to print it on the screen.

Except that, im wont change anything, nor credits me etc at all (which is allready done in the source code). So no reason im get a credits for that.

Im also keep the controls on the Windows, and also add P key for pause, which is normally is mapped to Escape when using Windows. This was that its mapped with the pause function with GameInput (KEY(1)).

PS. Which size and font did you used for that screen?
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: GarBenjamin on 2015-Aug-30
I used a few different but very close fonts. The controls text is simply Courier New so that should work fine for you. I think I used font size 8 or 9 or maybe 10. The important thing is after making the text I then doubled the size of the image containing the text because everything needs to be in double size 2x2 pixels for the retro look and I prefer to just prerender / process it instead of making the computer scale it.
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: spacefractal on 2015-Aug-30
This is a excellent game to show off how GameInput Api works, and the source code is well made. Well done.

Here is the GameInput Api of the game. Im could not preserve all Windows controls, even they was quite well choiced. Im only changed few input to suit the defaults in GameInput:
https://www.dropbox.com/s/o71zrbw1mwb3rof/Mars%20Explorer%20GLBasic%20Source.zip?dl=0

Im discovered a another issue missing in the game, which is really very important:
You need to do a frameskip measure or using delta timing in your game. For this game, the game simply just slowdown, when framerate fall to 30fps. This can been happpens.

For this one, im would just uses a function something like this:

Code (glbasic) Select

FUNCTION  update_Delay: displayUpdateFreq=60
LOCAL a=0
STATIC reset=1
STATIC lasttimer=0
IF reset=1
reset=0
lasttimer=GETTIMERALL()
ENDIF
LOCAL update=1000/displayUpdateFreq
LOCAL mstimerticks=(GETTIMERALL()-lasttimer)
lasttimer=GETTIMERALL()
LOCAL updatedelay=mstimerticks/update
IF GameFade<1 THEN RETURN displayUpdateFreq/displayUpdateFreq
RETURN updatedelay
ENDFUNCTION


And then update the main physics more than once if required to keep the same speed, even the framerate fall. This is the easist method (im did this in Greedy Mouse, but used delta method in other games). The first UpdateTicks can been sometimes quite high, so do a limit, mightbeen max 5 frameskips or such.

PS. Im have moved the eailer version of this game in the Beta forum. But not moving this one.
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: GarBenjamin on 2015-Aug-30
Absolutely.  I use a framerate-independent system in all of my actual games.

Remember this is not an actual game. It's just something I knocked out because I needed "enough of a game" to use as a test case for my development speed experiment.

Heck there is a lot of stuff that can be added to this!

It'd be easy to add different behavior for the different aliens.
New stages in Tiled so it has maybe 5 to 6 stages instead of only two.
A high score screen.
Music on the title screen.
A victory celebration for winning the game.... fireworks or whatever. The particle system is already in there.

Lots of stuff. In many ways a game project is never done.

In this case this is not even intended to be a complete game.
However, it is reasonably close and is definitely enough for me to use as a test case to measure the development speed of GLBasic, HaxeFlixel, Monkey X and Unity.

I also think it should provide a solid framework people can use and add on.

I'm thinking if a new person comes over to GLBasic they might play around with the program adding the framerate-independent code and maybe many other things. :)



Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: Hemlos on 2015-Aug-30
So whats your next platform for this project?
Are you going to keep tabs on all the progress, on your webpage?
Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: GarBenjamin on 2015-Aug-30
@spacefractal:

I'll check out your updates as soon as I am on the computer again.

Looking forward to seeing the updates for your GameInput API!


@Hemlos:

Now that I am done with my GLBasic project I will be doing the Unity, Monkey X and HaxeFlixel versions of the game.
All three will be developed at the same time. Basically the way I described on my site.

I will do the first piece in Monkey X first then in HaxeFlixel then in Unity (of course timing how long it takes in each).
Then I will do the next piece in HaxeFlixel first then in Unity then in Monkey X.
Then I will do the next piece in Unity first then in Monkey X then HaxeFlixel.

The reason for that is so it is a fair comparison and neither has any advantage.

Absolutely there will be a dev log page for the experiment and instead of videos these will have web games.

At the end of the experiment I will set up HaxeFlixel and Monkey X Source download pages the same as I did for GLBasic.

I might start on this next phase of my project tonight.

Title: Re: Mars Explorer Windows Binary and FULL SOURCE CODE Released!
Post by: spacefractal on 2015-Aug-30
Im just did a simple implemented this time, not even Used the font for the title screen for retriving Button named.

Correctly im Waiting for my Google Nexus Player (Android tv), which my game constantly Got rejected due controls not working. Not sure why, yet. When Got working, its been part of GameInput.