Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

is BASIC good for a beginner

ZigggyZigggy Posts: 10Member
i really want to learn to program but i dont really know hoe to start is BASIC a good language to start with and will it help me learn other languages? plus any info anyone thinks a begginer in BASIC need please feel free to add in i apereciate it.
Hey people im here to learn and there are no stupid questions only stupid people who ask them
«1

Comments

  • IDKIDK Posts: 1,784Member
    : i really want to learn to program but i dont really know hoe to start is BASIC a good language to start with and will it help me learn other languages? plus any info anyone thinks a begginer in BASIC need please feel free to add in i apereciate it.
    : Hey people im here to learn and there are no stupid questions only stupid people who ask them
    :
    I would not recomend beginning with BASIC.
    I did and there is some small differences
    when you move on to a new language
    (C++,C#,Java...)
    The different is that it's OO
    (Object Oriented) and (this one is really
    annoying) the loop statement has
    LOOP UNTIL. I'm stuck on that one all the
    time when I try to do something good.

    You could use LOOP WHILE...
    Yes, USE LOOP WHILE!!

    Another thing is that it is old and that
    means it can't do event thingys.
    But if you just want to do some good
    programs without interface it doesn't
    matter.
    ===============================
    El [b]PRO[/b]grammador Niklas Ulvinge

  • GaashiusGaashius Posts: 349Member
    : : i really want to learn to program but i dont really know hoe to start is BASIC a good language to start with and will it help me learn other languages? plus any info anyone thinks a begginer in BASIC need please feel free to add in i apereciate it.
    : : Hey people im here to learn and there are no stupid questions only stupid people who ask them
    : :
    : I would not recomend beginning with BASIC.
    : I did and there is some small differences
    : when you move on to a new language
    : (C++,C#,Java...)
    : The different is that it's OO
    : (Object Oriented) and (this one is really
    : annoying) the loop statement has
    : LOOP UNTIL. I'm stuck on that one all the
    : time when I try to do something good.
    :
    : You could use LOOP WHILE...
    : Yes, USE LOOP WHILE!!
    :
    : Another thing is that it is old and that
    : means it can't do event thingys.
    : But if you just want to do some good
    : programs without interface it doesn't
    : matter.
    : ===============================
    : El [b]PRO[/b]grammador Niklas Ulvinge
    :
    :
    I recommend you to use BASIC first(or pascal). It's the most basic :-) language ever, and moving to other langs just need a little study. For beginners OOP is fully another pasta.

    And, why would'nt you use both LOOP UNTIL and LOOP WHILE? Both of them are good for something.

    As for BASIC's interface, I fully agree with IDK.

    So I say just use BASIC - We are here, just ask if you have any problems!

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • IDKIDK Posts: 1,784Member
    : : : i really want to learn to program but i dont really know hoe to start is BASIC a good language to start with and will it help me learn other languages? plus any info anyone thinks a begginer in BASIC need please feel free to add in i apereciate it.
    : : : Hey people im here to learn and there are no stupid questions only stupid people who ask them
    : : :
    : : I would not recomend beginning with BASIC.
    : : I did and there is some small differences
    : : when you move on to a new language
    : : (C++,C#,Java...)
    : : The different is that it's OO
    : : (Object Oriented) and (this one is really
    : : annoying) the loop statement has
    : : LOOP UNTIL. I'm stuck on that one all the
    : : time when I try to do something good.
    : :
    : : You could use LOOP WHILE...
    : : Yes, USE LOOP WHILE!!
    : :
    : : Another thing is that it is old and that
    : : means it can't do event thingys.
    : : But if you just want to do some good
    : : programs without interface it doesn't
    : : matter.
    : : ===============================
    : : El [b]PRO[/b]grammador Niklas Ulvinge
    : :
    : :
    : I recommend you to use BASIC first(or pascal). It's the most basic :-) language ever, and moving to other langs just need a little study. For beginners OOP is fully another pasta.
    :
    : And, why would'nt you use both LOOP UNTIL and LOOP WHILE? Both of them are good for something.
    :
    : As for BASIC's interface, I fully agree with IDK.
    :
    : So I say just use BASIC - We are here, just ask if you have any problems!
    :
    : ****************
    : Any questions? Just ask!
    :
    : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    :
    :
    :
    I always use LOOP UNTIL and can't get my head out of it.
    These AND and OR operators get really confusing.
    I do it wrong in nine times of ten.

    OK, BASIC is a really good language to begin with.
    It is easy to use and learn. I still use basic when
    I try to solve some hard math problems.

    But don't use LOOP UNTIL!!!
    ===============================
    El [b]PRO[/b]grammador Niklas Ulvinge

  • ZigggyZigggy Posts: 10Member
    : : : : i really want to learn to program but i dont really know hoe to start is BASIC a good language to start with and will it help me learn other languages? plus any info anyone thinks a begginer in BASIC need please feel free to add in i apereciate it.
    : : : : Hey people im here to learn and there are no stupid questions only stupid people who ask them
    : : : :
    : : : I would not recomend beginning with BASIC.
    : : : I did and there is some small differences
    : : : when you move on to a new language
    : : : (C++,C#,Java...)
    : : : The different is that it's OO
    : : : (Object Oriented) and (this one is really
    : : : annoying) the loop statement has
    : : : LOOP UNTIL. I'm stuck on that one all the
    : : : time when I try to do something good.
    : : :
    : : : You could use LOOP WHILE...
    : : : Yes, USE LOOP WHILE!!
    : : :
    : : : Another thing is that it is old and that
    : : : means it can't do event thingys.
    : : : But if you just want to do some good
    : : : programs without interface it doesn't
    : : : matter.
    : : : ===============================
    : : : El [b]PRO[/b]grammador Niklas Ulvinge
    : : :
    : : :
    : : I recommend you to use BASIC first(or pascal). It's the most basic :-) language ever, and moving to other langs just need a little study. For beginners OOP is fully another pasta.
    : :
    : : And, why would'nt you use both LOOP UNTIL and LOOP WHILE? Both of them are good for something.
    : :
    : : As for BASIC's interface, I fully agree with IDK.
    : :
    : : So I say just use BASIC - We are here, just ask if you have any problems!
    : :
    : : ****************
    : : Any questions? Just ask!
    : :
    : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : :
    : :
    : :
    : I always use LOOP UNTIL and can't get my head out of it.
    : These AND and OR operators get really confusing.
    : I do it wrong in nine times of ten.
    :
    : OK, BASIC is a really good language to begin with.
    : It is easy to use and learn. I still use basic when
    : I try to solve some hard math problems.
    :
    : But don't use LOOP UNTIL!!!
    : ===============================
    : El [b]PRO[/b]grammador Niklas Ulvinge
    :
    :

    another question i have is what is it limited to making what can it not
    do i wanna make games and i dont know what BASIC can be used for
    Hey people im here to learn and there are no stupid questions only stupid people who ask them

  • IDKIDK Posts: 1,784Member
    : another question i have is what is it limited to making what can it not
    : do i wanna make games and i dont know what BASIC can be used for
    : Hey people im here to learn and there are no stupid questions only stupid people who ask them
    :
    :
    The most annoying thing in basic
    when doing games is that it cant
    handle multiple keybord inputs.
    Yes it can but it isn't easy to
    do that.

    Another bad thing with basic (and
    the reason for C being built) is
    that the code get's big and hard
    to get in short time.

    It it's hard to handle picture
    files.

    If you want to do a heavy program
    (like a 3D engine, I've done that)
    It will be very slow.
    ===============================
    El [b]PRO[/b]grammador Niklas Ulvinge

  • GaashiusGaashius Posts: 349Member
    : : another question i have is what is it limited to making what can it not
    : : do i wanna make games and i dont know what BASIC can be used for
    : : Hey people im here to learn and there are no stupid questions only stupid people who ask them
    : :
    : :
    : The most annoying thing in basic
    : when doing games is that it cant
    : handle multiple keybord inputs.
    : Yes it can but it isn't easy to
    : do that.
    :
    : Another bad thing with basic (and
    : the reason for C being built) is
    : that the code get's big and hard
    : to get in short time.
    :
    : It it's hard to handle picture
    : files.
    :
    : If you want to do a heavy program
    : (like a 3D engine, I've done that)
    : It will be very slow.
    : ===============================
    : El [b]PRO[/b]grammador Niklas Ulvinge
    :
    :
    Well exactly BASIC can be used for making easy-looking games - not for hightech 3d things.

    (And IDK I should take a look at your BASIC 3d engine...if you don't mind)

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • IDKIDK Posts: 1,784Member
    : (And IDK I should take a look at your BASIC 3d engine...if you don't
    : mind)

    It's just dot's.
    When I tried to
    extend it it was
    to slow. (1 frame
    took 30 seconds!!

    Here's the code anyhow.
    It's preatty cool.
    [code]3DUNIVE2.BAS:

    DEFINT A
    DEFSNG B-Z
    TYPE threeDdot
    x AS SINGLE
    y AS SINGLE
    z AS SINGLE
    c AS INTEGER
    Bx AS SINGLE
    By AS SINGLE
    dx AS SINGLE
    dy AS SINGLE
    dz AS SINGLE
    mas AS SINGLE
    END TYPE
    di = 100 'distance
    num = 100 'number of particles
    ss = .1 'start stepsize
    SCREEN 13
    'palette
    OUT &H3C8, 0
    FOR a = 0 TO 63
    OUT &H3C9, a
    OUT &H3C9, a
    OUT &H3C9, a
    NEXT
    FOR a = 0 TO 63
    OUT &H3C9, a
    OUT &H3C9, 0
    OUT &H3C9, 0
    NEXT
    FOR a = 0 TO 63
    OUT &H3C9, 0
    OUT &H3C9, 0
    OUT &H3C9, a
    NEXT
    FOR a = 0 TO 63
    OUT &H3C9, a
    OUT &H3C9, a
    OUT &H3C9, 0
    NEXT

    'declare and init matrix
    DIM d(num) AS threeDdot
    FOR a = 1 TO num
    d(a).x = RND * 128 - 64
    d(a).y = RND * 128 - 64
    d(a).z = RND * 128 - 64
    d(a).c = RND * 3
    d(a).mas = RND + .0001
    NEXT
    'main loop
    DO
    'keys
    a$ = UCASE$(INKEY$)
    IF a$ = "A" THEN xa = xa + ss
    IF a$ = "D" THEN xa = xa - ss
    IF a$ = "W" THEN ya = ya + ss
    IF a$ = "S" THEN ya = ya - ss
    IF a$ = "Q" THEN za = za + ss
    IF a$ = "E" THEN za = za - ss
    IF a$ = "M" THEN am = am + 1
    IF am > 5 THEN am = 0
    IF a$ = "+" THEN di = di + ss * 10
    IF a$ = "-" THEN di = di - ss * 10
    IF a$ = "," THEN ss = ss + .01
    IF a$ = "." THEN ss = ss - .01
    IF a$ = "I" THEN ap = 1: 'get info of particles
    IF a$ = " " THEN CLS
    IF a$ = CHR$(27) THEN END
    'calc fps and print approximately info on screen every second
    fps = fps + 1
    IF TIMER - t > 1 THEN t = TIMER: COLOR 63: LOCATE 1, 1: PRINT fps; CINT(ss * 100) / 100; CINT(di); CINT(xa * 100) / 100; CINT(ya * 100) / 100; CINT(za * 100) / 100; am: fps = 0

    'particle loop
    FOR a = 1 TO num
    'universe calculations
    'move particle
    d(a).x = d(a).x + d(a).dx
    d(a).y = d(a).y + d(a).dy
    d(a).z = d(a).z + d(a).dz
    'calc gravity force for each particle on each particle
    FOR b = 1 TO num
    IF NOT (b = a) THEN
    r = (d(a).x - d(b).x) ^ 2 + (d(a).y - d(b).y) ^ 2 + (d(a).z - d(b).z) ^ 2
    d(b).dx = d(b).dx + (d(a).x - d(b).x) / r * (d(a).mas / d(b).mas) / 100
    d(b).dy = d(b).dy + (d(a).y - d(b).y) / r * (d(a).mas / d(b).mas) / 100
    d(b).dz = d(b).dz + (d(a).z - d(b).z) / r * (d(a).mas / d(b).mas) / 100
    END IF 'star(a).mas * star(b).mas / r
    NEXT

    'calc coordinates
    Ty = ((d(a).y * COS(xa)) - (d(a).z * SIN(xa)))
    Tz = ((d(a).y * SIN(xa)) + (d(a).z * COS(xa)))
    Tx = ((d(a).x * COS(ya)) - (Tz * SIN(ya)))
    Tz = ((d(a).x * SIN(ya)) + (Tz * COS(ya)))
    Ox = Tx
    Tx = ((Tx * COS(za)) - (Ty * SIN(za)))
    Ty = ((Ox * SIN(za)) + (Ty * COS(za)))
    'adjust coordinates to screen
    Nx = INT(128 * (Tx) / (di - (Tz))) + 160
    Ny = INT(100 - (128 * Ty) / (di - (Tz)))

    'calc color
    ac = a + 1
    cc = ABS(FIX((Tz + 128) / 4)) + d(a).c * 64

    'move particle
    SELECT CASE am
    CASE 0'palette color
    PSET (d(a).Bx, d(a).By), 0
    d(a).Bx = Nx
    d(a).By = Ny
    PSET (Nx, Ny), cc
    CASE 1'palette color with flash
    PSET (Nx, Ny), cc
    PSET (d(a).Bx, d(a).By), 0
    d(a).Bx = Nx
    d(a).By = Ny
    CASE 2'smoke (need to be at least a million i think)
    PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
    d(a).Bx = Nx
    d(a).By = Ny
    PSET (Nx, Ny), POINT(Nx, Ny) + 1
    CASE 3'smoke with flash
    PSET (Nx, Ny), POINT(Nx, Ny) + 1
    PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
    d(a).Bx = Nx
    d(a).By = Ny
    CASE 4'smoke trail (use space to clear)
    PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
    d(a).Bx = Nx
    d(a).By = Ny
    PSET (Nx, Ny), POINT(Nx, Ny) + 1
    CASE 5'smoke trail with flash
    PSET (Nx, Ny), POINT(Nx, Ny) + 1
    PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
    d(a).Bx = Nx
    d(a).By = Ny
    END SELECT

    IF ap THEN COLOR 63: PRINT Nx; Ny; Tz; cc
    NEXT
    ap = 0
    LOOP[/code]
    I've done another one with the microuniverse.
    It got a whole lot of more forces(I couldn't
    make the weak nuclear force).
    [b]===============================[/b]
    El PROgrammador [b]Niklas Ulvinge[/b]

  • GaashiusGaashius Posts: 349Member
    : : (And IDK I should take a look at your BASIC 3d engine...if you don't
    : : mind)
    :
    : It's just dot's.
    : When I tried to
    : extend it it was
    : to slow. (1 frame
    : took 30 seconds!!
    :
    : Here's the code anyhow.
    : It's preatty cool.
    : [code]3DUNIVE2.BAS:
    :
    : DEFINT A
    : DEFSNG B-Z
    : TYPE threeDdot
    : x AS SINGLE
    : y AS SINGLE
    : z AS SINGLE
    : c AS INTEGER
    : Bx AS SINGLE
    : By AS SINGLE
    : dx AS SINGLE
    : dy AS SINGLE
    : dz AS SINGLE
    : mas AS SINGLE
    : END TYPE
    : di = 100 'distance
    : num = 100 'number of particles
    : ss = .1 'start stepsize
    : SCREEN 13
    : 'palette
    : OUT &H3C8, 0
    : FOR a = 0 TO 63
    : OUT &H3C9, a
    : OUT &H3C9, a
    : OUT &H3C9, a
    : NEXT
    : FOR a = 0 TO 63
    : OUT &H3C9, a
    : OUT &H3C9, 0
    : OUT &H3C9, 0
    : NEXT
    : FOR a = 0 TO 63
    : OUT &H3C9, 0
    : OUT &H3C9, 0
    : OUT &H3C9, a
    : NEXT
    : FOR a = 0 TO 63
    : OUT &H3C9, a
    : OUT &H3C9, a
    : OUT &H3C9, 0
    : NEXT
    :
    : 'declare and init matrix
    : DIM d(num) AS threeDdot
    : FOR a = 1 TO num
    : d(a).x = RND * 128 - 64
    : d(a).y = RND * 128 - 64
    : d(a).z = RND * 128 - 64
    : d(a).c = RND * 3
    : d(a).mas = RND + .0001
    : NEXT
    : 'main loop
    : DO
    : 'keys
    : a$ = UCASE$(INKEY$)
    : IF a$ = "A" THEN xa = xa + ss
    : IF a$ = "D" THEN xa = xa - ss
    : IF a$ = "W" THEN ya = ya + ss
    : IF a$ = "S" THEN ya = ya - ss
    : IF a$ = "Q" THEN za = za + ss
    : IF a$ = "E" THEN za = za - ss
    : IF a$ = "M" THEN am = am + 1
    : IF am > 5 THEN am = 0
    : IF a$ = "+" THEN di = di + ss * 10
    : IF a$ = "-" THEN di = di - ss * 10
    : IF a$ = "," THEN ss = ss + .01
    : IF a$ = "." THEN ss = ss - .01
    : IF a$ = "I" THEN ap = 1: 'get info of particles
    : IF a$ = " " THEN CLS
    : IF a$ = CHR$(27) THEN END
    : 'calc fps and print approximately info on screen every second
    : fps = fps + 1
    : IF TIMER - t > 1 THEN t = TIMER: COLOR 63: LOCATE 1, 1: PRINT fps; CINT(ss * 100) / 100; CINT(di); CINT(xa * 100) / 100; CINT(ya * 100) / 100; CINT(za * 100) / 100; am: fps = 0
    :
    : 'particle loop
    : FOR a = 1 TO num
    : 'universe calculations
    : 'move particle
    : d(a).x = d(a).x + d(a).dx
    : d(a).y = d(a).y + d(a).dy
    : d(a).z = d(a).z + d(a).dz
    : 'calc gravity force for each particle on each particle
    : FOR b = 1 TO num
    : IF NOT (b = a) THEN
    : r = (d(a).x - d(b).x) ^ 2 + (d(a).y - d(b).y) ^ 2 + (d(a).z - d(b).z) ^ 2
    : d(b).dx = d(b).dx + (d(a).x - d(b).x) / r * (d(a).mas / d(b).mas) / 100
    : d(b).dy = d(b).dy + (d(a).y - d(b).y) / r * (d(a).mas / d(b).mas) / 100
    : d(b).dz = d(b).dz + (d(a).z - d(b).z) / r * (d(a).mas / d(b).mas) / 100
    : END IF 'star(a).mas * star(b).mas / r
    : NEXT
    :
    : 'calc coordinates
    : Ty = ((d(a).y * COS(xa)) - (d(a).z * SIN(xa)))
    : Tz = ((d(a).y * SIN(xa)) + (d(a).z * COS(xa)))
    : Tx = ((d(a).x * COS(ya)) - (Tz * SIN(ya)))
    : Tz = ((d(a).x * SIN(ya)) + (Tz * COS(ya)))
    : Ox = Tx
    : Tx = ((Tx * COS(za)) - (Ty * SIN(za)))
    : Ty = ((Ox * SIN(za)) + (Ty * COS(za)))
    : 'adjust coordinates to screen
    : Nx = INT(128 * (Tx) / (di - (Tz))) + 160
    : Ny = INT(100 - (128 * Ty) / (di - (Tz)))
    :
    : 'calc color
    : ac = a + 1
    : cc = ABS(FIX((Tz + 128) / 4)) + d(a).c * 64
    :
    : 'move particle
    : SELECT CASE am
    : CASE 0'palette color
    : PSET (d(a).Bx, d(a).By), 0
    : d(a).Bx = Nx
    : d(a).By = Ny
    : PSET (Nx, Ny), cc
    : CASE 1'palette color with flash
    : PSET (Nx, Ny), cc
    : PSET (d(a).Bx, d(a).By), 0
    : d(a).Bx = Nx
    : d(a).By = Ny
    : CASE 2'smoke (need to be at least a million i think)
    : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
    : d(a).Bx = Nx
    : d(a).By = Ny
    : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : CASE 3'smoke with flash
    : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
    : d(a).Bx = Nx
    : d(a).By = Ny
    : CASE 4'smoke trail (use space to clear)
    : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
    : d(a).Bx = Nx
    : d(a).By = Ny
    : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : CASE 5'smoke trail with flash
    : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
    : d(a).Bx = Nx
    : d(a).By = Ny
    : END SELECT
    :
    : IF ap THEN COLOR 63: PRINT Nx; Ny; Tz; cc
    : NEXT
    : ap = 0
    : LOOP[/code]
    : I've done another one with the microuniverse.
    : It got a whole lot of more forces(I couldn't
    : make the weak nuclear force).
    : [b]===============================[/b]
    : El PROgrammador [b]Niklas Ulvinge[/b]
    :
    :
    Well - this is just a 3d prog - not an engine! I just asked because it was hard to me trying to imagine that a 3D engine is possible in QBASIC without assembly.

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


  • IDKIDK Posts: 1,784Member
    : : : (And IDK I should take a look at your BASIC 3d engine...if you don't
    : : : mind)
    : :
    : : It's just dot's.
    : : When I tried to
    : : extend it it was
    : : to slow. (1 frame
    : : took 30 seconds!!
    : :
    : : Here's the code anyhow.
    : : It's preatty cool.
    : : [code]3DUNIVE2.BAS:
    : :
    : : DEFINT A
    : : DEFSNG B-Z
    : : TYPE threeDdot
    : : x AS SINGLE
    : : y AS SINGLE
    : : z AS SINGLE
    : : c AS INTEGER
    : : Bx AS SINGLE
    : : By AS SINGLE
    : : dx AS SINGLE
    : : dy AS SINGLE
    : : dz AS SINGLE
    : : mas AS SINGLE
    : : END TYPE
    : : di = 100 'distance
    : : num = 100 'number of particles
    : : ss = .1 'start stepsize
    : : SCREEN 13
    : : 'palette
    : : OUT &H3C8, 0
    : : FOR a = 0 TO 63
    : : OUT &H3C9, a
    : : OUT &H3C9, a
    : : OUT &H3C9, a
    : : NEXT
    : : FOR a = 0 TO 63
    : : OUT &H3C9, a
    : : OUT &H3C9, 0
    : : OUT &H3C9, 0
    : : NEXT
    : : FOR a = 0 TO 63
    : : OUT &H3C9, 0
    : : OUT &H3C9, 0
    : : OUT &H3C9, a
    : : NEXT
    : : FOR a = 0 TO 63
    : : OUT &H3C9, a
    : : OUT &H3C9, a
    : : OUT &H3C9, 0
    : : NEXT
    : :
    : : 'declare and init matrix
    : : DIM d(num) AS threeDdot
    : : FOR a = 1 TO num
    : : d(a).x = RND * 128 - 64
    : : d(a).y = RND * 128 - 64
    : : d(a).z = RND * 128 - 64
    : : d(a).c = RND * 3
    : : d(a).mas = RND + .0001
    : : NEXT
    : : 'main loop
    : : DO
    : : 'keys
    : : a$ = UCASE$(INKEY$)
    : : IF a$ = "A" THEN xa = xa + ss
    : : IF a$ = "D" THEN xa = xa - ss
    : : IF a$ = "W" THEN ya = ya + ss
    : : IF a$ = "S" THEN ya = ya - ss
    : : IF a$ = "Q" THEN za = za + ss
    : : IF a$ = "E" THEN za = za - ss
    : : IF a$ = "M" THEN am = am + 1
    : : IF am > 5 THEN am = 0
    : : IF a$ = "+" THEN di = di + ss * 10
    : : IF a$ = "-" THEN di = di - ss * 10
    : : IF a$ = "," THEN ss = ss + .01
    : : IF a$ = "." THEN ss = ss - .01
    : : IF a$ = "I" THEN ap = 1: 'get info of particles
    : : IF a$ = " " THEN CLS
    : : IF a$ = CHR$(27) THEN END
    : : 'calc fps and print approximately info on screen every second
    : : fps = fps + 1
    : : IF TIMER - t > 1 THEN t = TIMER: COLOR 63: LOCATE 1, 1: PRINT fps; CINT(ss * 100) / 100; CINT(di); CINT(xa * 100) / 100; CINT(ya * 100) / 100; CINT(za * 100) / 100; am: fps = 0
    : :
    : : 'particle loop
    : : FOR a = 1 TO num
    : : 'universe calculations
    : : 'move particle
    : : d(a).x = d(a).x + d(a).dx
    : : d(a).y = d(a).y + d(a).dy
    : : d(a).z = d(a).z + d(a).dz
    : : 'calc gravity force for each particle on each particle
    : : FOR b = 1 TO num
    : : IF NOT (b = a) THEN
    : : r = (d(a).x - d(b).x) ^ 2 + (d(a).y - d(b).y) ^ 2 + (d(a).z - d(b).z) ^ 2
    : : d(b).dx = d(b).dx + (d(a).x - d(b).x) / r * (d(a).mas / d(b).mas) / 100
    : : d(b).dy = d(b).dy + (d(a).y - d(b).y) / r * (d(a).mas / d(b).mas) / 100
    : : d(b).dz = d(b).dz + (d(a).z - d(b).z) / r * (d(a).mas / d(b).mas) / 100
    : : END IF 'star(a).mas * star(b).mas / r
    : : NEXT
    : :
    : : 'calc coordinates
    : : Ty = ((d(a).y * COS(xa)) - (d(a).z * SIN(xa)))
    : : Tz = ((d(a).y * SIN(xa)) + (d(a).z * COS(xa)))
    : : Tx = ((d(a).x * COS(ya)) - (Tz * SIN(ya)))
    : : Tz = ((d(a).x * SIN(ya)) + (Tz * COS(ya)))
    : : Ox = Tx
    : : Tx = ((Tx * COS(za)) - (Ty * SIN(za)))
    : : Ty = ((Ox * SIN(za)) + (Ty * COS(za)))
    : : 'adjust coordinates to screen
    : : Nx = INT(128 * (Tx) / (di - (Tz))) + 160
    : : Ny = INT(100 - (128 * Ty) / (di - (Tz)))
    : :
    : : 'calc color
    : : ac = a + 1
    : : cc = ABS(FIX((Tz + 128) / 4)) + d(a).c * 64
    : :
    : : 'move particle
    : : SELECT CASE am
    : : CASE 0'palette color
    : : PSET (d(a).Bx, d(a).By), 0
    : : d(a).Bx = Nx
    : : d(a).By = Ny
    : : PSET (Nx, Ny), cc
    : : CASE 1'palette color with flash
    : : PSET (Nx, Ny), cc
    : : PSET (d(a).Bx, d(a).By), 0
    : : d(a).Bx = Nx
    : : d(a).By = Ny
    : : CASE 2'smoke (need to be at least a million i think)
    : : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
    : : d(a).Bx = Nx
    : : d(a).By = Ny
    : : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : : CASE 3'smoke with flash
    : : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
    : : d(a).Bx = Nx
    : : d(a).By = Ny
    : : CASE 4'smoke trail (use space to clear)
    : : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
    : : d(a).Bx = Nx
    : : d(a).By = Ny
    : : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : : CASE 5'smoke trail with flash
    : : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
    : : d(a).Bx = Nx
    : : d(a).By = Ny
    : : END SELECT
    : :
    : : IF ap THEN COLOR 63: PRINT Nx; Ny; Tz; cc
    : : NEXT
    : : ap = 0
    : : LOOP[/code]
    : : I've done another one with the microuniverse.
    : : It got a whole lot of more forces(I couldn't
    : : make the weak nuclear force).
    : : [b]===============================[/b]
    : : El PROgrammador [b]Niklas Ulvinge[/b]
    : :
    : :
    : Well - this is just a 3d prog - not an engine! I just asked because it was hard to me trying to imagine that a 3D engine is possible in QBASIC without assembly.
    :
    : ****************
    : Any questions? Just ask!
    :
    : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    :
    :
    :
    If you develop this a little and make
    it better it will be a 3D engine.
    But it will have a framerate around
    0.03 fps.

    I made an enginge that could only do
    some easy block and surfaces thingys
    and then I stoped becouse it was really
    to slow.
    [b]===============================[/b]
    El PROgrammador [b]Niklas Ulvinge[/b]

  • GaashiusGaashius Posts: 349Member
    : : : : (And IDK I should take a look at your BASIC 3d engine...if you don't
    : : : : mind)
    : : :
    : : : It's just dot's.
    : : : When I tried to
    : : : extend it it was
    : : : to slow. (1 frame
    : : : took 30 seconds!!
    : : :
    : : : Here's the code anyhow.
    : : : It's preatty cool.
    : : : [code]3DUNIVE2.BAS:
    : : :
    : : : DEFINT A
    : : : DEFSNG B-Z
    : : : TYPE threeDdot
    : : : x AS SINGLE
    : : : y AS SINGLE
    : : : z AS SINGLE
    : : : c AS INTEGER
    : : : Bx AS SINGLE
    : : : By AS SINGLE
    : : : dx AS SINGLE
    : : : dy AS SINGLE
    : : : dz AS SINGLE
    : : : mas AS SINGLE
    : : : END TYPE
    : : : di = 100 'distance
    : : : num = 100 'number of particles
    : : : ss = .1 'start stepsize
    : : : SCREEN 13
    : : : 'palette
    : : : OUT &H3C8, 0
    : : : FOR a = 0 TO 63
    : : : OUT &H3C9, a
    : : : OUT &H3C9, a
    : : : OUT &H3C9, a
    : : : NEXT
    : : : FOR a = 0 TO 63
    : : : OUT &H3C9, a
    : : : OUT &H3C9, 0
    : : : OUT &H3C9, 0
    : : : NEXT
    : : : FOR a = 0 TO 63
    : : : OUT &H3C9, 0
    : : : OUT &H3C9, 0
    : : : OUT &H3C9, a
    : : : NEXT
    : : : FOR a = 0 TO 63
    : : : OUT &H3C9, a
    : : : OUT &H3C9, a
    : : : OUT &H3C9, 0
    : : : NEXT
    : : :
    : : : 'declare and init matrix
    : : : DIM d(num) AS threeDdot
    : : : FOR a = 1 TO num
    : : : d(a).x = RND * 128 - 64
    : : : d(a).y = RND * 128 - 64
    : : : d(a).z = RND * 128 - 64
    : : : d(a).c = RND * 3
    : : : d(a).mas = RND + .0001
    : : : NEXT
    : : : 'main loop
    : : : DO
    : : : 'keys
    : : : a$ = UCASE$(INKEY$)
    : : : IF a$ = "A" THEN xa = xa + ss
    : : : IF a$ = "D" THEN xa = xa - ss
    : : : IF a$ = "W" THEN ya = ya + ss
    : : : IF a$ = "S" THEN ya = ya - ss
    : : : IF a$ = "Q" THEN za = za + ss
    : : : IF a$ = "E" THEN za = za - ss
    : : : IF a$ = "M" THEN am = am + 1
    : : : IF am > 5 THEN am = 0
    : : : IF a$ = "+" THEN di = di + ss * 10
    : : : IF a$ = "-" THEN di = di - ss * 10
    : : : IF a$ = "," THEN ss = ss + .01
    : : : IF a$ = "." THEN ss = ss - .01
    : : : IF a$ = "I" THEN ap = 1: 'get info of particles
    : : : IF a$ = " " THEN CLS
    : : : IF a$ = CHR$(27) THEN END
    : : : 'calc fps and print approximately info on screen every second
    : : : fps = fps + 1
    : : : IF TIMER - t > 1 THEN t = TIMER: COLOR 63: LOCATE 1, 1: PRINT fps; CINT(ss * 100) / 100; CINT(di); CINT(xa * 100) / 100; CINT(ya * 100) / 100; CINT(za * 100) / 100; am: fps = 0
    : : :
    : : : 'particle loop
    : : : FOR a = 1 TO num
    : : : 'universe calculations
    : : : 'move particle
    : : : d(a).x = d(a).x + d(a).dx
    : : : d(a).y = d(a).y + d(a).dy
    : : : d(a).z = d(a).z + d(a).dz
    : : : 'calc gravity force for each particle on each particle
    : : : FOR b = 1 TO num
    : : : IF NOT (b = a) THEN
    : : : r = (d(a).x - d(b).x) ^ 2 + (d(a).y - d(b).y) ^ 2 + (d(a).z - d(b).z) ^ 2
    : : : d(b).dx = d(b).dx + (d(a).x - d(b).x) / r * (d(a).mas / d(b).mas) / 100
    : : : d(b).dy = d(b).dy + (d(a).y - d(b).y) / r * (d(a).mas / d(b).mas) / 100
    : : : d(b).dz = d(b).dz + (d(a).z - d(b).z) / r * (d(a).mas / d(b).mas) / 100
    : : : END IF 'star(a).mas * star(b).mas / r
    : : : NEXT
    : : :
    : : : 'calc coordinates
    : : : Ty = ((d(a).y * COS(xa)) - (d(a).z * SIN(xa)))
    : : : Tz = ((d(a).y * SIN(xa)) + (d(a).z * COS(xa)))
    : : : Tx = ((d(a).x * COS(ya)) - (Tz * SIN(ya)))
    : : : Tz = ((d(a).x * SIN(ya)) + (Tz * COS(ya)))
    : : : Ox = Tx
    : : : Tx = ((Tx * COS(za)) - (Ty * SIN(za)))
    : : : Ty = ((Ox * SIN(za)) + (Ty * COS(za)))
    : : : 'adjust coordinates to screen
    : : : Nx = INT(128 * (Tx) / (di - (Tz))) + 160
    : : : Ny = INT(100 - (128 * Ty) / (di - (Tz)))
    : : :
    : : : 'calc color
    : : : ac = a + 1
    : : : cc = ABS(FIX((Tz + 128) / 4)) + d(a).c * 64
    : : :
    : : : 'move particle
    : : : SELECT CASE am
    : : : CASE 0'palette color
    : : : PSET (d(a).Bx, d(a).By), 0
    : : : d(a).Bx = Nx
    : : : d(a).By = Ny
    : : : PSET (Nx, Ny), cc
    : : : CASE 1'palette color with flash
    : : : PSET (Nx, Ny), cc
    : : : PSET (d(a).Bx, d(a).By), 0
    : : : d(a).Bx = Nx
    : : : d(a).By = Ny
    : : : CASE 2'smoke (need to be at least a million i think)
    : : : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
    : : : d(a).Bx = Nx
    : : : d(a).By = Ny
    : : : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : : : CASE 3'smoke with flash
    : : : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : : : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
    : : : d(a).Bx = Nx
    : : : d(a).By = Ny
    : : : CASE 4'smoke trail (use space to clear)
    : : : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
    : : : d(a).Bx = Nx
    : : : d(a).By = Ny
    : : : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : : : CASE 5'smoke trail with flash
    : : : PSET (Nx, Ny), POINT(Nx, Ny) + 1
    : : : PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
    : : : d(a).Bx = Nx
    : : : d(a).By = Ny
    : : : END SELECT
    : : :
    : : : IF ap THEN COLOR 63: PRINT Nx; Ny; Tz; cc
    : : : NEXT
    : : : ap = 0
    : : : LOOP[/code]
    : : : I've done another one with the microuniverse.
    : : : It got a whole lot of more forces(I couldn't
    : : : make the weak nuclear force).
    : : : [b]===============================[/b]
    : : : El PROgrammador [b]Niklas Ulvinge[/b]
    : : :
    : : :
    : : Well - this is just a 3d prog - not an engine! I just asked because it was hard to me trying to imagine that a 3D engine is possible in QBASIC without assembly.
    : :
    : : ****************
    : : Any questions? Just ask!
    : :
    : : :-) [b][blue]GAASHIUS[/blue][/b] :-)
    : :
    : :
    : :
    : If you develop this a little and make
    : it better it will be a 3D engine.
    : But it will have a framerate around
    : 0.03 fps.
    :
    : I made an enginge that could only do
    : some easy block and surfaces thingys
    : and then I stoped becouse it was really
    : to slow.
    : [b]===============================[/b]
    : El PROgrammador [b]Niklas Ulvinge[/b]
    :
    :
    It is also hard to imagine that it's a 0.03 fps engine. QBASIC is not a language for 3D libraries. By the way, Visual Basic is also a good choice for beginners after learning the "flat" BASIC.

    ****************
    Any questions? Just ask!

    :-) [b][blue]GAASHIUS[/blue][/b] :-)


«1
Sign In or Register to comment.