Presentation and questions about freebasic

New to FreeBASIC? Post your questions here.
marcov
Posts: 3126
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Presentation and questions about freebasic

Postby marcov » Apr 16, 2021 9:19

caseih wrote:
zelda64bit wrote:I would like to do these kinds of games.
https://www.youtube.com/watch?v=28D6j4vtKiM

I also wanted to comment that my computer is old and does not support opengl, only directx and software.

For computers without a GPU-supplied OpenGL dll, MS has always shipped opendl32.dll which implements OpenGL 2 on any computer. It's been around since before Windows XP. Hence OpenGL 2 can work on any Windows computer regardless of hardware age.


My first opengl card (monster 3D) was at first even dos only.

You can check your opengl capabilities with programs like gpu-z or, the best, opengl extensions viewer (http://www.realtech-vr.com/home/glview)
Last edited by marcov on Apr 16, 2021 13:13, edited 2 times in total.
dodicat
Posts: 6914
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Presentation and questions about freebasic

Postby dodicat » Apr 16, 2021 9:25

Very unusual not to have opengl, even with an intel onboard card.
I have an older machine also, although with a faster processor:
Operating System: Windows 10 Pro 64-bit (10.0, Build 19042) (19041.vb_release.191206-1406)
Language: English (Regional Setting: English)
System Manufacturer: Hewlett-Packard
System Model: HP Compaq 8200 Elite SFF PC
BIOS: Default System BIOS (type: BIOS)
Processor: Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz (4 CPUs), ~3.0GHz
Memory: 8192MB RAM
...
...
Here is the start of my test.

Code: Select all

Card: Intel(R) HD Graphics 2000
Manufacturer Intel
OpenGL Version 3.1.0 - Build 9.17.10.4459
FreebASIC Driver = OpenGL

EXTENSIONS:

 1            GL_EXT_blend_minmax
 2            GL_EXT_blend_subtract
 3            GL_EXT_blend_color
 4            GL_EXT_abgr
 5            GL_EXT_texture3D
 6            GL_EXT_clip_volume_hint
 7            GL_EXT_compiled_vertex_array
 8            GL_SGIS_texture_edge_clamp
 9            GL_SGIS_generate_mipmap
 10           GL_EXT_draw_range_elements
 11           GL_SGIS_texture_lod
 12           GL_EXT_rescale_normal
 13           GL_EXT_packed_pixels
. . .
. . .
up to 115
 

Here is the test code:

Code: Select all

 

#include "gl/glu.bi"
     
Screenres 50,50,32,,2
dim as string driver
screeninfo ,,,,,,driver

dim as string s,tmp
s+= "Card: "+*glGetString(GL_RENDERER)+chr(10)
s+= "Manufacturer "+*glGetString(GL_VENDOR)+chr(10)
s+= "OpenGL Version "+*glGetString(GL_VERSION)+chr(10)
s+= "FreebASIC Driver = " +driver+chr(10)
s+= " " +chr(10)
s+= "EXTENSIONS:"+chr(10)


tmp=*glGetString(GL_EXTENSIONS)
tmp=trim(tmp)+" "
screen 0
width , 500
print s
dim as long i,ctr
do
    ctr+=1
    i=instr(tmp," ")
    if i=len(tmp) then print ctr, mid(tmp,1,i): exit do
    print ctr, mid(tmp,1,i)
    tmp=mid(tmp,i+1)
loop until i=0
print
print "Press a key to end"
sleep
   

   

My previous machine only had opengl 2, and it was an old Del which eventually threw in it's handl
paul doe
Moderator
Posts: 1402
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Presentation and questions about freebasic

Postby paul doe » Apr 16, 2021 9:51

zelda64bit wrote:...
Finally I would like to say that right now I am a little lost and I don't know where to start to learn freebasic, if you can help me start learning freebasic I would appreciate it and I would also like you to recommend me a video game engine that is easy to use so that learning with freebasic is more fun. Besides that what I would like is to program 2d planes games with freebasic.
...

Welcome. Unfortunately, FreeBasic has a lack of really usable game engines, so you'll have to roll your own. Not necessarily a bad thing, since for learning purposes it's pretty useful.

Have a look at this:

https://github.com/glasyalabolas/fb-asteroids

A while ago, I coded a minimal example of a STG (albeit in an 'Asteroids' style) for reference. You might find it useful as it contains many of the basics you'll need to code such a game.
BasicCoder2
Posts: 3713
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Presentation and questions about freebasic

Postby BasicCoder2 » Apr 16, 2021 11:30

@zelda64bit
I haven't tried the freebasic graphical commands yet, so I was wondering if there was a tutorial to get started.


So what level of programming competence do you have so far?

Have you downloaded and chosen an editor to write your FreeBASIC program with?

Can you compile and run this program ok? You can move the red circle around with the arrow keys.

Code: Select all

ScreenRes 640, 480, 32  'creates a 640x480 window with 32 bit color pixels

dim as integer x   'position to draw circle in window
dim as integer y

x = 320  'start position in center of window
y = 240

Do
    ' Check arrow keys and update the (x, y) position accordingly
    If MultiKey(&H4B) And x >   0 Then x = x - 1   'move circle left
    If MultiKey(&H4D) And x < 639 Then x = x + 1   'move circle right
    If MultiKey(&H48) And y >   0 Then y = y - 1   'move circle up screen by one pixel
    If MultiKey(&H50) And y < 479 Then y = y + 1   'move circle down screen by one pixel
   
    screenlock 
        'clear the window
        cls
        'draw circle at x,y with radius 30 and fill with red color
        circle(x, y), 30, rgb(255,0,0) , , , ,f
    screenunlock
   
    Sleep 2

Loop Until MultiKey(&H01)  'loop until ESC key is pressed
zelda64bit
Posts: 14
Joined: Mar 13, 2021 10:18

Re: Presentation and questions about freebasic

Postby zelda64bit » Apr 16, 2021 19:08

dodicat wrote:Very unusual not to have opengl, even with an intel onboard card.
I have an older machine also, although with a faster processor:
Operating System: Windows 10 Pro 64-bit (10.0, Build 19042) (19041.vb_release.191206-1406)
Language: English (Regional Setting: English)
System Manufacturer: Hewlett-Packard
System Model: HP Compaq 8200 Elite SFF PC
BIOS: Default System BIOS (type: BIOS)
Processor: Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz (4 CPUs), ~3.0GHz
Memory: 8192MB RAM
...
...
Here is the start of my test.

Code: Select all

Card: Intel(R) HD Graphics 2000
Manufacturer Intel
OpenGL Version 3.1.0 - Build 9.17.10.4459
FreebASIC Driver = OpenGL

EXTENSIONS:

 1            GL_EXT_blend_minmax
 2            GL_EXT_blend_subtract
 3            GL_EXT_blend_color
 4            GL_EXT_abgr
 5            GL_EXT_texture3D
 6            GL_EXT_clip_volume_hint
 7            GL_EXT_compiled_vertex_array
 8            GL_SGIS_texture_edge_clamp
 9            GL_SGIS_generate_mipmap
 10           GL_EXT_draw_range_elements
 11           GL_SGIS_texture_lod
 12           GL_EXT_rescale_normal
 13           GL_EXT_packed_pixels
. . .
. . .
up to 115
 

Here is the test code:

Code: Select all

 

#include "gl/glu.bi"
     
Screenres 50,50,32,,2
dim as string driver
screeninfo ,,,,,,driver

dim as string s,tmp
s+= "Card: "+*glGetString(GL_RENDERER)+chr(10)
s+= "Manufacturer "+*glGetString(GL_VENDOR)+chr(10)
s+= "OpenGL Version "+*glGetString(GL_VERSION)+chr(10)
s+= "FreebASIC Driver = " +driver+chr(10)
s+= " " +chr(10)
s+= "EXTENSIONS:"+chr(10)


tmp=*glGetString(GL_EXTENSIONS)
tmp=trim(tmp)+" "
screen 0
width , 500
print s
dim as long i,ctr
do
    ctr+=1
    i=instr(tmp," ")
    if i=len(tmp) then print ctr, mid(tmp,1,i): exit do
    print ctr, mid(tmp,1,i)
    tmp=mid(tmp,i+1)
loop until i=0
print
print "Press a key to end"
sleep
   

   

My previous machine only had opengl 2, and it was an old Del which eventually threw in it's handl


Card: Intel 965/963 Graphics Media Accelerator
Manufacturer Intel
OpenGL Version 2.0.0 - Build 8.14.10.1930
FreebASIC Driver = OpenGL

The problem is the official intel driver, which does not work well in wiindow 7 and vista. I tried to install window xp but it did not detect my hard drive.

If you know any unofficial driver for this card it would be great, if it doesn't, it will remain the same.
zelda64bit
Posts: 14
Joined: Mar 13, 2021 10:18

Re: Presentation and questions about freebasic

Postby zelda64bit » Apr 16, 2021 19:10

paul doe wrote:
zelda64bit wrote:...
Finally I would like to say that right now I am a little lost and I don't know where to start to learn freebasic, if you can help me start learning freebasic I would appreciate it and I would also like you to recommend me a video game engine that is easy to use so that learning with freebasic is more fun. Besides that what I would like is to program 2d planes games with freebasic.
...

Welcome. Unfortunately, FreeBasic has a lack of really usable game engines, so you'll have to roll your own. Not necessarily a bad thing, since for learning purposes it's pretty useful.

Have a look at this:

https://github.com/glasyalabolas/fb-asteroids

A while ago, I coded a minimal example of a STG (albeit in an 'Asteroids' style) for reference. You might find it useful as it contains many of the basics you'll need to code such a game.


Thanks, but it is too much code and I do not understand it. I am able to understand a maximum of 10 lines of code, if there are more I get lost.
zelda64bit
Posts: 14
Joined: Mar 13, 2021 10:18

Re: Presentation and questions about freebasic

Postby zelda64bit » Apr 16, 2021 19:11

marcov wrote:
caseih wrote:
zelda64bit wrote:I would like to do these kinds of games.
https://www.youtube.com/watch?v=28D6j4vtKiM

I also wanted to comment that my computer is old and does not support opengl, only directx and software.

For computers without a GPU-supplied OpenGL dll, MS has always shipped opendl32.dll which implements OpenGL 2 on any computer. It's been around since before Windows XP. Hence OpenGL 2 can work on any Windows computer regardless of hardware age.


My first opengl card (monster 3D) was at first even dos only.

You can check your opengl capabilities with programs like gpu-z or, the best, opengl extensions viewer (http://www.realtech-vr.com/home/glview)


I have already verified it, but the problem is the intel drivers, and there are no more updates.
zelda64bit
Posts: 14
Joined: Mar 13, 2021 10:18

Re: Presentation and questions about freebasic

Postby zelda64bit » Apr 16, 2021 19:14

BasicCoder2 wrote:@zelda64bit
I haven't tried the freebasic graphical commands yet, so I was wondering if there was a tutorial to get started.


So what level of programming competence do you have so far?

Have you downloaded and chosen an editor to write your FreeBASIC program with?

Can you compile and run this program ok? You can move the red circle around with the arrow keys.

Code: Select all

ScreenRes 640, 480, 32  'creates a 640x480 window with 32 bit color pixels

dim as integer x   'position to draw circle in window
dim as integer y

x = 320  'start position in center of window
y = 240

Do
    ' Check arrow keys and update the (x, y) position accordingly
    If MultiKey(&H4B) And x >   0 Then x = x - 1   'move circle left
    If MultiKey(&H4D) And x < 639 Then x = x + 1   'move circle right
    If MultiKey(&H48) And y >   0 Then y = y - 1   'move circle up screen by one pixel
    If MultiKey(&H50) And y < 479 Then y = y + 1   'move circle down screen by one pixel
   
    screenlock 
        'clear the window
        cls
        'draw circle at x,y with radius 30 and fill with red color
        circle(x, y), 30, rgb(255,0,0) , , , ,f
    screenunlock
   
    Sleep 2

Loop Until MultiKey(&H01)  'loop until ESC key is pressed


The example works well for me.
The ide I use is winFBE and my programming knowledge is basic.

I have played around with clickteam fusion 2.5, gamemaker 8 and learned the basics of python.
BasicCoder2
Posts: 3713
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Presentation and questions about freebasic

Postby BasicCoder2 » Apr 16, 2021 21:52

@zelda64bit

Game Maker enables you to create your own Windows computer games without needing to know how to write any code.


So what was wrong with Game Maker? Apparently you don't even have to write code?

What was wrong with Clickteam fusion 2.5? Apparently within your first hour you will have learned the basics of the tool.
Is it all this language barrier thing?

In some ways Python is more high level than FreeBASIC and has a lot of external support. Easy to install libraries. Lots of tutorials on how to use it. I haven't tried writing a game with it but I see there are tutorials on writing scrolling shoot up games? It is a language well worth learning even if only because it is so popular and widely used.

Do Python tutorials lack support for those who only speak Spanish?

FreeBASIC used to have a lot of would be game developers but 10 years ago it all ended as tools for writing games became available.

It appears that the ability to read English is a requirement for programming even if only to read most source code. Google translate is limited when it comes to code. It cannot translate a short hand for some things like SCREEN written in shorthand as SCR, into pantalla. What shorthand might you use for that? PANT? In the example the word multikey would not translate. It means multiple key which I see you would write as key multiple.

Ultimately only you know what you can do and if learning FreeBASIC from translated old tutorial material is worth the effort. You should get answers to most programming questions posted here.
zelda64bit
Posts: 14
Joined: Mar 13, 2021 10:18

Re: Presentation and questions about freebasic

Postby zelda64bit » Apr 17, 2021 9:35

BasicCoder2 wrote:@zelda64bit

Game Maker enables you to create your own Windows computer games without needing to know how to write any code.


So what was wrong with Game Maker? Apparently you don't even have to write code?

What was wrong with Clickteam fusion 2.5? Apparently within your first hour you will have learned the basics of the tool.
Is it all this language barrier thing?

In some ways Python is more high level than FreeBASIC and has a lot of external support. Easy to install libraries. Lots of tutorials on how to use it. I haven't tried writing a game with it but I see there are tutorials on writing scrolling shoot up games? It is a language well worth learning even if only because it is so popular and widely used.

Do Python tutorials lack support for those who only speak Spanish?

FreeBASIC used to have a lot of would be game developers but 10 years ago it all ended as tools for writing games became available.

It appears that the ability to read English is a requirement for programming even if only to read most source code. Google translate is limited when it comes to code. It cannot translate a short hand for some things like SCREEN written in shorthand as SCR, into pantalla. What shorthand might you use for that? PANT? In the example the word multikey would not translate. It means multiple key which I see you would write as key multiple.

Ultimately only you know what you can do and if learning FreeBASIC from translated old tutorial material is worth the effort. You should get answers to most programming questions posted here.


Gamemaker and clickteam fusion are commercial and with limited languages, python does have a lot of documentation in Spanish and I like the language, but it is slow and does not work at the speed I would like.
Freebasic works for me at a good speed but I see that there are no tools to make games, so I will keep looking, thanks for the answers. :)
PublioMaro_Virgilivs
Posts: 14
Joined: Nov 23, 2020 16:45
Contact:

Re: Presentation and questions about freebasic

Postby PublioMaro_Virgilivs » Apr 22, 2021 21:05

@zelda64bit I learned BASIC when I was a kid. If you try hard enough, you could also learn (a little bit) english. BASIC (and also FREEBASIC) is like telling the computer what do you want it to do, but with instructions you can also understand (very different situation is with ASSAMBLER or even C).

For example:

Code: Select all

CLS ' CLear Screen (limpia la pantalla)
PRINT "Hola mundo, or should I say Hello World!" ' IMPRIME "Hola mundo, ..."
IF 5 + 5 = 10 THEN PRINT "5+5=10" ELSE PRINT "5+5 is wrong" ' SI 5+5=10 IMPRIME "5+5=10" SINO IMPRIME "5+5 está mal"
END ' Fin del programa


I'm from México, and I think you can learn english too (it's not that difficult) if you think that is a requeriment for your learning in FreeBASIC. Using Google Translator is ok, now it has a very advanced translation algorithm, despite the very well known failures (just a few), as a spanish speaking person, I can tell you that is not that necessary to learn to speak english for you to learn FreeBASIC or any other programming language. But I think is a plus because you will know what instructions means in the case of FreeBASIC, that is a high level programming language.
zelda64bit
Posts: 14
Joined: Mar 13, 2021 10:18

Re: Presentation and questions about freebasic

Postby zelda64bit » Apr 24, 2021 18:40

PublioMaro_Virgilivs wrote:@zelda64bit I learned BASIC when I was a kid. If you try hard enough, you could also learn (a little bit) english. BASIC (and also FREEBASIC) is like telling the computer what do you want it to do, but with instructions you can also understand (very different situation is with ASSAMBLER or even C).

For example:

Code: Select all

CLS ' CLear Screen (limpia la pantalla)
PRINT "Hola mundo, or should I say Hello World!" ' IMPRIME "Hola mundo, ..."
IF 5 + 5 = 10 THEN PRINT "5+5=10" ELSE PRINT "5+5 is wrong" ' SI 5+5=10 IMPRIME "5+5=10" SINO IMPRIME "5+5 está mal"
END ' Fin del programa


I'm from México, and I think you can learn english too (it's not that difficult) if you think that is a requeriment for your learning in FreeBASIC. Using Google Translator is ok, now it has a very advanced translation algorithm, despite the very well known failures (just a few), as a spanish speaking person, I can tell you that is not that necessary to learn to speak english for you to learn FreeBASIC or any other programming language. But I think is a plus because you will know what instructions means in the case of FreeBASIC, that is a high level programming language.


Have you programmed any games with freebasic?
PublioMaro_Virgilivs
Posts: 14
Joined: Nov 23, 2020 16:45
Contact:

Re: Presentation and questions about freebasic

Postby PublioMaro_Virgilivs » Apr 25, 2021 4:37

zelda64bit wrote:Have you programmed any games with freebasic?


Not yet... I'm still learning FreeBASIC, just like you. Why do you ask?
zelda64bit
Posts: 14
Joined: Mar 13, 2021 10:18

Re: Presentation and questions about freebasic

Postby zelda64bit » Apr 25, 2021 18:32

PublioMaro_Virgilivs wrote:
zelda64bit wrote:Have you programmed any games with freebasic?


Not yet... I'm still learning FreeBASIC, just like you. Why do you ask?


in case you have a tutorial that will teach you the basics
BasicCoder2
Posts: 3713
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Presentation and questions about freebasic

Postby BasicCoder2 » Apr 25, 2021 21:35

@zelda64bit

Writing a computer game is just one thing you might do once you know how to program a computer.

Explaining how to write a computer game requires you first know how to program.

My impression is you want to make your own computer game but are not excited about learning how to program? This is not unusual thus the existence of software like GameMaker which does all the heavy lifting. However GameMaker does not teach programming in that you cannot use what you learn to program another type of game or another type of application.

I gave you lesson 1 in a previous post to which you replied "The example works well for me." but did you understand it? You asked no questions. Did you play around with the code by making different sized windows or a different sized circle with a different color? How might you make the circle bounce around the screen by itself? How would you modify the code to have more than one circle maybe different sizes or different colors. How would you compute if two circles overlap each other. That is what writing at that low level requires. Those basic skills can be used to make your scrolling shooter games.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 15 guests