English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Blitz Basic (http://eab.abime.net/forumdisplay.php?f=126)
-   -   GetaShape freezes my Amiga (http://eab.abime.net/showthread.php?t=91896)

peceha 18 April 2018 22:41

GetaShape freezes my Amiga
 
Hi,

could someone tell me what's wrong in here:
Code:

#G    =16

BitMap 0,640,512,2
LoadBitMap 0,"ram:gfx_hero.iff",0

cnt.w=1000  ;      <<<<---- THIS ONE IS MAKING TROUBLE
For y.b=0 To 8
  For x.b=0 To 7
    GetaShape cnt,x*#G,y*#G,#G,#G
    cnt+1
  Next x
Next y

Free BitMap 0
Print "done"
MouseWait

The important thing here is "cnt" - when it is set to 500 I can run this code as many times as I want. When I set cnt=1000 then I can run this only once - the second time I run the code my Amiga freezes, cannot move the mouse, and no guru shows up.
I'm talking about Blitz 2.1 (max shapes number in compiler setting is set to 2000).

Thanks

Daedalus 19 April 2018 01:33

Certain Blitz objects cause crashes when the maximum object count is too high - the buffer size wraps around and trashes memory. I think you're hitting this bug, it's one of the things that was fixed in Amiblitz 3.

Do you really need more than 1000 shapes? I would suggest recycling shapes that are used for drawing maps etc. if that's what you're doing. Otherwise AmiBlitz 3 should work.

peceha 19 April 2018 08:17

Thanks Daedalus.
I will consider moving to AmiBlitz3.

At the moment I have something like this:
https://www.youtube.com/watch?time_c...&v=qFM5ObTjrow

In that video the maze has a dimentions 20x16 so it makes 320 shapes but if I want a bigger maze (eg.40x32) then I need more than 1000 shapes.
Hmmm... I will have to find a different way, maybe instead of "1 title" = "1 shape" I will do "all the same tiles" = "1 shape" and that will reduce the amount of shapes...

Thanks a lot ! as always I have some new ideas after reading your answers , hehe :)

Predseda 23 April 2018 15:43

This looks very promissing, fingers crossed in it. Fits to my favourite genre.

Daedalus 23 April 2018 18:04

Oops, I thought I replied to this ages ago, but turns out I didn't...

Quote:

Originally Posted by peceha (Post 1235649)
In that video the maze has a dimentions 20x16 so it makes 320 shapes but if I want a bigger maze (eg.40x32) then I need more than 1000 shapes.

Yep, that's definitely not an efficient way of doing things...

Quote:

Hmmm... I will have to find a different way, maybe instead of "1 title" = "1 shape" I will do "all the same tiles" = "1 shape" and that will reduce the amount of shapes...
Yep, that's much more like it :) The normal way most games and map makers do this is to assign each different tile type a number, and then build the level from an array of numbers, each one representing a particular type of tile. In that way, a simple maze-type engine can be built using quite a small number of tiles - maybe 20 or 30, leaving plenty of space (both in the Shapes object list and in chip RAM) for adding other content.


All times are GMT +2. The time now is 18:12.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.

Page generated in 0.04068 seconds with 11 queries