News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

PlayBasic V1.64N (Work In Progress) Gallery

Started by kevin, April 06, 2011, 12:50:14 AM

Previous topic - Next topic

kevin





PlayBasic V1.64N  (Work In Progress) Gallery (April 06, 2011)


  This upgrade was released (19th,Nov,2011)


    This thread will document the changes being made for the PlayBASIC 1.64 revision N.




Upgrade History


    For newer upgrade work in progress see,


     See  PlayBASIC V1.64P2 (revision 2)

    See  PlayBASIC V1.64P (login required)   -     Convert PlayBASIC To Machine Code Dll's

    See  PlayBASIC V1.64O

    See  PlayBASIC V1.64N2 / V1.64N3


    For older upgrade work in progress see,

    See  PlayBASIC V1.64M

    See  PlayBASIC V1.64L Learning Edition History (Building learning Edition Thread)

    See  PlayBASIC V1.64L







PlayBASIC V1.64N  Beta #1 -SplitToArray Flags

    Since we've had optional parameters in PB now for a while, one  of the VM2/ VM1 differences was that SplitToArray() didn't auto reject null length strings, which caused a few headache moving to older PB code to run in the newer edition, so it was reverted.  Now with optional parameters this ability has been included again, plus a few changes.  Namely with how of if the fragments should be trimmed..


 eg.


PlayBASIC Code: [Select]
      a$="asas ,, bbb ,  "
Dim Stuff$(0)
ShowIt(a$,0) ; allow null length strings and no trims
ShowIt(a$,1+2+4) ; Default
ShowIt(a$,2) ; Left trim + allow null length strings
ShowIt(a$,4) ; right trim + allow null length strings
ShowIt(a$,1+2) ; Left trim + allow null length strings
ShowIt(a$,1+4) ; right trim + allow null length strings

sync
waitkey


Function ShowIt(s$,Flags)
print "------------------------------"
print "Flags"+Str$(Flags)
Count=SplitToArray(s$,",",Stuff$(),0,Flags)
print "Count:"+Str$(COunt)
for lp=0 to Count-1
Print ">>>"+Stuff$(lp)+"<<<"
next

EndFunction








outputs


------------------------------
Flags0
Count:4
>>>asas <<<
>>><<<
>>> bbb <<<
>>>  <<<
------------------------------
Flags7
Count:2
>>>asas<<<
>>>bbb<<<
------------------------------
Flags2
Count:4
>>>asas <<<
>>><<<
>>>bbb <<<
>>><<<
------------------------------
Flags4
Count:4
>>>asas<<<
>>><<<
>>> bbb<<<
>>> <<<
------------------------------
Flags3
Count:2
>>>asas <<<
>>>bbb <<<
------------------------------
Flags5
Count:3
>>>asas<<<
>>> bbb<<<
>>> <<<






kevin

#1
 PlayBASIC V1.64N - Beta1 - Insert$()

 In one of the V1.64M there was a few subtle changes to the string expression optimizer, while generally these changes are for the better, there's a few situations where they could break.  Insert$() was one of them.  So I've taken some time this morning to iron out those by products.  The logic changes give the function even bang for the buck..  Can't we complain about that.  


 Requires PB1.64N

PlayBASIC Code: [Select]
   max=50000

Do
cls
frames++
t=timer()
For lp=0 to Max
b$="abcde"
a$="01234567890123456789"
c$=insert$(a$,b$,10)
next
tt1#+=timer()-t
print c$
print tt1#/frames
t=timer()
For lp=0 to Max
b$="abcde"
a$="01234567890123456789"
a$=insert$(a$,b$,10)
next
tt2#+=timer()-t
print a$
print tt2#/frames

a$="1234512345"
a$=insert$(a$,a$,5)
print a$

Sync
loop




 Speed wise this test (while fairly bogus) runs about %25 faster in V1.64N than older editions.



PlayBASIC V1.64N - Beta1 - Replace$()

  replace is another that befits from the optimizer, but could also run into troubles.  Which have been ironed out now.  



PlayBASIC Code: [Select]
   max=50000



Do
cls
frames++
t=timer()
b$="*dude*"
For lp=0 to Max
a$="111yeahyeahyeahyeahyeah222"
c$=replace$(a$,"yeah",b$)
next
tt1#+=timer()-t
print c$
print tt1#/frames
t=timer()
b$="*dude*"
For lp=0 to Max
a$="111yeahyeahyeahyeahyeah222"
a$=replace$(a$,"yeah",b$)
next
tt2#+=timer()-t
print a$
print tt2#/frames


t=timer()
b$="dud"
For lp=0 to Max
a$="111yeahyeahyeahyeahyeah222"
c$=replace$(a$,"yeah",b$)
next
tt3#+=timer()-t
print c$
print tt3#/frames
t=timer()
b$="dud"
For lp=0 to Max
a$="111yeahyeahyeahyeahyeah222"
a$=replace$(a$,"yeah",b$)
next
tt4#+=timer()-t
print a$
print tt4#/frames


a$="1234512345"
a$=insert$(a$,a$,5)
print a$

Sync
loop







 Speed wise this test runs about 8-10% faster than V1.64L


kevin

#2
PlayBASIC V1.64N Optional Parameters

     We ran this survey during the last update, didn't get a single response..    Basically here we're looking for ideas from users as some optional parameter additions.

    (Don't post your ideas here)  Rather  add them to the  ->  User base survey of optional parameter additions for PlayBASIC V1.64M (login required)  



PlayBASIC V1.64N Beta 1 - Make$()  

  Fine tuning some of the older string functions.  Been picking over a rather elaborate make$() replacement method, which is generally (much) faster, but it's a lot more code.  Where a few refinements to the original method give a health improvement.  


PlayBASIC Code: [Select]
   Dim T#(100)

global num=10000
global Tests=100
Global Frames

Do

Cls
frames++

char$="(12345)"
Index=1
For lp=1 to 4
Test(Index,Char$)
Index++
Char$++
next

Test(Index,"Z")

Sync
loop

Function Test(Index,Char$)

print "-----------------------"
print "Make$ ="+char$
t=timer()
for lp=0 to tests
b$=Make$(char$, num)
next
t#(index)+=(timer()-t)
print t#(index)/frames
print left$(b$,100)
print Len(b$)
print ""

EndFunction





 Edit:  Tweaked the Make$() function again, this revision is about *2 quicker than the one from this afternoon.



PlayBASIC V1.64N Beta 1 - Instring() Tweaks  


PlayBASIC Code: [Select]
   Dim T#(100)

global num=10000
global Tests=10000
Global Frames

Do

Cls
frames++

b$=make$(" ",Tests)+char$

Buffer$=make$("Z",10)+"-abcd"
char$="ABCDE"
Index=1
For lp=1 to 10
Test(Index,Buffer$+Char$,lower$(Char$))
Index++
Buffer$++
next


Sync
loop

Function Test(Index,Buffer$,Char$)

print "-----------------------"
t=timer()
for lp=0 to tests
Pos=instring(buffer$,char$,1,1)
next
t#(index)+=(timer()-t)
print t#(index)/frames
print "Position="+Str$(Pos)
print "Len="+Str$(Len(buffer$))


EndFunction







PlayBASIC V1.64N Beta 2 - Replace() Tweaks  


PlayBASIC Code: [Select]
   Dim t#(100)

global Frames
global max=10000

Do
Cls
Frames++

a$="AA--AA--"
for lp=0 to 9
TestIt(a$,lp)
a$++
next

Sync
loop


Function TestIt(a$,Index)
print "================================="
t=timer()
For lp=0 to max
s$=replace$(a$,"AA","12")
next
t#(index)+=Timer()-t
print t#(index)/frames
print "Len"+Str$(len(s$))
print left$(S$,100)
EndFunction





kevin


  PlayBASIC V1.64N  Beta #3 -Screen Layout

    Added a new command to reposition the PB graphics display inside the host window.   While not necessarily something most people will need to use, it will come in handy if you need to place something else , such as windows GUI controls or video streams on the PB window also. Which would otherwise have to fight for display precedence.   

    Been testing running some full screen video, which seems to work ok..



kevin


PlayBASIC V1.64N  Beta #5 - Some String Bugs

      Fixed a simple underflow bug in mid$() function, it seems that it's been there for years too.  It's sad how such things but just never get reported. Another issue was found in the PAD$() function.  Thankfully that one's caused from some recent expression optimizer changes found in V1.64M2 & V1.64N revisions, fixed now though.     

kevin


PlayBASIC V1.64N  Beta #6 - Catching Up On Some Bugs

     Been hammering away at catching up on bugs found in the V1.64M, although many of the expression issues date back to V1.64L revision.   Bit of a mixed bag for what's been looked at this time around with the focus being largely on fix ups, rather than introducing anything new.  There are some speed tweaks with some of the pixel strip copy/translates routines and even a few tweaks with the Point/DOT functions for 32bit surfaces, which win back a few ticks in the brute force tests.   Can't imagine that translating into noticeable gains in regular every day programs though.   The opt's are really only made to help some of the built in image processing functions deal better with the amount of raw pixel data, in particular when grabbing a map blocks.    Would love to thread some of those routines but that seems bit too risky with how the engine handles the current surface, as the user would have to mange the surface and thread state.   Can't imagine that being too successful. 

     Only planning on spending a few days on this release, so I wouldn't be too surprised to see a Release candidate in the near future. 

Big C.

QuoteOnly planning on spending a few days on this release, so I wouldn't be too surprised to see a Release candidate in the near future.
Posted on: July 13, 2011, 02:15:23 PM
Posted by: kevin

I hope with integrated new IDE so I don't have to set all settings new every time I fire it up  ;)

stevmjon

i'd say the next release should be a pretty stable version.

looking forward to it.

  stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin

QuoteI hope with integrated new IDE so I don't have to set all settings new every time I fire it up

   nope.

kevin

#9
PlayBASIC V1.64 N BETA #8 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)

     PlayBASIC V1.64 N  Beta #8  is final test build of upcoming PBV1.64N retail upgrade.          This revision is mostly (in not entirely) about addressing some of the 1.64M/V1.64L bugs mixed with a good layer of fine tuning.  



Download


      PlayBASIC V1.64N Beta 8 (login required)


kevin

#10
 PlayBASIC V1.64N  Beta #9 - Internal Sub-Menu Linking In Documentation

   Pretty much downed tools on V1.64N a few days ago, so the focus has shifted from programming to another documentation pass.   Writing the documentation is easily the hardest thing about building this project really,  so far i've been working on making sure that recent changes from the V1.64M and V1.64N revisions are in the documentation, expanding them as required.    The documentation is build using a custom editor, it's not pretty, but it works..

   However, there's still lots of little tidbits missing,  couple of the noticeable tags omissions are for pictures and menus.   Both are simple to add really, but then you've got to go utilize  them through the docs.   Would love to have more pictorial representation in the tutorials area for example, but I doubt i'll have time during this pass.  

  The sub menu stuff was easier to add and insert into the tutorial pages.  Basically it's just a set of tags that you add to headlines and the parser builds a linked menu of subjects within the page.   The menu is just a list of links for the time being,  will tinker with the layout later..

  Bellow is little picture of what i'm talking about.  So on the long pages, you can skip directly to section you want.  


Tabled Sub-Menus In Documentation

     Updated to builder to use a template for the sub menu indexes, easier to read the heading when they're not all centered all over the place.  (pic #2)


kevin

#11
PlayBASIC V1.64 N BETA #9 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)

     PlayBASIC V1.64 N  Beta #9   - This is pretty much the final..



Download


       Old file removed


kevin


PlayBASIC V1.64 N BETA #10  Opt's with Line Draw Modes

     Had this idea (ages ago) for a way to improve the speed of Line drawing when using the blend draw modes,  so gave it a bit of run tonight.  Took a little of bit tinkering to set up, but the results are pretty pleasing.   I'm using the Shape Tunnel example as the test bed and so the improvements give around a 8->10fps boost to draw modes like Alpha Blend, Alpha 50, Alpha Addition, Alpha Subtraction/ Invert Subtraction and Alpha Multiply in 32bit modes.     

kevin

#13
  PlayBASIC V1.64N BETA #10  - Image Processing Opt's

      Been looking over the image processing library and the first thing that becomes apparent is how generic routines are.  It's nice to keep work horse routines as small as possible, but smaller doesn't generally translate into fast.   Most of these routines work on a pixel in -> pixel out level, so there's lots of call overhead among other things.   However, since those routines were written (which seems like an eternity ago now) there's now a collection of strip based routines that could be used,  Which would get rid a lot dead time without much effort..

     So the first routine I've been looking is the fade image filler.   Initially the routine would fade the 1024 * 802 (32bit) image in 30/31 milliseconds,  which isn't too bad really,  but figured it could be better by swapping from pixels to strips,  and hey presto..  it's now doing the same job in 15.4..  The bets thing about the change is the process routine is still generic, it's just batching the pixel fetches.    Not too sure this can be applies across the all image processing functions, but it most seem compatible with it.

     Testing Function on 1024 * 802 (32bit) image

     Results Table  (   Function name,  original time, new time)

     fadeIMage             30/31ms  = 15/16ms
     grayscaleimage      34/35ms  = 17/18ms

kevin

#14
  PlayBASIC V1.64N BETA #11  - Image Processing Opt's Continued

     Got some free time so i'm looking at the phong shading routines, which currently are pulling square root per pixel.   Given the test image is 1024*802, it only take around 81 milliseconds to do the whole thing (That's 821248 square roots).   Pretty much doubled the performance with a little shuffle of the routine though.    

    Testing Function on 1024 * 802 (32bit) image

    Results Table  (   Function name,  original time, new time)

    RenderPhoneIMage             80/81ms  = 42/43ms
    LightImage                    82/83ms  = 41/42ms   (fall of rate of 0.23  LightImage  img_copy,x,y,255,0.23)


    ScaleIMage  (linear)  scaling 1024*802 to 800* 600
                                     11/12ms  = 15/16ms

    ScaleIMage  (bi-linear)  scaling 1024*802 to 800* 600
                                     25/26ms  = 19/20ms




 CopyImage

     Been looking the copy image function, the problem with such a function is that it pretty much allocates and de allocates the surface every time,  resulting in a pretty big over head.   A better method would be to create images of the same size and type, then rather copy A to B,  draw A onto B..  

      Example.  

PlayBASIC Code: [Select]
   Width=1024
Height=800
IMg=NewFXIMage(Width,Height)

Img_Copy=GetFreeImage()

rendertoimage img

For lp =0 to 200
x=rnd(width)
y=rnd(Height)
circlec x,y,rnd(100),true,rndrgb()

next


rendertoscreen

do
Cls

; CopyIMage Img,Img_Copy

CopyIMageFaster(Img,Img_Copy)

drawimage img_Copy,0,0,false

print fps()

Sync
loop


Psub CopyIMageFaster(SrcImg,DestImg)
CopyIt=0

if GetIMageStatus(DestImg)=false
CopyIt=true
else

State=GetImageWidth(SrcImg)=GetImageWidth(DestImg)
State+=GetImageHeight(SrcImg)=GetImageHeight(DestImg)

if State=2
surface=getsurface()
drawimage SrcIMg,0,0,false
rendertoimage surface
else
CopyIt=true
endif

endif

if CopyIt
CopyIMage SrcIMg,DestImg
endif

EndPsub