0.12.10 SmallBASIC update
#1
Hi all,

I have just started checking out new update of SmallBASIC. 

First surprise, there is a SmallBASIC 64.exe version.

2nd surprise voxel, I am running the demo from samples:
Code:
#https://github.com/s-macke/VoxelSpace
map = {
 height:[]
 col:[]
}

camera = {
x:        512, rem x position on the map
y:        800, rem y position on the map
height:   178, rem height of the camera
angle:     10, rem direction of the camera
horizon:   10, rem horizon position (look up and down)
distance: 1200  rem distance of map
}

sub init
 local i,x,y,datac,datah
 local sz = 1024 * 1024

 map.col = seq(-0xFF007050, -0xFF007050, sz)
 map.height = seq(0, 0, sz)
 
 local imageDir = "resources/"
 i = image(imageDir + "C1W.png")
 i.save(datac)
 i = image(imageDir + "D1.png")
 i.save(datah)

 local k = 0
 for y = 0 to 1023
   for x = 0 to 1023
     map.height[k] = -datah[y,x] band 0xff
     map.col[k] = datac[y,x]
     k++
   next j
 next i

end

sub render
 local screenwidth = xmax
 local sinang = sin(camera.angle)
 local cosang = cos(camera.angle)
 local hiddeny = seq(0, 0, screenwidth)
 local i,dz,z,plx,ply,prx,pry,dx,dy
 local mapoffset,y1,y2,invz

 for i = 0 to xmax - 1
   hiddeny[i] = ymax
 next i

 dz = 1
 color 0,rgb(135, 205,250)
 cls
 #  Draw from front to back
 for z = 55 to camera.distance step dz
   #  90 degree field of view
   plx =  -cosang * z - sinang * z
   ply =   sinang * z - cosang * z
   prx =   cosang * z - sinang * z
   pry =  -sinang * z - cosang * z
   dx  = (prx - plx) / screenwidth
   dy  = (pry - ply) / screenwidth
   plx += camera.x
   ply += camera.y
   invz = 1 / z * 240.0
   for i = 0 to screenwidth - 1
     mapoffset = ((floor(ply) band 1023) lshift 10) + (floor(plx) band 1023)
     y1 = (camera.height - map.height[mapoffset]) * invz + camera.horizon
     y2 = hiddeny[i]
     if (y1 <= y2) then
       line i, y1, i, y2, map.col[mapoffset]
       hiddeny[i] = y1        
     endif
     plx += dx
     ply += dy
   next i
   dz+=.3
 next z
 showpage
end

sub moveLeft
 camera.angle += .1
 render
end

sub moveRight
 camera.angle -= .1
 render
end

sub moveBack
 camera.x += 20 * sin(camera.angle)
 camera.y += 20 * cos(camera.angle)
 render
end

sub moveForward
 camera.x -= 20 * sin(camera.angle)
 camera.y -= 20 * cos(camera.angle)
 render
end

init
render

while 1
 select case inkey
 case "a"
   moveLeft
 case "f"
   moveRight
 case "w"
   moveForward
 case "s"
   moveBack
 end select
wend


Attached Files Thumbnail(s)

B += x
Reply
#2
Looking at this sample, I have a shipload of questions about this SmallBASIC sample. It is so loaded with new or unfamiliar stuff.

So far I've figured the landscape was made "3D" from two .png resource files. One is a top view for coloring and the other is B&W for heights I bet, the lighter the color the higher the 3d rendering? see attachments

But what is this in code?
Code:
map = {
 height:[]
 col:[]
}

camera = {
x:        512, rem x position on the map
y:        800, rem y position on the map
height:   178, rem height of the camera
angle:     10, rem direction of the camera
horizon:   10, rem horizon position (look up and down)
distance: 1200  rem distance of map
}

It looks like JS or Python.


Attached Files Thumbnail(s)

B += x
Reply
#3
Well Mark
I think that you must ask author
Reply
#4
Yo Mark
I found new version better than older.. i mean it looks that editor
somehow work better...
also i am really impressed with example
rocherer.bas ......amazing!

by the way if is not problem
or i dont get it again how to log in sb forum
/!"!$#"$#% /

do you maybe can as chris about electromagnetic solver
i ask here about patch antennas maybe he have ide how to do that in SmallBasic
?
Reply
#5
Hi Aurel,

I have never heard any clue that Chris is Electronics Engineer, but you can ask, if you want.

Here is a snap of the Home Page at SmallBASIC, I am surprised you can't find Log-in ???
Even if you start a post and forgot to log-in, you would be quizzed for the usual things plus a very simple arithmetic test like 0 + 2 = ? to answer correctly.

There is even a link underneath in case you did forget your password.

"rocherer.bas" ? don't remember seeing that sample, I will look for it.


Attached Files Thumbnail(s)

B += x
Reply
#6
Aurel must mean recherche.bas from samples:

EDIT: Code removed as it is suspected the author did not wish to share it (it has also has been removed from SB samples).

Not bad for B&W in 40 lines. The still screen shot may be misleading...


Attached Files Thumbnail(s)

B += x
Reply
#7
Yeah that one
it is really cool, by the way there is no need to be electronic engineer to know
how to work with formulas ..right?
you, me anyone use them a lot in many graphic programs ..right?

yeah i know how to login because i am member but i cannot login for some strange reason
ok i will try again...
Reply
#8
Mark
this is what i get when i try to login on sb forum:

-The website encountered an unexpected error. Please try again later.

Chris know that or ?
Reply
#9
Hi Aurel, 

Of course you've tried again later, what then?

I have a new laptop and was able to get SmallBASIC forum access and accept my user name and password.

BTW, that site is not as easy to find as The Joyful Programmer site on the Internet.
B += x
Reply
#10
that site is not as easy to find as The Joyful Programmer site on the Internet.

-yeah reason is because is irelevant to MS Small basic which have large user
or supporter base than SmallBasic
which .what i can say from the past was never very popular in BASIC population
why ? i dont know?
Reply
#11
@Everyone,

How are you looking up The Joyful Programmer?

I like to find out if people are looking up The Joyful Programmer in a way other than typing, "The Joyful Programmer" into Google.
Dedicated to empowering computer programming hobbyists, tinkerers, amateurs, and enthusiasts.
profile for Walter Whitman at Stack Overflow, Q&A for professional and enthusiast programmers


Reply
#12
SmallBASIC 0.12.10 has been updated to 0.12.11 due to problem found with sound in new version of SDL.
B += x
Reply