"A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

For other topics related to the FreeBASIC project or its community.
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby Tourist Trap » Apr 06, 2019 14:44

Tourist Trap wrote:Hi all,

I'm still not sure if this will be a game, but I try at least to achieve an interface to a game. Here the menu page.
I have a problem when compiling to 64bits so I'll post the code later today in order for anyone to test it if wanted.
Image


Edit:
uploaded the stuff here.
Nb: it does nothing impressive right now, just the menu.
It doesn't compile successfully for 64bits on windows. Something due to a linkage with fbgfx. But it compiles fine for 32 bits for me.
https://github.com/trapmania
paul doe
Posts: 916
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby paul doe » Apr 06, 2019 15:06

Tourist Trap wrote:...It doesn't compile successfully for 64bits on windows. Something due to a linkage with fbgfx. But it compiles fine for 32 bits for me...

Um, this code:

Code: Select all

#if __FB_64BIT__
   extern p alias "__fb_gfx" as integer ptr
#else
   extern p alias "__fb_gfx" as long ptr
#endIf

should read:

Code: Select all

#ifdef __FB_64BIT__
   extern p alias "__fb_gfx" as integer ptr
#else
   extern p alias "__fb_gfx" as long ptr
#endIf

Then it compiles and runs perfectly fine with the latest fbc 64-bit ;)

A warning is thrown nonetheless:

Code: Select all

C:\Programming\Freebasic\FreeBASIC-1.06.0-win64\fbc -s console -gen gcc -Wc -Ofast -mt "FbTemp.bas"
compiling to .. a win32 API platform
FbTemp.bas(276) warning 25(0): Overflow in constant conversion, at parameter 3

Make done
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby Tourist Trap » Apr 06, 2019 15:13

paul doe wrote:Then it compiles and runs perfectly fine with the latest fbc 64-bit ;)

A warning is thrown nonetheless

A big thank Paul,

I'm tired so much that I wasn't able to figure out this simple change, IF / IFDEF is a classic little issue :)
For the constant overflow, that's more a issue for fbc than for me, even doing a CULNG to the value (a color) doesn't solve this. So it doesn't matter even if I wonder why this is a 64bits affair.
Thanks anyway again.

As you can see there is now some content to put inside, and that's where I'm not very confident on the result, but I'm on it!
MrSwiss
Posts: 3173
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby MrSwiss » Apr 06, 2019 15:14

Alternative method:

Code: Select all

#if defined(__FB_64BIT__)
   extern p alias "__fb_gfx" as integer ptr
#else
   extern p alias "__fb_gfx" as long ptr
#endIf
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby Tourist Trap » Apr 06, 2019 15:20

MrSwiss wrote:Alternative method:

Code: Select all

#if defined(__FB_64BIT__)
   extern p alias "__fb_gfx" as integer ptr
#else
   extern p alias "__fb_gfx" as long ptr
#endIf

Thanks MrSwiss, I never paid attention to this variation.
paul doe
Posts: 916
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby paul doe » Apr 06, 2019 16:18

Tourist Trap wrote:...
For the constant overflow, that's more a issue for fbc than for me, even doing a CULNG to the value (a color) doesn't solve this. So it doesn't matter even if I wonder why this is a 64bits affair.
...

The overflow is reported on this line (275):

Code: Select all

  /' ... '/
      THIS._img => imageCreate( Wid, Hei, (rgba(8,20,20,199) * rgba(0,0,65,205)), 32 ) ''colour
  /' ... '/

As you can see, the multiplication indeed produces an overflow. What's the intent of that code? Interpolate the colors, or just multiply them? Here's a little snippet comparing the two operations (note how you need to shr the resulting component when multiplying):

Code: Select all

type as ulong _
  RGBColor

/'
  Interpolates two RGB colors
'/
function _
  lerpRGB( _
    byval s as RGBColor, _
    byval e as RGBColor, _
    byval x as ubyte ) _
  as RGBColor
 
  dim as ubyte _
    sr => ( s shr 16 and 255 ), _
    sg => ( s shr 8 and 255 ), _
    sb => ( s and 255 ), _
    er => ( e shr 16 and 255 ), _
    eg => ( e shr 8 and 255 ), _
    eb => ( e and 255 )
 
  return( rgb( _
    ( x * ( er - sr ) ) shr 8 + sr, _
    ( x * ( eg - sg ) ) shr 8 + sg, _
    ( x * ( eb - sb ) ) shr 8 + sb ) )
end function

/'
  Multiply two RGB colors
'/
function _
  multRGB( _
    byval s as RGBColor, _
    byval d as RGBColor ) _
  as RGBColor
 
  dim as ubyte _
    sr => ( s shr 16 and 255 ), _
    sg => ( s shr 8 and 255 ), _
    sb => ( s and 255 ), _
    dr => ( d shr 16 and 255 ), _
    dg => ( d shr 8 and 255 ), _
    db => ( d and 255 )
 
  return( rgb( _
    ( sr * dr ) shr 8, _
    ( sg * dg ) shr 8, _
    ( sb * db ) shr 8 ) )
end function

dim as integer _
  scrW => 800, _
  scrH => 600

screenRes( scrW, scrH, 32 )

for _
  y as integer => 0 to scrH - 1
 
  line _
    ( 0, y ) - _
    ( scrW - 1, y ), _
    lerpRGB( _
      rgb( 255, 128, 64 ), _
      rgb( 192, 32, 255 ), _
      ( 255 / scrH ) * y )
next

sleep()

dim as RGBColor _
  aColor => rgb( 128, 255, 32 )

for _
  y as integer => 0 to scrH - 1
 
  line _
    ( 0, y ) - _
    ( scrW - 1, y ), _
    multRGB( _
      aColor, _
      point( 0, y ) )
next

'' Show the color that's being multiplied into the image
line _
  ( 0, 0 ) - _
  ( 63, 63 ), _
  aColor, bf

sleep()

Or perhaps I'm just missing your intent there ;)
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby Tourist Trap » Apr 06, 2019 16:54

paul doe wrote:...
Or perhaps I'm just missing your intent there ;)

Hi Paul,

Thanks for the snippet, I will study it carefully.

However, about my intent, it's not starighforward. You see, I try to find color themes as part of the design, and in general I just can't solve this in a staightforward way. I could try to add colors with the "+" but I noticed that this rarely help me a lot. That's why I shifted for an exploratory method, where I build colors based on some heuristic method using many different operators on rgb values. For some unknown reason, as an exploratory method, it proved more satisfactory. So to answer you, the reason of those strange color compositions here and there in the code, is just my way of doing color theme search. Of course, out of a development phase, this all should take a most compact form.

paul doe wrote:As you can see, the multiplication indeed produces an overflow.

Yes, only on FB64 however. And doing for instance CULNG(rgb1 * rgb2) doesn't solve the issue. Still weird I think.

Edit:
please anyone, test fbglMain_b2.bas at https://github.com/trapmania/Fbgenlab/t ... r/fbgenlab.
One can enter the genlab now. No game yet, but the feel and taste is here. To exit the game, the red circle on topbar should work. Thanks all.
dafhi
Posts: 1240
Joined: Jun 04, 2005 9:51

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby dafhi » Apr 06, 2019 17:32

@paul doe

dafhi wrote:.. The pure math of SVG has my head spinning.

actually, the simple act of concentration gets my head spinning.

i'm fine; just need to work through some financial and head-space issues
paul doe
Posts: 916
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby paul doe » Apr 06, 2019 22:16

dafhi wrote:...
i'm fine; just need to work through some financial and head-space issues

And who doesn't? ;)
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby Tourist Trap » Apr 07, 2019 11:48

Hi Lachie, and all,

I think I wont make it. I did as best as it was possible.

Main adverse conditions I met were a job I took in january where I was given a very bad office configuration. For instance, 2 different screens, 2 different sizes, and even 2 different frequencies (80 and 60 hz), and the darkest corner of the room to settle down. It really hurt the eyes after a while, so for the least then you just can't be as efficient as you should after work. Always use 2 identical screens if you want to keep safe from this point of view. Furthermore, since wednesday I'm encountering a electrical failure at home so I have to find electrical power out to use my computer. It was the "coup de grace" as we say in french.

However, I've learnt a lot on how to manage such a project for a next time. Making a game is not like doing a simple code snippet, or optimizing a single algorithm in isolation. That's a whole project. And from now and then, I think I will never say again that it's easy to make a game :)

My last submition is fbglMain_b3.bas at my repo. It goes in the right direction but there is still too much work left. As you must understand, I have other stuff pending at home, like dealing with my fridge where the food is now lost and begins not being very attractive for sensitive noses.

I won't get back to any fb project before I take another job next month, and even then, not after settling down because it will be at 500km+ of my present location. In an ideal life, I would do fb first and the rest after, but in this life I have to do the contrary and it's a pitty!

Thanks all, thanks Lachie. I wish good luck to the still alive competitors!
badidea
Posts: 1411
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby badidea » Apr 07, 2019 21:14

An hour ago, I had a working game. Then I decided to change some things... State machine chaos. I still have a few hours right?

Edit: I wanted to add more animations and other stuff, but time is up.
Have fun: Game download [zip-file, 5MB]

Forgot to reset the high scores. Too bad.
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby Lachie Dazdarian » Apr 07, 2019 23:05

I'm extending the deadline one last time until 22nd of April.
paul doe
Posts: 916
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby paul doe » Apr 07, 2019 23:42

Lachie Dazdarian wrote:I'm extending the deadline one last time until 22nd of April.

Oh! That's great! Much appreciated. I might be able to pull off something by that date. It won't be the pinball I promised (that will have to wait a little), but I have other ideas too ;)
paul doe
Posts: 916
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby paul doe » Apr 08, 2019 4:01

Tourist Trap wrote:...
However, about my intent, it's not starighforward. You see, I try to find color themes as part of the design, and in general I just can't solve this in a staightforward way. I could try to add colors with the "+" but I noticed that this rarely help me a lot. That's why I shifted for an exploratory method, where I build colors based on some heuristic method using many different operators on rgb values. For some unknown reason, as an exploratory method, it proved more satisfactory. So to answer you, the reason of those strange color compositions here and there in the code, is just my way of doing color theme search. Of course, out of a development phase, this all should take a most compact form.
...

Ah, I see. You may want to try the HCY color space. It's really cool, intuitive (it orders colors by perceived luminosity) and especially suitable for what you want to do. You can download an implementation to play with from my repository. The example-3.bas contains a simple example of what you can achieve with it:
Image
The entire 'UI' theme is derived from one color chosen at random; the rest are derived from there by modulating its saturation and luminance. The nice property of this color space is that you can ensure some elements (for example, the all-important text) will be always legible against the background simply by checking the luminance of the back color (look at the demo to see how this works). The other examples simply show how to use the little framework.

Have loads of fun ;)
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: "A Love Letter To FreeBASIC" Game Dev Competition (Feb 2019 –Mar 2019) - Round 2

Postby Tourist Trap » Apr 08, 2019 17:33

Lachie Dazdarian wrote:I'm extending the deadline one last time until 22nd of April.

I guess you rarely met so much late on project delivery! Thanks for the patience ;)

paul doe wrote:Ah, I see. You may want to try the HCY color space. It's really cool, intuitive (it orders colors by perceived luminosity) and especially suitable for what you want to do. You can download an implementation to play with from my repository. The example-3.bas contains a simple example of what you can achieve with it:
Image
The entire 'UI' theme is derived from one color chosen at random; the rest are derived from there by modulating its saturation and luminance. The nice property of this color space is that you can ensure some elements (for example, the all-important text) will be always legible against the background simply by checking the luminance of the back color (look at the demo to see how this works). The other examples simply show how to use the little framework.

Have loads of fun ;)

Thanks it seems very interesting. I will have a look at this good stuff. Not sure however I will be able to apply it on the fly for this time, I already took some habits in the present context. But I'm here to improve!

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 21 guests