Main Menu

exe crashes

Started by monkeybot, July 10, 2013, 12:44:46 PM

Previous topic - Next topic

monkeybot

my program runs fine from the IDE but when i create an exe i get error

warning fatal run time error
number:(1) at line:(1)
error caused by :if

lines 1-5 are remmed statements and the next line (6) is

#include "savebitmap"

confused?




kevin


and the version is ? 


monkeybot

ah yes,sorry.

i have tried with 1.64 beta 0 16

and 1.64N3d2

kevin

Quotei have tried with 1.64 beta 0 16

it can't work with this, none the runtimes are supplied for it..  it sounds like your install now might have mismatched compiler->runtimes,  which definitely won't work. 


I doubt the issue with caused by the SaveBitmap include, since it only contain a single function.    Really without the code to go through becomes a just guessing game.. 


monkeybot

I have tried re-installing the retail  release and patched to latest update but no luck,can i send you the source so you can see what's going on kevin?

kevin


Email Support (login required)


monkeybot


kevin

 perhaps you should read your emails :)

kevin

#8
  Picking through the code, it doesn't seem to be as efficient as it could be.. So some general tips would be..


  * Limit memory thrashing.  A dynamic list is handy, but they contain allocation overhead in them.  Requesting memory (allocation) from the system isn't free, nor is it a fixed time operation.   So It'd be far more efficient to ween the code off them and roll your own heap.    Particularly where there's no allocation/deallocation and no list size  iteration.    

 * Commands like GetListSize() for example have to iterate through the list each call..  So using it a nesting loop say,  gives us the dreaded N squared iteration count for the solution.  


 * Functions have greater overhead than PSUBS due to scope allocation. Not a big deal when we're calling a function a few hundred times, but call them ten of 1000's of times and there's significant amount of performance lost.  So for 'operation/calculation' functions it's generally better to use PSUBS.

  eg.
PlayBASIC Code: [Select]
Function getHyp(x,y)   
local hyp,x1,y1
; path.DestinatioX
; path.DestinationY
; path.endy
x1=abs(x-path.startX)
y1=abs(y-path.StartY)


hyp=Sqrt((x1*x1)+(y1*y1))
;hyp=
endfunction hyp




could be simplified as,

PlayBASIC Code: [Select]
Psub getHyp(x,y)   
local hyp,x1,y1
x1=(x-path.startX)
y1=(y-path.StartY)

hyp=Sqrt((x1*x1)+(y1*y1))
endPsub hyp




 An inclined get distance is probably faster however, than manually calculating the length.    It might be viable to avoid the square roots by using square distances, but I haven't really look at your implementation..

PlayBASIC Code: [Select]
   setfps 60

ZoneX=400
ZoneY=300
ZoneSize=100
ZoneSizeSquared=ZoneSize*ZoneSize

Do
cls

mx=mousex()
my=mousey()

// Check if mouse is inside circle using getdistance
if GetDistance2D(mx,my,ZoneX,ZoneY)=<ZoneSize
print "Get Distance Inside Circle"
endif


// Check if it's inside the sqaured distance
dx=mx-zonex
dy=my-zoney

if ((Dx*Dx)+(Dy*DY))=<ZoneSizeSquared
print "Squared Distance Inside Circle"
endif

Circle ZoneX,ZoneY,ZoneSize,true

sync
loop








See Tutorial: A Crash Course In Optimization

monkeybot

Thanks for the comments,the getHyp is redundant code at the mo,i shall get rid of the linked lists.

kevin


  You can use the PixelRunLength to map the an image a bit like this, 

Make Occupied Map From 2 Colour image

monkeybot

cool.i will try that.

Thanks

kevin


Posted a second variant of the same idea, but this one uses maps completely..   

monkeybot

i reinstalled 1.64 N and its creating runnable exe's now.

kevin

#14
 yeah, somewhere between N2 and N3 the runtime startup breaks from a compile time dependency,  it's actually fixed in V1.64O already.   Amos To PlayBASIC is built in a younger version of it