NEWS ARTICLES


PlayBASIC V1.65C Beta 39 - It LIVES

PlayBASIC V1.65C Beta 39 - It LIVES

     Just wanted to say that this morning the new build process finally sprang to life, after a number of trouble shooting sessions. This means that the current build includes the ironed out new APP format (localized) and it's new startup sequence. Long story short, this mean the runtime can be built into the release and debug editions and thus exe's can be built, but they work.

    There's still some missing things from the APP format such as a replacement of the initial properties, which were a binary hunk in the original byte code, but could be replaced with either a text version or default startup function appended to the user code. Something like the latter will need to done at some point, but I'm in no rush with that.

    Now what ? Well, it means we head into a clean up phase in order to build a release build from the V1.65C code bases, stuff like cleaning out legacy code & debug code from the runtimes. It'll need some testing in the wild that's for sure and there's some compiler features that are not present in v1.65 at all, but it's working and that's all I care about today...Tomorrow is another day!

    Have fun !

PlayBASIC Tutorial: Intro To Functions - (2018-07-06)

PlayBASIC Tutorial: Intro To Functions - (2018-07-06)

     Hi welcome to our Intro to Functions tutorial. In this tutorial we start out with some revision of Gosub / Return statements, which are used to create a simple sub routine. Sub routines are changes in program flow, allowing the programmer to execute a chunk of code that's external to the section they may be writing, then upon completion the control returns to the caller. This is the same basic model that functions introduction to our programming, except functions are more formalized. Meaning they have some strict rules about syntax and intro a new concepts such as scope changes, which sub routines don't have.

The types of functions shown in video are very simple, initially we start by taking a sub routine that prints rows of text and convert that to function. Through this process we encounter our first problem which is variable scope and look at ways to solve it, such as making our variable global, or better yet passing a variable into the function as a parameter . Later in the video, we create our own custom distance function, as well building a function that does some simple string manipulation

NOTE: This video was recorded alive with only a few changes for length..




Example Code:
PlayBASIC Code:
      print ProcessString( "-------Hello World-------")
         print ProcessString( "    1234     " )
         

         Dist# = CustomDistance( 100,100,700,300)
         
         print dist#


         for lp =0 to 10
               Print_Lines_function( lp )         
         next
         print "--------------------------------------------------"
         
         sync
         waitkey
   
         end      
      



function Print_Lines_function( LoopCounter )
         print "--------------------------------------------------"
         print "Loop Counter="+str$(LoopCounter)
endfunction 

         
         
Function CustomDistance( X1#,Y1# , X2#,Y2#)
   
         DX# = abs(X1#-X2#)
         DY# = abs(Y1#-Y2#)
         
         DistResult# = sqrt( DX# * DX# + Dy# * DY#)   
   
EndFunction DistResult#

         
         
Function ProcessString( MyString$)   

         MyString$ = trim$(MyString$,"-")

         MyString$ = Replace$( MyString$," ","~" )

EndFunction MyString$
COMMANDS USED: PRINT | SYNC | WAITKEY | STR$ | ABS | SQRT | TRIM$ | REPLACE$ |



Links:

     Get Source Code Example For This Tutorial

PlayBASIC Tutorial: From Arrays To Types (Intro To Types)

PlayBASIC Tutorial: From Arrays To Types (Intro To Types) - (2018-06-12)

    This tutorial picks up where the previous variables to arrays tutorial left off, in that it takes the array code, demos that code then we set about converting the parallel array approach shown in the previous tutorial and we build a structure (TYPE) to hold each characters properties. Once the type has been defined that includes all the required properties, we then define a typed array that will house the collection of characters. Later in the video take a look at using typed lists also. So if your struggling with types this could be a good place to start.



Example #1 - Converting the Parallel Arrays To Typed Array

PlayBASIC Code:
   Setfps 20

   Number_Of_Characters = 50

   type tCharacter
         Xpos#
         Ypos#
         Xspeed#
         Yspeed#
         Colour
         Size
   endtype


   dim Characters(Number_Of_Characters) as tCharacter 

   
   for lp = 1 to Number_Of_Characters

         ;  Allocate a newe tCharacter and place it's handle
         ;  into the Character(lp) array / container at this position         
         Characters(lp) = new tCharacter
                  
         Characters(lp).Xpos  = rnd(800)
         Characters(lp).Ypos  = rnd(600)
         Characters(lp).Size  = rndrange(16,50)
         Characters(lp).Xspeed = rndrange(-5, 5)
         Characters(lp).Yspeed = rndrange(-5,5)
         Characters(lp).Colour = rndrgb()
         
   next
   
  
  //-------------------------------------------------------
  //---[ MAIN LOOP ]---------------------------------------
  //-------------------------------------------------------
   
  do 
     
        Cls rgb(0,400,20)
        
        for lp = 1 to Number_Of_Characters
           Radius = Characters(lp).Size
            x#=Characters(lp).Xpos
            y#=Characters(lp).Ypos
   

           circlec X#,Y#,Radius,true,Characters(lp).Colour
                    
           x# = wrapvalue(x# + Characters(lp).Xspeed , -Radius, 800 + Radius)
           y# = wrapvalue(y# + Characters(lp).Yspeed , -Radius, 600 + Radius)
          
           Characters(lp).xpos= x#
           Characters(lp).ypos= y#             
        next
          
        Sync
     loop
COMMANDS USED: SETFPS | DIM | NEW | RND | RNDRANGE | RNDRGB | CLS | RGB | CIRCLEC | WRAPVALUE | SYNC |



Example #2 - Converting Typed Array To Typed List

PlayBASIC Code:
   Setfps 20

   Number_Of_Characters = 50

   type tCharacter
         Xpos#
         Ypos#
         Xspeed#
         Yspeed#
         Colour
         Size
   endtype


   dim Characters as tCharacter  list 

   
   for lp = 1 to Number_Of_Characters
      
         Characters = new tCharacter
                  
         Characters.Xpos  = rnd(800)
         Characters.Ypos  = rnd(600)
         Characters.Size  = rndrange(16,50)
         Characters.Xspeed = rndrange(-5, 5)
         Characters.Yspeed = rndrange(-5,5)
         Characters.Colour = rndrgb()
         
   next
   
  
  //-------------------------------------------------------
  //---[ MAIN LOOP ]---------------------------------------
  //-------------------------------------------------------
   
  do 
     
        Cls rgb(0,400,20)
        
        for each Characters()
           
           Radius = Characters.Size
            x#=Characters.Xpos
            y#=Characters.Ypos
   

           circlec X#,Y#,Radius,true,Characters.Colour
                    
           x# = wrapvalue(x# + Characters.Xspeed , -Radius, 800 + Radius)
           y# = wrapvalue(y# + Characters.Yspeed , -Radius, 600 + Radius)
          
           Characters.xpos= x#
           Characters.ypos= y#             
        next
          
        Sync
     loop
COMMANDS USED: SETFPS | DIM | LIST | NEW | RND | RNDRANGE | RNDRGB | CLS | RGB | CIRCLEC | WRAPVALUE | SYNC |




Links:

    * PlayBASIC Tutorial: From Arrays To Types (Intro To Types) Source Code

5000 cubes - PS3D Software Rendering

5000 cubes - PS3D Software Rendering

     This a updated capture of the PS3D demo, only difference is this version is running in PlayBASIC V1.65C and object count is bumped up.. It's all software rendering of course, affine texture mapping, so think PlayStation One style scene..




Learn More
Read the Work In Progress (Thread)

Ideas For Making a game Video Series

PlayBASIC Live: Making a Game series - So what type of game prototype ??

I would like to make some more video series that show hands on, line by line coding of a game.. but what game(s) would be interesting ??

The thing to consider is the series need to be interesting enough for people to want to watch, not require tones of media, or if so, there's enough free media packs out there that we can use to build a working prototype and supply the media to user so they can 'see' how things are used..


Related Links:

- Rygar Arcade

PlayBASIC Video Blog Ep #0006 (2017-12-09)


Visit the thread to add your ideas what types of games we should make for our tutorial series