Quantcast
Channel: Small Basic
Viewing all 201 articles
Browse latest View live

Small Basic – 3D Visualisation

$
0
0

Introduction

This blog is about a 3D visualisation extension that has been available in the LitDev extension for a few years now.

3D rendering can be complex, but once the basics of 2D movement, events and structured programming are mastered in Small Basic, the leap into 3D is not so great.  I have tried to keep the number of methods in the LD3DView object as few as possible, while providing sufficient power to achieve impressive results.

The visualisation is rendered inside the GraphicsWindow like all other LD extension controls or shapes (using the AddView method), so the 3D visual region itself can be resized, moved or even rotated like any other shape.  This allows you to add buttons or other controls inside the GraphicsWindow and use the GraphicsWindow mouse and key events.

3D in Small Basic is not going to achieve the performance or features of modern 3D games, but you can quickly gain an understanding of the ideas that are used in these games and with careful programming create immersive and very playable games or other applications.

Coordinates in 3D

The space where objects in a 3D model exist is called the scene.  It has 3 directions X, Y and Z that do not correspond to pixel positions.  Like the 2D view in Small Basic X increases from left to right, but Y increases upwards, and Z increases from far to near.  This is called a ‘right handed system’.

Objects in the scene are positioned, scaled or rotated using world coordinates (X,Y,Z).

axes

Rendering

What we actually see on our screen is not 3D, the screen is flat (2D) so the program has to work out what we see and display it for us.  This is called rendering and depends on several things.  While the maths of how this is actually done will help an understanding it is not essential.

Firstly we need objects positioned in the scene, we also need lights to see anything and we need to know where the observer is positioned and which direction they are looking.

Mathematically these occur in stages called the rending graphics pipeline.  We will take a look at the main elements needed to render a scene in turn.

Objects

These are things we will see.  They are described by vertices and elements.

The vertices are just points (X,Y,Z) defined in a local coordinates, and the elements are lists of vertices that are joined to form surfaces.

The local vertex coordinates are just describing the object, not where or how it is positioned within the scene.  The centre of the object is defined to be at (0,0,0) in its local coordinates.

The order in which the vertices are listed determines the outer and inner surface of the object (i.e. the outward normal direction).  This is not important when getting started but the renderer uses this information to not display hidden surfaces known as back face culling.  The order or winding used is counter-clockwise for outer direction.

The simplest object is a triangle, but usually objects consist of many triangles called a mesh.  Initially, the most difficult part of 3D programming is creating complex meshes, but there are many other software programs available to help create these.

mesh

A typical mesh

In this extension, I have provided some methods (using a 3rd partly library HelixToolkit) to directly create the meshes for Spheres (AddSphere), Tubes (AddTube) and import meshes (LoadModel) from some popular file types.  However, it is an important part of 3D programming to understand how meshes are formed so I have not abstracted mesh generation away in methods to just do it for you.

Pretty cool effects can be achieved with fairly simple meshes and I will show how to create a mesh for a cube using AddGeometry.

A mesh will often have additional properties like colour, image or how it reacts to light.  A mesh with these properties is called a geometry.

There are several other methods to manipulate geometries, AddImage, ModifyObject, CloneObject, Freeze and ReverseNormals.

ReverseNormals sets the inside of the geometry to be visible instead of the outside.  This can be used with a very large sphere or cube to create a horizon image in the distance of your world in all directions.  This simple but very effective technique is called a skydome or skybox.

Lights

To see diffuse material geometries we need lights.  Emissive materials don’t require lights, they emit their own colours or images.  Lights are just special objects positioned in the scene.  There are several types of light, created using the methods AddAmbientLight, AddDirectionalLight, AddSpotLight and AddPointLight.  All lights have a colour.

lighs

Ambient light

An ambient light lights all objects equally, we often set it to a low intensity (grey colour).

Directional light

A directional light fills the scene from one direction.  It is assumed to be infinitely far away, and can be used for example like sunlight.

Spot light

A spotlight is also directional, but also has a position, limited lighting cone and range.

Point light

A point light is not directional, but does have a set position and limited range.

World transformations

This is the first step of the render pipeline.

Once we have an object geometry in local coordinates we can to transform it to world coordinates.  This just means position it in the scene.  So if we want 20 cubes, they can all have the same geometry, but are transformed differently into the scene.

There are 3 transformations; rotate, scale and translate.

Rotate

The rotate methods are RotateGeometry, RotateGeometry2 and AnimateRotation

Rotate about the shape centre by an angle.  The rotation is about an axis line, just like the earth rotating about its axis.

earth

Scale

The scale method is ScaleGeometry.

This is just like zoom, but you can zoom in 3 directions.

Translate

The translate methods are TranslateGeometry and AnimateTranslation.

This is just like move, but you can move in 3 directions.

Camera

The second step of the render pipeline is to calculate how everything is lit and this depends on where the observer is and what direction they are looking.

The camera defines how the scene is observed.

The ResetCamera method sets the position, view direction as well as set the up direction, usually (0,1,0).

The MoveCamera method allows you to move forwards or backwards in the view direction, as well as turn the view direction using yaw, pitch and roll angles.  Note that these can change the up direction.

yawpitchroll

The methods GetCameraPosition and GetCameraDirection can be useful to determine where you are in the scene if the camera is being moved with MoveCamera.

Projection

The final step of the render pipeline is to transform the observed view to pixels that are displayed on screen.

Some camera options can affect this, such as the angle of view (like telephoto or wide angle lenses) which determines perspective.  These properties are set using CameraProperties.

Geometries

As an example we create a cube.  It has 8 vertices and 6 faces, with each face consisting of 2 triangles, so there are 12 triangular elements.

We want the centre of the cube to be at (0,0,0) and it is usual to make it with edges of unit length so it is easy to scale in world coordinates.

cube

Therefore the vertex coordinates are:

  • V0=(-0.5,-0.5,0.5)
  • V1=(-0.5,-0.5,-0.5)
  • V2=(0.5,-0.5,-0.5)
  • V3=(0.5,-0.5,0.5)
  • V4=(-0.5,0.5,0.5)
  • V5=(-0.5,0.5,-0.5)
  • V6=(0.5,0.5,-0.5)
  • V7=(0.5,0.5,0.5)

The 2 face triangles on the bottom face (counter clockwise winding when viewed looking at the face) are indexed by 3 vertices.

  • 0:1:3
  • 1:2:3

Note that the vertices are indexed from 0.  This is not normally how we do things in Small Basic, but since you may create index lists using external software I chose to stick to this convention in this case.

The other triangles are:

  • 4:7:5 (top)
  • 5:7:6 (top)
  • 0:3:4 (front)
  • 3:7:4 (front)
  • 1:5:2 (back)
  • 2:5:6 (back)
  • 0:4:5 (left)
  • 0:5:1 (left)
  • 3:6:7 (right)
  • 2:6:3 (right)

Materials

We can set a colour for the geometry and we can set whether it is emissive or diffusive.  Emissive just shows the colour and diffusive requires lights to show the colour in combination with light colours.

The following code creates a LightBlue coloured diffusive cube.

Note the use of colon and space deliminators, rather than using arrays – this was to make it easier to create and add geometries in single lines since this is how you might obtain this data from external mesh generation software.  I didn’t use a comma deliminator since in some localisations this is interpreted as a decimal point.

vertices = “-0.5:-0.5:0.5 -0.5:-0.5:-0.5 0.5:-0.5:-0.5 0.5:-0.5:0.5 -0.5:0.5:0.5 -0.5:0.5:-0.5 0.5:0.5:-0.5 0.5:0.5:0.5”
indices = “0:1:3 1:2:3 4:7:5 5:7:6 0:3:4 3:7:4 1:5:2 2:5:6 0:4:5 0:5:1 3:6:7 2:6:3”
cube = LD3DView.AddGeometry(view,vertices,indices,“”,“LightBlue”,“D”)

 

It is also possible to map one or more images onto a mesh and set emissive, diffusive and specular components separately.  This requires setting texture coordinates to map the image onto the mesh.

A small example

We use the cube defined above and add some lights and keyboard movement control:

  • animate a continual rotation for the cube
  • add 4 directional coloured lights
  • move the cube left, right, up and down with the arrow keys
  • move the camera forwards and backwards with W and S keys
  • yaw the camera left and right with A and D keys
‘Create the GraphicsWindow
gw = 600
gh = 600
GraphicsWindow.Width = 600
GraphicsWindow.Height = 600
GraphicsWindow.BackgroundColor = “DarkBlue”
‘Create the 3D scene
view = LD3DView.AddView(gw,gh,“True”)
LD3DView.ResetCamera(view,0,0,8,0,0,1,0,1,0)
LD3DView.AddDirectionalLight(view,“Red”,1,0,1)
LD3DView.AddDirectionalLight(view,“Green”,1,0,1)
LD3DView.AddDirectionalLight(view,“Blue”,1,0,1)
LD3DView.AddDirectionalLight(view,“Yellow”,1,0,1)
MakeCube()
LD3DView.AnimateRotation(view,cube,0,1,1,1,360,10,1)
x = 0
y = 0
z = 0
‘Game loop to handle user interaction
While (“True”)
  ‘Move cube
  If (LDUtilities.KeyDown(“Left”)) Then
    x = x0.1
  ElseIf (LDUtilities.KeyDown(“Right”)) Then
    x = x+0.1
  EndIf
  If (LDUtilities.KeyDown(“Up”)) Then
    y = y+0.1
  ElseIf (LDUtilities.KeyDown(“Down”)) Then
    y = y0.1
  EndIf
  LD3DView.TranslateGeometry(view,cube,x,y,z)
  ‘
  ‘Move camera
  yaw = 0
  pitch = 0
  roll = 0
  move = 0
  If (LDUtilities.KeyDown(“W”)) Then
    move = 0.1
  ElseIf (LDUtilities.KeyDown(“S”)) Then
    move = 0.1
  EndIf
  If (LDUtilities.KeyDown(“A”)) Then
    yaw = 1
  ElseIf (LDUtilities.KeyDown(“D”)) Then
    yaw = 1
  EndIf
  LD3DView.MoveCamera(view,yaw,pitch,roll,move)
  ‘
  Program.Delay(20)
EndWhile
Sub MakeCube
  vertices = “-0.5:-0.5:0.5 -0.5:-0.5:-0.5 0.5:-0.5:-0.5 0.5:-0.5:0.5 -0.5:0.5:0.5 -0.5:0.5:-0.5 0.5:0.5:-0.5 0.5:0.5:0.5”
  indices = “0:1:3 1:2:3 4:7:5 5:7:6 0:3:4 3:7:4 1:5:2 2:5:6 0:4:5 0:5:1 3:6:7 2:6:3”
  cube = LD3DView.AddGeometry(view,vertices,indices,“”,“LightBlue”,“D”)
EndSub

 

The video display below is a bit jumpy due to video file size limits, not the Small Basic rendering.

Implementation in Small Basic

The 3D Extension is written using the .Net object Viewport3D and uses the 3rd party library HelixToolkit for some mesh generation methods.

Hit test

The HitTest method allows you to find a geometry and its distance to the camera from GraphicsWindow cooordinates (e.g. mouse position to target missiles or to select an object).

Additional links

Examples

3D game

An example 3D game capturing cones in a maze that comes with the LitDev extension download (3D-samples/LD3DMazeGame.sb).

cones

Mesh import

An example mesh import with a skydome that comes with the LitDev extension download (3D-samples/LD3DViewImport.sb).

import


Small Basic – International Resources Update 2016

$
0
0

This is an update summary of a TechNet Wiki article Small Basic: International Resources.  The asterisk (*) marks are new from February 2015.

Language IDE Dictionary* Reference Guide Curriculum Wiki Blogs Collections* Books Videos Twitter Wikipedia* Communities
Arabic
Chinese (Simplified) ✔* ✔*
Chinese (Traditional) ✔*
Croatian
Czech ✔*
Dutch ✔*
English ✔* ✔* ✔*
Finnish* ✔*
French ✔* ✔* ✔*
German ✔* ✔*
Greek
Hebrew ✔*
Hindi
Hungarian
Icelandic
Italian ✔* ✔*
Japanese ✔* ✔* ✔* ✔*
Korean ✔* ✔*
Persian ✔*
Polish
Portuguese (Brazil) ✔*
Portuguese (Portugal)
Russian ✔*
Spanish ✔*
Turkish ✔*
Ukrainian* ✔*

Book Review: “Learn to Program with Small Basic”– from Middle and Senior School Teacher in Australia, Susan Nicholson

$
0
0

We’re proud to get some great feedback from an experienced schoolteacher! The guest author of this blog post is Susan Nicholson.

Susan Nicholson is a Business and Computing Teacher at Ellenbrook Secondary College in Ellenbrook, West Australia. She teaches grades 7-12 on computer science and robotics.

===================

 

In teaching computer programming fundamentals to Middle and Senior School students, I feel the examples and exercises given in “Learn to Program with Small Basic” provide a fun and informative way of delivering the concepts.

Examples of games, relating to science and maths enables students to apply real world scenarios to their programming and make it realistic. I found the book easy to read and follow; the examples are clear and well explained.

The use of colour coding and visuals enables students to easily follow on and gives them the confidence to try themselves.

– Susan Nicholson, Middle and Senior School Teacher

 

===================

 

Learn to Program with Small Basic (Amazon)

An Introduction to Programming with Games, Art, Science, and Math
by Dr. Majed Marji and Ed Price

May 2016, 304 pp.
ISBN: 978-1-59327-702-4
Full Color

Small Basic Art with Turtle

$
0
0

I think we can create a lot of art with Turtle.  Following list is a sample.

GraphicsWindow.Title = "Turtle Randome Drawing"
GraphicsWindow.BackgroundColor = "Black"
gw = 598
gh = 428
xo = gw / 2
yo = gh / 2
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.PenWidth = 1
GraphicsWindow.PenColor = "LightGray"
Turtle.Speed = 10
Turtle.X = xo
Turtle.Y = yo
distance = 20
For i = 1 To 10000
  angle = Math.GetRandomNumber(360)
  _angle = Math.GetRadians(angle)
  x = Turtle.X + distance * Math.Sin(_angle)
  y = Turtle.Y - distance * Math.Cos(_angle)
  r = Math.SquareRoot((xo - x) * (xo - x) + (yo - y) * (yo - y))
  If r <= (gh / 2 - 20) Then
    red = Math.GetRandomNumber(128)
    green = Math.GetRandomNumber(255)
    blue = 255
    GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(red, green, blue)
    Turtle.Angle = angle
    Turtle.Move(distance)
  EndIf
EndFor

Screen shot of a program Turtle Random Drawing

How do you feel?

Small Basic Guru Winners – May 2016

$
0
0

All the votes are in! 

And click here for all the results for the TechNet Guru Awards, May 2016 !!!!

We want to thank Philip and Nonki for some great articles in May!

 

Guru Award  Small Basic Technical Guru – May 2016 
Gold Award Winner  Philip Munts Small Basic: Simpler and Cheaper Raspberry Pi GPIO Michiel Van Hoorn: “This is really Awesome (see also the original article). It opens up Small Basic to the real world. ”
Ed Price: “Building off his Raspbery Pi article, this article does an amazing job of digging deeper and showing you more options, such as Rasperry Pi Zero.”
Silver Award Winner  Nonki Takahashi Small Basic: Image Michiel Van Hoorn: “Really cool overview of working with Images (like photos) in SmallBasic. We good topic to inspire programming”
Ed Price: “Very thorough end to end overview of usig Images!”

 

More about the TechNet Guru Awards:

 

Have a Small and Basic week!

– Ninja Ed

Small Basic – Talking to Raspberry Pi

$
0
0

This blog is about communicating with a Raspberry Pi using Small Basic.

I summarise a Gold Medal award winning TechNet Wiki article by Philip Munts.  Follow the links to see Philip’s original article and second follow up article.

Raspberry Pi

The Raspberry Pi is a small cheap computer.  It has no keyboard, monitor or other usual computer peripherals so is an ideal candidate to communicate with using Small Basic.

pi

Raspberry Pi Model A+

Summary of Connection

Since the Pi is a fully working computer in its own right, the connection is really a connection between 2 computers.

As Philip says there are several ways this can be achieved (for example using a serial port), but the method he selected doesn’t even need an extension.  It uses the Small Basic Network object.

network

Network.GetWebPageContents(url) allows Small Basic to send a message to a networked computer and receive text data that the networked computer returns.

The network url can be a local home network IP address like 192.168.1.99 or http://familyPC or an internet address http://www… 

The return from GetWebPageContents is some text.  For a web url this would be the html used by a browser (Edge, Chrome, Firefox etc) to display a web page.

The clever part is getting the Raspberry Pi to respond to a web request in a useful way.  This is achieved by installing a special linux operating system on the Pi that runs a Thin Server.  The Thin Server allows the Pi to act like a basic web server responding to web requests.  Philip provides a zip download and instructions to perform this step.

Philip then uses GPIO (General Purpose Input Output) pins on the Pi to control LEDs that can be controlled by commands sent from Small Basic.

Once this is set up you can communicate with the Pi from Small Basic and can set and get the status of the GPIO pins, in his example turning LEDs on and off.

To quote Philip’s article:

The web server running on the GPIO Thin Server responds to requests of the following forms:

http://servername:8083/GPIO/ddr/n,s Set data direction (0=input, 1=output)

http://servername:8083/GPIO/get/n Get pin (state 0=OFF, 1=ON)

http://servername:8083/GPIO/put/n,s Put pin (state 0=OFF, 1=ON)

The commands are read by the Pi and either perform some action or return some data.

Philip’s second follow up article shows how to achieve the same results using a cheaper Raspberry Pi variant.  Both articles are clear and provide detailed descriptions of the component parts and step-by-step procedures to achieve the connection.

See Also

Small Basic and the Raspberry Pi

Simpler and Cheaper Raspberry Pi GPIO for Small Basic

About Raspberry Pi

Small Basic – Arduino

TechNet Guru awards

Small Basic – Stripes Sample

Small Basic July Challenges – Rotating Text, Chain with Physics, Polygon Shapes, and the Snake Game Challenge!

$
0
0

You can enter the challenge here:

https://social.msdn.microsoft.com/Forums/en-US/e0606b7b-bd23-45b5-9339-abefe62cf42d/challenge-of-the-month-july-2016?forum=smallbasic

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using Small Basic.  Some will be easy, some will be hard – but they will all make you think, and more importantly be GREAT FUN!

Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain ‘sticky’ for the month.  The only rule is that your solution must use standard Small Basic methods (no extensions).

It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

We may extend these challenges over into a second month if solutions and questions are still coming in.


Graphics Challenge

Create some text that rotates in a circle

text-in-a-circle

Physics Challenge

Make a chain by joining small balls that moves realistically when you drag an end with the mouse

Maths Challenge

Create a subroutine to draw 3, 4, 5… sided regular sided polygon shapes with equal area or equal total perimeter

Game Challenge

Create an axon type game.  See http://axon.wellcomeapps.com

Community Suggestions

  • Code Sample (By Nonki) – LINK
  • Snake game (By AbsoluteBeginner) – LINK
  • JUPITERs moons (ByYLed) – LINK
  • Names database (By martmen) – LINK
  • Auto Loan Calculator (By YLed) – LINK

 

Nokia Snake 3.11: Check out this version of the snake game commonly ...

Do you have an idea for a future challenge? Please post it here!

 

We look forward to seeing your solutions in the forum thread:

https://social.msdn.microsoft.com/Forums/en-US/e0606b7b-bd23-45b5-9339-abefe62cf42d/challenge-of-the-month-july-2016?forum=smallbasic

 

The Snake Game is going to be a fun one, and we already have one version:

https://social.msdn.microsoft.com/Forums/en-US/e8fb0677-020b-4dac-9e30-4c7c65f922aa/a-suggestion-to-challenge-of-the-month?forum=smallbasic

 

Small and Basically yours,

LitDev and…

Ninja Ed


Small Basic Extension – Micro Maestro Servo Controller

$
0
0

Today’s guest blogger is Zock77

Zock77's avatar

Pololu’s Micro Maestro Servo Controller

Hey guys! I just got a maestro servo control board and hooked it up to the Oculus with Smallbasic! It works really well!

The control board:Z

If anyone wants the extension to control the servo board from SB, you can download it here:

MaestroServoController

The six-channel Micro Maestro is a serial servo controller with a native USB interface and internal scripting control. It includes 0.25μs resolution with built-in speed and acceleration control, a general I/O controller (e.g. to interface with a sensor or ESC via your USB port), and header pins.

To read more about how Zock uses this extension, including in combination with his Oculus Rift extension, see:

 

Special thanks to Zock77 for building these great extensions!

Small and Basically yours,

– Ninja Ed

Here, have a turtle.

$
0
0

Here, have a turtle.

FlappyTurtle

Boom. That’s a turtle.

– Ninja Ed

Small Basic – Case-Insensitive

$
0
0

Small Basic is case-insensitive.  But how?

Following characters have upper and lower case.

  • Latin (ex. A, a)
  • Greek (ex. Β, β)
  • Cyrillic (ex. Д, д)
  • Armenian (ex. Ե, ե)

Following texts are case-insensitive.  And other texts are case-sensitive.

  • array index
  • color name
  • dictionary word
  • file path (excluding URL)
  • flickr tag
  • logical value

See Also

 

Small Basic Gurus needed for July!

$
0
0

Come forth all you technical Small Basic gurus and word wizards!

It’s time to show us what you’ve got, what you know, what you found out!

Spare your fellow professionals from the same mistake!

Share your revelations and awesome ways of doing things!

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day’s work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations to TechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you’ve contributed)

3) Every month, we will highlight your contributions, and select a “Guru of the Month” in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once “on our radar” and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

June’s entries are with our judges right now, but here is a reminder of the previous month’s Small Basic Guru winners.

 

Guru Award  Small Basic Technical Guru – May 2016 
Gold Award Winner Philip Munts Small Basic: Simpler and Cheaper Raspberry Pi GPIO Michiel Van Hoorn: “This is really Awesome (see also the original article). It opens up Small Basic to the real world. ”
Ed Price: “Building off his Raspberry Pi article, this article does an amazing job of digging deeper and showing you more options, such as Raspberry Pi Zero.”
Silver Award Winner Nonki Takahashi Small Basic: Image Michiel Van Hoorn: “Really cool overview of working with Images (like photos) in SmallBasic. We good topic to inspire programming”
Ed Price: “Very thorough end to end overview of using Images!”

 

That’s it! Have a Small and Basic day!

Ninja Ed   and…

Pete Laker

 

Small Basic Featured Programs – Multi-Colored Spirals

$
0
0

In the June Challenges, LitDev included a great Graphics Challenge:

Graphics Challenge:

  • Draw a multi-coloured spiral

 

And the challenge began!

Coding Cat started us off on June 1st:

I love the graphics challenge. It turns out I wrote a double spiral program as one of my first forays into Small Basic. :-)

Import code: QSP181

Spiral01 Spiral02

The thickness of the line, and angle of the turns are chosen at random at the start of each spiral.

Next came a version from Pappa Lapub:

Another spiral, ID: WNV073 (However, LitDev’s image looks better)

Spiral03

Then LitDev entered the fray:

Couldn’t resist having a go, KCK850.

This later reminded Mr. Monkeyboy of yarn and a slide ruler:

I did something similar with yarn and cardboard and elmers glue in the 7th grade. Won the art class art project “challenge”. Back then a PC was an abacus or slide rule.

Slide rule image. I believe the Smithsonian Institution has some of these.

NaochanON joined the party:

Graphics Challenges

This is a Ferma’s spiral  QSF666   

And all those contributions were on June 1st!

Then, on June 2nd, YLed contributed a spiral:

Beautiful !!!

could not resist… me too, so

i took the litdev spiral version and added some modifications:

KCK850-0

But YLed was not done:

ANIMATED version, of a PULSE SPIRAL, litdev spiral modification 2

that’s fun !!!

KCK850-1

Next came Tryhest:
nice wrk nao))
a small update: infinite rotating hypnotic spiral: QSF666-0
and changing color version also: QSF666-1
NaochanON responded:

Tryhest   nice!

but I feel faint!!

Then YLed unleashed the rainbow:

now litdev KCK850 with a full rainbow colors:

ZLP862

Yled also returned with a Turtle-tastic version of a rainbow spiral:

the       R A I N B O W    S P I R A L

Here is MY version of the spiral challenge :  PROGRAM :  PND589

it’s a very Small code,

with the Turtle: ( takes 1-2 minutes to draw )

And all that was on the second day of June! Next spiral was on June 11th…

Nonki Takahashi joined the spiral smackdown:

This is another rainbow spiral: BDX376.

Screen shot of a program Spiral 0.11

So there you go! That’s a whole lot of June Spirals! And guess what! That was only part of the June challenges thread! Read the whole thing here:

https://social.msdn.microsoft.com/Forums/en-US/f7b62609-6994-48e1-b353-8de4b278ec16/challenge-of-the-month-june-2016?forum=smallbasic

 

Have a day! Not just any day… have a small and basic one!

– Ninja Ed

Small Basic – Gather Code Samples

$
0
0

When I started to learn BASIC, there was a reference manual which has a simple sample code for each statement.

LET

The picture above is a page of the manual.  For each statement [Function], [Syntax], [Versions], [Description], [Example] are described.  Especially, the sample codes were very useful to learn BASIC.

But for Small Basic, there is not simple sample code for each operation/property/etc..  So, I’d like to suggest everyone here to write sample codes for any operations/properties and so on that you like.

Please post your code or program ID into following forum thread.

July Challenge Suggestion – Code Sample

I’m going to write a TechNet Wiki article to curate them.

Small Basic – Traditional Patterns

$
0
0

Do you know any traditional patterns in your country?  In Japan, there are a lot of patterns.  Today I introduce some of them.  If you can decompose a pattern into some shapes (such like rectangles, ellipses, triangles or lines), you can code to draw the pattern.

Yagasuri
Yagasuri (矢絣) – designed feathers of arrows

Asanoha
Asanoha (麻の葉) – designed leaves of cannabis

Seikaiha
Seigaiha (青海波) – designed sea waves


Small Basic – Exploring New Logos – Part 1

$
0
0

In the Small Basic team, we have a great designer, Ram, who is helping us explore new logos.

Please keep in mind that these logos are currently being used for internal Microsoft projects. We aren’t finished yet.

That said/written, we welcome your feedback! Please leave a comment below!

Here is our current logo:

Logo_CurrentSBLogo

Our Small Basic Community Council member, Liam had a fantastic futuristic version that modernizes the ideogram/symbol:

Logo_SmallBasic_444x144_LiamMcSherry

Small Basic carries on the Logo turtle graphics tradition, and so we wanted to combine that into our new logo. Our first version of that centered on four colors, to map into the Microsoft windows ideogram:

Logo01_Round4Colors

The next version focused on the blue and green (since red and yellow was in the text and line on the right):

Logo02_Pentagon2Colors

The next experiment was to see how it looked with the original building-block pastel colors:

Logo02a_Current3Pastels

That was a little bright and cheerful. =^)

Next we looked at some mixes of the Microsoft colors again. Here the emphasis is on red and yellow:

Logo02b_MSColors-RedYellow

And here the emphasis is on red and green:

Logo02c_MSColors-RedGreen

And this one focuses on green and blue:

Logo02d_MSColors-BlueGreen

And this one focuses on yellow and blue:

Logo02e_MSColors-YellowBlue

And next it was up for something a bit different. This one pushes more back to the Microsoft logo’s ideogram/symbol:

Logo03_4OuterScales

That one looks a little bit target like, and we wanted the turtle aspect. Here is a version of that, with the “SB” in white:

Logo04_GrayBorders

And here it is with the “SB” in black:

Logo05_WhiteBorders

And that leads us to where we’re currently at! Next we’ll play with the text part on the right some more.  Regardless, we’re getting some great use out of it at Microsoft! Special thanks go out to Ram.

Please leave a comment with your thoughts!

 

Small and Basically yours,

– Ninja Ed

Small Basic – Downloading the LitDev Extension

$
0
0

So, I was downloading the LitDev extension for Small Basic onto a new computer, and I thought I’d blog about it while it was fresh in my mind! =^)

If you haven’t tried the LitDev extension, you’re depriving yourself of awesome!

 

Here’s the API Reference: http://litdev.org/LitDev.html

 

Here are some highlights of objects/classes in the extension you should try out:

  1. LD3DView – Bring the capabilities for a full 3D graphics engine into Small Basic! So cool!
  2. LDPhysics – Boom! Bring on the game physics!
  3. LDController – Now you can use videogame controllers (USB gamepads and joysticks) to play the games you make!
  4. LDDebug – Hack together some basic debugging tricks! Debug the small and basic way!
  5. LDWaveForm – Remote controlled objects can be programmed by your Small Basic programs! No way? Yes way!
  6. LDWebCam – Now you can see! With your webcam.

And there’s a lot more! Head to  http://litdev.org/LitDev.html to try them all!

Got a favorite that should be mentioned here? Leave a comment!

All this in one extension!

So how do you install this beauty?

http://litdev.org/index.html#Usage

You’ll likely want the latest version on the top here, but you can install the beta version to try out whatever LitDev and others are currently combobulating.

After you download the files, you’ll want to unzip the files and move them:

As with all Small Basic extensions, copy the extension dll and xml (inside the dll zip) to a lib sub-folder of the Small Basic installation folder, usually in one of the following locations:

C:\Program Files\Microsoft\Small Basic\lib
C:\Program Files (x86)\Microsoft\Small Basic\lib

You may require to create the lib folder if it doesn’t exist.

The instructions then show you how to unblock the DLL file:

If the extension commands fail to appear in Small Basic (type LD and no options appear) then you may need to unblock the downloaded dll.  Right click LitDev.dll and select Properties and clear the block if present.  If it fails to unblock, then copy LitDev.dll to a folder where you have write access (e.g. Documents), unblock it there and then move back to the Small Basic lib folder.  Alternatively, unblock the downloaded zip file before unzipping the content.

I just had all those problems. So I’d follow the instructions/steps like this:

  1. Install the LitDev zip file from here.
  2. Save it somewhere. Unzip it.
  3. Copy/move the DLL file and the two XML files into the Small Basic extension folder. I think the “Lib” folder is automatically created in version 1.2 (because it houses the Kinect files). For me, the extension folder was: C:\Program Files (x86)\Microsoft\Small Basic\lib
  4. You can try the “Unblock” troubleshooting steps above, but I had the worst scenario for unblocking the DLL file, so I’d start with that… Cut/Move the LitDev.dll file into your Documents folder.
  5. Right-click the DLL file and click Properties.
  6. In the Properties window, click “Unblock” at the bottom in the Security section (see image above). Click OK to close the window. At this point, you can re-open the window to double-check. You know that it worked if the “Unblock” option is now gone (under the Attributes section).
  7. Cut/move the LitDev.dll file back into the Small Basic “Lib” folder.
  8. Run Small Basic with LitDev objects to test it. Import “ZPX036” and click Run. Or, as another test, type “LD” and you should see the LitDev objects in the IntelliSense wheel.

Once you’re up and running, check out the LitDev documentation to dig in:

http://litdev.org/index.html#LitDev Extension Documentation

As you can imagine, LitDev and many supporting developers put a lot of thought and effort into this extension. So if this is your first time trying out the extension, please leave a comment here, and join me as we thank LitDev for all the goodness we can enjoy!

 

Small and Basically yours,

– Ninja Ed

Small Basic – Draw Moon Quiz

$
0
0

I’d like to introduce a new game program Draw Moon Quiz (BNN571).

A moon picture is displayed on left.  So, select patterns on top and type the sequence on the bottom text box then push [Draw] button.  There are 8 questions.  Have fun!

DrawMoon

Flag of Brazil drawn with Small Basic

$
0
0

Rio Olympics have been started!

Today I’ll show you a program to draw a flag of Brazil (NCF628).

Screen shot of a program Flag of Brazil 0.21

One of the challenges last month was rotating text.  This program has the function.   To draw rotating text, each character width in pixel is needed.  To get the widths, I used another program NJB522-0.

Enjoy Olympics!

See Also

Small Basic – Design Your Original Car

$
0
0

To draw a car with Small Basic is not so difficult.  Why don’t you draw your own car?

RedCar

Program sample above is KFF238.

Viewing all 201 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>