UnderwareDESIGN

PlayBASIC => Beginners => Topic started by: monkeybot on July 10, 2013, 12:44:46 PM

Title: exe crashes
Post by: monkeybot on July 10, 2013, 12:44:46 PM
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?



Title: Re: exe crashes
Post by: kevin on July 11, 2013, 12:56:48 AM

and the version is ? 

Title: Re: exe crashes
Post by: monkeybot on July 11, 2013, 12:14:22 PM
ah yes,sorry.

i have tried with 1.64 beta 0 16

and 1.64N3d2
Title: Re: exe crashes
Post by: kevin on July 11, 2013, 11:17:03 PM
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.. 

Title: Re: exe crashes
Post by: monkeybot on July 14, 2013, 06:59:24 AM
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?
Title: Re: exe crashes
Post by: kevin on July 14, 2013, 07:54:25 AM

[plink]Email Support (http://www.underwaredesign.com/?l=Email-Support)[/plink]

Title: Re: exe crashes
Post by: monkeybot on July 14, 2013, 03:15:22 PM
sent.
Thanks
Title: Re: exe crashes
Post by: kevin on July 14, 2013, 03:18:56 PM
 perhaps you should read your emails :)
Title: Re: exe crashes
Post by: kevin on July 15, 2013, 02:09:49 AM
  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.
[pbcode]

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

[/pbcode]

could be simplified as,

[pbcode]
Psub getHyp(x,y)  
   local hyp,x1,y1  
x1=(x-path.startX)  
y1=(y-path.StartY)

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

[/pbcode]

 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..

[pbcode]

   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

[/pbcode]





See Tutorial: A Crash Course In Optimization (http://www.underwaredesign.com/forums/index.php?topic=2548.0)
Title: Re: exe crashes
Post by: monkeybot on July 15, 2013, 12:09:42 PM
Thanks for the comments,the getHyp is redundant code at the mo,i shall get rid of the linked lists.
Title: Re: exe crashes
Post by: kevin on July 15, 2013, 12:25:18 PM

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

 Make Occupied Map From 2 Colour image (http://www.underwaredesign.com/forums/index.php?topic=4067.0)
Title: Re: exe crashes
Post by: monkeybot on July 15, 2013, 01:01:29 PM
cool.i will try that.

Thanks
Title: Re: exe crashes
Post by: kevin on July 16, 2013, 02:18:33 PM

Posted a second variant of the same idea, but this one uses maps completely..   
Title: Re: exe crashes
Post by: monkeybot on July 25, 2013, 10:41:19 AM
i reinstalled 1.64 N and its creating runnable exe's now.
Title: Re: exe crashes
Post by: kevin on July 25, 2013, 06:21:18 PM
 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 (http://www.underwaredesign.com/forums/index.php?topic=4024.msg27191#msg27191) is built in a younger version of it