Author Topic: FreeBASIC  (Read 5559 times)

Tomaaz

  • Guest
FreeBASIC
« on: November 21, 2012, 12:30:23 AM »
It looks like FreeBASIC is still being used for making games. There is almost 20 games made in it in 2012 at FreeBASIC Games Directory (203 in total).

Many people complain about its slow development and lack of support for 64bit systems, but it's still a pretty good compiler IMHO. Any FreeBASIC programmers here?

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: FreeBASIC
« Reply #1 on: November 21, 2012, 10:52:22 AM »
Since I am using Freepascal I do not use FreeBASIC anymore.

Bereb

  • Guest
Re: FreeBASIC
« Reply #2 on: November 21, 2012, 03:24:05 PM »
Just one script that I found in my archives ( sorry, it's not a game  :-[ ).
I have also  an EGSL version of it, just a little slower, but not very much. May I post this one here to compare ?

2D Equation (FreeBasic) : move the mouse over the screen
Code: [Select]
'======================================
' Equation 2D
' FreeBASIC 0.23.0
' Septembre 2011 - B.Carette
' inspiré de 'Processing'
'======================================

Const LARG = 200
Const HAUT = 200
Const W = 16
Const H = 16
Const DX = W / LARG
Const DY = H / HAUT

Dim As String k
Dim As Integer mx, my
Dim As Single v, x, y, n
Dim As Integer i, j, p, coul

Dim Shared As Integer pix(LARG*HAUT+LARG, 2)
For i = 0 To LARG
For j = 0 To HAUT
p = i + j * LARG
pix(p, 0) = i
pix(p, 1) = j
Next
Next


ScreenRes LARG, HAUT, 32, 2, &h04
ScreenSet 1, 0

WindowTitle "Equation 2D"

Do
GetMouse(mx,my)
n = (mx + 1)  * 10 / LARG
x = -W / 2
For j = 0 To HAUT
y = -H / 2
For i = 0 To LARG
v = Sin(n * Cos(Sqr((x * x) + (y * y))) + 5 * ATan2(y, x))
coul = RGB((v + 1) * 127, (v + 1) * 127, (v + 1) * 127)
p = i + j * LARG
PSet (pix(p, 0), pix(p, 1)), coul
y += DY
Next
x += DX
Next
ScreenCopy
k = Inkey
Loop Until k = Chr(27) Or k = Chr(255, 107)

End
« Last Edit: November 21, 2012, 03:31:54 PM by Bereb »

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: FreeBASIC
« Reply #3 on: November 21, 2012, 03:31:07 PM »
Yes, we want to see the EGSL script.  :)

Bereb

  • Guest
Re: FreeBASIC
« Reply #4 on: November 21, 2012, 03:38:56 PM »
2D Equation (EGSL) : move the mouse over the screen
Code: [Select]
openwindow(200,200,32,"2D Equation")

-- constantes
local sqrt, atan2 = math.sqrt, math.atan2
local width, height = screenwidth(), screenheight()
local w, h = 16, 16
local dx, dy = w / width, h / height

-- variables
local px, py = {}, {}
local p, n, x, y, c
local mx, key

-- tables
for i = 0, width do
for j = 0, height do
p = i + j * width
px[p] = i
py[p] = j
end
end

repeat
key = getkey()
mx = mousex()
n = (mx + 1)  * 10 / width
x = -w / 2
for j = 0, width do
y = -h / 2
for i= 0, height do
c = (sin(n * cos(sqrt((x*x) + (y*y))) + 5 * atan2(x,y)) +1) * 128
p = i + j * width
-- tracer les points --
color(c,c,c)
dot(px[p], py[p])
-----------------------
y = y + dy
end
x = x + dx
end
redraw()
until key == 27

closewindow()

N.B.: Personaly, I prefer EGSL because of the Lua syntax, the optional declaration of variables and because it is 'interpreted', so developing code is simpler. The results as regards  speed are better in FreeBasic (a compiled language), but graphic commands are easier and more complete in EGSL (e.g. there is no anti-aliasing in FB, among other things). However FB has some other features, which are missing in EGSL (e.g. creating dynamic libraries, .dll or .so files, etc.), but I have never used them and don't need them for my personal purposes.
« Last Edit: November 21, 2012, 05:38:14 PM by Bereb »

igamealot

  • Guest
Re: FreeBASIC
« Reply #5 on: January 19, 2013, 10:38:26 AM »
It looks like FreeBASIC is still being used for making games. There is almost 20 games made in it in 2012 at FreeBASIC Games Directory (203 in total).

I downloaded a ton of Freebasic stuff the other day had no idea it did all that.

That is a great resource of games to work from. The BASIC code is right there, like a psuedo code outline for converting
to Lua, Python, Javascript, or C. All the sprites and sounds are there.

They ultimately contain the principles of game design in not too user unfriendly terms if they are in your own language.

I Just read a 1945 clone that was in Polish.
Code: [Select]
Dim Shared As UByte Pierwszy_morski_last, Pierwszy_pocisk_last, Pierwszy_powietrzny_last, Pierwszy_specjalny_last, Pierwszy_wybuch_last


« Last Edit: January 19, 2013, 10:40:14 AM by igamealot »