QB64.org Forum

Active Forums => Programs => Topic started by: SirCrow on February 07, 2019, 02:11:04 pm

Title: StarBlast Game - Latest Version (Feb. 2019)
Post by: SirCrow on February 07, 2019, 02:11:04 pm
At last, I've uploaded the latest version of my Asteroids-inspired space-adventure game!
Most notably, this version boasts the new LASER CANNON weapons.  I think they're a lot of fun and a nice addition to the old Plasma Balls.

Please check it out here:  https://www.qb64.org/forum/index.php?topic=576.msg4272#msg4272
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: bplus on February 07, 2019, 04:55:03 pm
Hi SirCrow,

I am getting an error from get go (see attached), beautiful graphics!

The line is 2127 actually, I moved MouseHide down and commented out FullScreen to get snapshot.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: STxAxTIC on February 07, 2019, 05:14:45 pm
I got an error over not having a font, I think near that same line. Removed the line, and everything ran fine afterward.

Say, SirCrow, do you want this thing moved into Samples, or are you wanting to wait for any reason? (i.e. is this close to done?)

It's great and smooth playing experience - the backgrounds and shadows add to the sense of flying quickly.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: SirCrow on February 07, 2019, 06:41:57 pm
I got an error over not having a font, I think near that same line. Removed the line, and everything ran fine afterward.
Say, SirCrow, do you want this thing moved into Samples, or are you wanting to wait for any reason? (i.e. is this close to done?)
It's great and smooth playing experience - the backgrounds and shadows add to the sense of flying quickly.

Thank you.  I'm glad you could correct the error. 

I thought this belonged under Programs, but if you think it should be moved, that's fine.  It's been "done" for a while now,  and I just keep adding new features and stuff.  Not exactly perfect, but pretty much finished.

By the way, are you running the EXE or do you have Linux?
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: SirCrow on February 07, 2019, 07:21:44 pm
Hi SirCrow,

I am getting an error from get go (see attached), beautiful graphics!

The line is 2127 actually, I moved MouseHide down and commented out FullScreen to get snapshot.

Thank you! 

So far, I have not been able to reproduce the error on my Ubuntu system.  I don't know where in my code it would happen, but it doesn't appear to be anywhere near line 2127, so that isn't much of a clue, unfortunately.  If it keeps happening, I hope someone will be able to pinpoint it eventually.

Are you running it under Windows?  I wonder if it's only the .exe that has the problem.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: bplus on February 07, 2019, 09:06:28 pm
Yes, I am running under Windows and used the source to compile an exe. As STxAxTIC said, it's probably a file not loading. I will dig a little.

Code: QB64: [Select]
  1.             '_FONT FMsg&: COLOR _RGB(111, 111, 111): _PRINTSTRING (125, 664), "w": _PRINTSTRING (1129, 664), "s"
  2.  
  3.  
This commented out and it runs.

I don't Windows folks have this path or file.
     
Code: QB64: [Select]
  1. FMsg& = _LOADFONT("/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf", 24) 'Smaller font for special MESSAGES
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: STxAxTIC on February 07, 2019, 09:25:47 pm
Hello SirCrow,

Yup, bplus identified the proper line. (Was using Windows for that test.)

And to clear up my poor choice of wording, I meant to ask if we should *copy* this to Samples (a highly curated section), not move it. This will immortalize your project - the Librarian will get to it soon.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: SirCrow on February 08, 2019, 06:49:20 pm
Hello SirCrow,

Yup, bplus identified the proper line. (Was using Windows for that test.)

And to clear up my poor choice of wording, I meant to ask if we should *copy* this to Samples (a highly curated section), not move it. This will immortalize your project - the Librarian will get to it soon.

Excellent!  I love that idea, although there's this font issue now.  I think I could use some help with making this thing work with both Windows and Linux.
Can someone tell me whether, after commenting out the problematic FONT line, you can still see the message text on-screen?  Most likely in _FONT 14, and not looking so great.  I've already taken some precautions for this possible error, but I don't know if it always does the trick.  Thanks.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: SirCrow on February 08, 2019, 06:58:15 pm
Yes, I am running under Windows and used the source to compile an exe. As STxAxTIC said, it's probably a file not loading. I will dig a little.

Code: QB64: [Select]
  1.             '_FONT FMsg&: COLOR _RGB(111, 111, 111): _PRINTSTRING (125, 664), "w": _PRINTSTRING (1129, 664), "s"
  2.  
  3.  
This commented out and it runs.

I don't Windows folks have this path or file.
     
Code: QB64: [Select]
  1. FMsg& = _LOADFONT("/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf", 24) 'Smaller font for special MESSAGES

Of course, it makes perfect sense now.  I'm using Ubuntu fonts, while Windows users will be using those ones.
Now, how do I have the prog. check for the presence of my chosen font, and then use an alternative if need be?

I wonder why this line wouldn't cause an error in Windows:
FMsg& = _LOADFONT("/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf", 24)
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: bplus on February 08, 2019, 06:59:57 pm
Hello SirCrow,

Yup, bplus identified the proper line. (Was using Windows for that test.)

And to clear up my poor choice of wording, I meant to ask if we should *copy* this to Samples (a highly curated section), not move it. This will immortalize your project - the Librarian will get to it soon.

Excellent!  I love that idea, although there's this font issue now.  I think I could use some help with making this thing work with both Windows and Linux.
Can someone tell me whether, after commenting out the problematic FONT line, you can still see the message text on-screen?  Most likely in _FONT 14, and not looking so great.  I've already taken some precautions for this possible error, but I don't know if it always does the trick.  Thanks.

I have not put your code through trials of tests (too many instructions for me) but when the line is commented out the program runs fine.

All that font does is print a tiny w or s, weapons or shields. The fix is simple, add the font file to the package and repath the load of it the same as all other files in package.

Quote
I wonder why this line wouldn't cause an error in Windows:
FMsg& = _LOADFONT("/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf", 24)

I am not sure you are checking FMsg& correctly after load.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: FellippeHeitor on February 08, 2019, 07:00:39 pm
Quote
I wonder why this line wouldn't cause an error in Windows:
FMsg& = _LOADFONT("/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf", 24)
It's always good practice to check your handles. It doesn't generate an error because a failed _LOADFONT simply results in a handle equal to zero (much like a failed _LOADIMAGE returns -1). You just need to check that FMsg& > 0 before calling _FONT.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: SirCrow on February 08, 2019, 08:14:09 pm
Quote
I wonder why this line wouldn't cause an error in Windows:
FMsg& = _LOADFONT("/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf", 24)
It's always good practice to check your handles. It doesn't generate an error because a failed _LOADFONT simply results in a handle equal to zero (much like a failed _LOADIMAGE returns -1). You just need to check that FMsg& > 0 before calling _FONT.

Thanks.  I checked my code and it turns out that I used
IF FMsg& > 0 THEN _FONT FMsg& ELSE _FONT 14

everywhere except the w and s location.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: SirCrow on February 08, 2019, 08:19:47 pm
...
All that font does is print a tiny w or s, weapons or shields. The fix is simple, add the font file to the package and repath the load of it the same as all other files in package.

Actually, that font is used for a lot more than that.  I wish I had caught my omission of IF FMsg& > 0 THEN... before uploading.Thanks for your attention.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: STxAxTIC on February 09, 2019, 01:36:52 am
No worries SirCrow if bugs surface after publication - get it to where you're satisfied, and then the Librarian will immortalize this project in Samples once the dust is settled.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: SirCrow on February 11, 2019, 09:48:56 pm
No worries SirCrow if bugs surface after publication - get it to where you're satisfied, and then the Librarian will immortalize this project in Samples once the dust is settled.

I think I'm satisfied with how it works on my Ubuntu system, but I can't tell how well it runs on Windows.  For instance, I don't know how to refer to alternative fonts so that the player won't have to settle for the old _FONT 14 or similar.  For example, what would be a good Windows substitute for _LOADFONT("/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf", 24) ?
When running under Windows, does the on-screen text look anything like the text in this screenshot?  I'd like to fix up this fonts issue very nicely, but I'll try not to worry too much about it and maybe just upload it as it is now.  Thanks.
Title: Re: StarBlast Game - Latest Version (Feb. 2019)
Post by: bplus on February 12, 2019, 10:18:44 am
No worries SirCrow if bugs surface after publication - get it to where you're satisfied, and then the Librarian will immortalize this project in Samples once the dust is settled.

I think I'm satisfied with how it works on my Ubuntu system, but I can't tell how well it runs on Windows.  For instance, I don't know how to refer to alternative fonts so that the player won't have to settle for the old _FONT 14 or similar.  For example, what would be a good Windows substitute for _LOADFONT("/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf", 24) ?
When running under Windows, does the on-screen text look anything like the text in this screenshot?  I'd like to fix up this fonts issue very nicely, but I'll try not to worry too much about it and maybe just upload it as it is now.  Thanks.


Quote
The fix is simple, add the font file to the package and repath the load of it the same as all other files in package.

Is there a difference in format between a font file for Windows and one for Linux?