(http://underwaredesign.com/PlayBasicSig.png)
PlayBasic V1.64N (Work In Progress) Gallery (April 06, 2011)
This upgrade was released (19th,Nov,2011) (http://www.underwaredesign.com/forums/index.php?topic=1774.msg24884#msg24884)
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) (http://www.underwaredesign.com/forums/index.php?topic=4089.msg28500#msg28500)
See [plink]PlayBASIC V1.64P (http://www.underwaredesign.com/forums/index.php?topic=4089.0)[/plink] - Convert PlayBASIC To Machine Code Dll's (http://www.underwaredesign.com/?l=PlayBASIC-To-DLL-Development-Blog)
See PlayBASIC V1.64O (http://www.underwaredesign.com/forums/index.php?topic=3988.0)
See PlayBASIC V1.64N2 / V1.64N3 (http://www.underwaredesign.com/forums/index.php?topic=3833.0)
For
older upgrade work in progress see,
See PlayBASIC V1.64M (http://www.underwaredesign.com/forums/index.php?topic=3440.0)
See PlayBASIC V1.64L Learning Edition History (http://www.underwaredesign.com/forums/index.php?topic=3405.0) (Building learning Edition Thread)
See PlayBASIC V1.64L (http://www.underwaredesign.com/forums/index.php?topic=3364.0)
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.
[pbcode]
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
[/pbcode]
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<<<
>>> <<<
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
[pbcode]
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
[/pbcode]
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.
[pbcode]
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
[/pbcode]
Speed wise this test runs about 8-10% faster than V1.64L
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 -> [plink]User base survey of optional parameter additions for PlayBASIC V1.64M (http://www.underwaredesign.com/forums/index.php?topic=3441.0)[/plink]
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.
[pbcode]
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
[/pbcode]
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
[pbcode]
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
[/pbcode]
PlayBASIC V1.64N Beta 2 - Replace() Tweaks
[pbcode]
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
[/pbcode]
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..
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.
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.
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 ;)
i'd say the next release should be a pretty stable version.
looking forward to it.
stevmjon
QuoteI hope with integrated new IDE so I don't have to set all settings new every time I fire it up
nope.
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
[plink]PlayBASIC V1.64N Beta 8 (http://www.underwaredesign.com/forums/index.php?topic=1150.msg24817#msg24817)[/plink]
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)
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
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.
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
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.
[pbcode]
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
[/pbcode]
PlayBASIC V1.64 N BETA #11 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)
PlayBASIC V1.64 N Beta #11 - This one includes the latest optimizations mainly focusing on the image library.
Download
Deleted
PlayBASIC V1.64N BETA #12 - DrawShape Opt's Continued
While looking over the line routines -> draw shape routines last week (or whenever that was) there was noticeable early rejection option missing from the line mode. So that's been tacked back in, giving around another 10fps back on the tunnel demo. In fact anything that uses lots of shape drawing in line mode will get a win...
[pbcode]
#include "BlitIMage"
screen=NewFxIMage(GetScreenWidth(),GetScreenHeight())
CreateFxImageEX Screen,GetScreenWidth(),GetScreenHeight(),32
rings =300
RingSize# =800
FarDepth# =20000
NearDepth# =10
me=NewConvexShape(RingSize#,64)
Edges=GetShapeEdges(me,0)*rings
ClsColour=rgb(50,50,50)
Do
rendertoimage Screen
; CLs ClsColour
Cls $405060
ink $405060
mx=getscreenwidth()/2
my=getscreenheight()/2
thisrgb=rgb(50,20,210)
thisrgb= $ffffff
zstep#=(NearDepth#-FarDepth#)/Rings
near=0
far=fardepth#
inkmode 1+ 64;4096
inkalpha 0.50+cos(Angle#)*0.50
Angle#=wrapangle(Angle#+1)
projection#=400
lockbuffer
For lp=0 to rings
x#=cos(angle#+lp*2)*455
y#=sin(angle#+lp)*255
z#=FarDepth#+(lp*zstep#)
ProjectedSize#=(RingSize#*projection#)/z#
Scale#=ProjectedSize#/RingSize#
rotateshape me,Angle#+(lp*10),Scale#
sx#=mx+((x#*projection#)/z#)
sy#=my+((y#*projection#)/z#)
ColourScale=255-(250*(z#/far))
ink RgbAlphaMult(ThisRgb,rgb(ColourScale,ColourScale,ColourScale))
; DrawShape me,sx#,sy#,2
ink $0a0a0a
DrawShape me,sx#,sy#,1
next
unlockbuffer
inkmode 1
rendertoscreen
setcursor 0,0
ink rgb(255,255,255)
angle#=wrapangle(Angle#,1)
BlitImageClear screen,0,0,ClsColour
print fps()
print edges
Sync
loop
[/pbcode]
PlayBASIC V1.64N BETA #12 - Cleaned Mappy Library
The Mappy loader is as old as the hills and has some code that was not longer compatible, so been cleaning up of the code today and dropped in support for loading the blocks as a different video format. So bellow we have the old animated map demo running as FX formatted map
PlayBASIC V1.64 N BETA #13 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)
PlayBASIC V1.64 N Beta #13 - This revision contains all the latest optimizations, updated Help Files and the mappy slib.. If it runs ok out there then this is will be it.
Download
Old beta removed.
So everything is running as expected ??? If so, then i can build the upgrade
SetShapeVertex work now 0,1,2 instead 1,2,3
[pbcode]
CreateShape 1,3,3
SetShapeVertex 1,1,50,-60
SetShapeVertex 1,2,150,260
SetShapeVertex 1,3,-150,460
SetShapeEdge 1,1,0,1
SetShapeEdge 1,2,1,2
SetShapeEdge 1,3,2,3
DrawShape 1,400,300,2
Print GetShapeVertexX(1,1)
Print GetShapeVertexY(1,1)
Print GetShapeEdge(1,1,0)
Print GetShapeEdge(1,1,1)
Print GetShapeEdge(1,2,0)
Print GetShapeEdge(1,2,1)
Print GetShapeEdge(1,3,0)
Print GetShapeEdge(1,3,1)
Sync
WaitKey
[/pbcode]
That's actually an older change, where many of the inclusive / inclusive media ranges, became inclusive / exclusive.
So creating a shape with 3 vertex original creates 4 of them, 0,1,2,3... Now it's 0,1,2
i am sorry =/
Well, it would seems the VERTS and EDGES use different rules... But I might let that one slide for the time being
PlayBASIC V1.64N is Released - Read Upgrade Announcement (http://www.underwaredesign.com/forums/index.php?topic=1774.msg24884#msg24884)
Just updated. and testing stuff I made.
I wonder how much better some of my older programs will run now. most of the stuff I make is sprite and image heavy.