Bennu Game Development

English Forums => Suggestions => Topic started by: Eckolin on January 01, 2011, 12:38:52 AM

Title: [bug] in libblit.dll
Post by: Eckolin on January 01, 2011, 12:38:52 AM
The following code caused a crash.


import "mod_grproc"
import "mod_video"
import "mod_map"
import "mod_draw"
import "mod_rand"
import "mod_say"
private
    frnr=0;

begin
    set_mode(800,600,32);
    set_fps(0,0);
    for (x=0;x<250;++x)
        put_pixel(rand(0,800),rand(0,600),rgb(rand(200,250),rand(200,250),rand(200,250)));
    end
    loop
        frnr++;
        say(frnr);
        for (x=0;x<30;x++)
            particle(400.0,300.0,(float)rand(-10,10),(float)rand(-5,-10),rgb(rand(150,255),rand(150,255),rand(150,255)));
        end
        frame(5000);
    end
end


process particle(float xcor,float ycor,float dx,float dy, int color);
private
    lifetime=100;
begin
    graph=new_map(10,10,32);
say(graph);
    drawing_map(0,graph);
    drawing_color(color);
    draw_fcircle(3,3,rand(3,5));
    loop
        lifetime--;
        size+=rand(-2,1);
        if (lifetime<0)
            size-=2;
            //alpha-=3;
            if (size<5)
                break;
            end
        end
        x=xcor;
        y=ycor;
        xcor+=dx;
        ycor+=dy;
        dx*=0.96;
        dy+=0.06;
        dy*=0.96;
        frame;
    end
frame;
onexit
    if (graph) unload_map(0,graph);graph=0;end
end


I have had crashes like this (http://img253.imageshack.us/img253/4653/blitbug.png) before, but they seem difficult to reproduce. I'm using a fairly recent version of Bennu (29 november 2010)

Last lines in debugger output also suggest a bug in blitting:


                                              [ 158] 000000FF 00000035          ------              D:\Programming\Projects\problem\fireworks.prg:53 -> frame;

                                              [ 160] 00000084 00000064          PUSH                100     

00000064
                                              [ 162] 00000002                   FRAME               


Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 01:09:58 AM
when crash? here are working and don't crash...

maybe you must wait the next release...
Title: Re: [bug] in libblit.dll
Post by: Eckolin on January 01, 2011, 01:13:24 AM
Crash happened at frnr==7 for me.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 03:21:08 AM
here:

1188
1189
1190
1191
1192
1193
1194
1195
1196
1197

and I close it.
Title: Re: [bug] in libblit.dll
Post by: Eckolin on January 01, 2011, 10:30:50 AM
For me the crash was at 1209. I've had someone else run it on his machine, it crashes there too. I suspect it's a problem with the scaling code, as this problem also occured when using size_x, size_y in another program. (And it no longer crashes when I comment out the size changes).

I'd like to ask those who read this thread to run it for themselves for a while (10 minutes or so).
Title: Re: [bug] in libblit.dll
Post by: handsource-dyko on January 01, 2011, 12:13:21 PM
It crashed by me too. I've used BGDI 1.0.0 (Nov 29 2010 01:31:19). It carshed at 1119. It cashed after a few seconds. It consistantly
crashes at 1119. I've noticed from the screenshot that you're also using a dutch windows version like me.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 04:49:18 PM
I'll test it again...
Title: Re: [bug] in libblit.dll
Post by: Drumpi on January 01, 2011, 04:54:55 PM
I tried too, with r147 with this output:
1
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
2
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
3
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089


With r181 I get 1119, but crashed too. I'm using Wxp x64.
Just a fast try, not changing code or else, just compile and run.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 04:58:19 PM
my version for frmr==4580 and continue...

my version is linux version... I'll let it continue...
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 05:04:50 PM
my version go frmr == 10604 and continue...

I think that I fix this bug... not blitter problem, pixel (drawing functions) problem...

But I think that I fix it time ago... maybe I made a bad .rar package.
Title: Re: [bug] in libblit.dll
Post by: handsource-dyko on January 01, 2011, 07:32:04 PM
Yeah, maybe it's in the drawing routines. I've played around with some of the primitive drawing fuctions, and they seem to work differently from what I expected from the documentation. delete_draw can sometimes crash in certain situations.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 08:13:14 PM
I'm here again... I return from my father house.

I remove say(graph) for more speed in the test.

The test was continue running, I kill it... the last frmr say:

275700
275701
275702
275703
275704
275705
275706
275707
275708
Terminado (killed)

this don't crash in linux.
Title: Re: [bug] in libblit.dll
Post by: handsource-dyko on January 01, 2011, 08:30:35 PM
Strange. Maybe an OS specific issue? Or hardware related?
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 08:57:43 PM
It's crash on windows...

I isolate the error... this crash for me... please, anybody can confirm please?


import "mod_grproc"
import "mod_video"
import "mod_map"
import "mod_say"

begin
    set_mode(800,600,32);
    set_fps(0,0);
    particle(400,300);
    particle(400,300);
    particle(400,300);
    particle(400,300);
end


process particle(int x,int y);
begin
    graph=new_map(10,10,32);
    size=1;
    say( graph+"|"+size+"|"+x+"|"+y+"|");
    frame;
onexit
    if (graph) unload_map(0,graph);graph=0;end
end
Title: Re: [bug] in libblit.dll
Post by: Fede on January 01, 2011, 09:22:23 PM
Yes, it crash

r189 wxp64.

Show this "say":

1000|1|400|300|
1001|1|400|300|
1002|1|400|300|
1003|1|400|300|

Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 10:08:52 PM
put the particle into a for, 0 to 30 or other value.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 10:09:31 PM
Quote from: Fede on January 01, 2011, 09:22:23 PM
Yes, it crash

r189 wxp64.

Show this "say":

1000|1|400|300|
1001|1|400|300|
1002|1|400|300|
1003|1|400|300|



thanks fede... well, I now have a test case... I'll fix it later...

for temporal solution, keep width or heigth / size, never give 0.

then if you graph is 10, don't use size lower that 10.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 11:24:30 PM
try with this libblit...

thanks for the report... karma++
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 01, 2011, 11:30:17 PM
sorry, this is the right file...
Title: Re: [bug] in libblit.dll
Post by: Drumpi on January 02, 2011, 02:33:36 PM
With old libblit (r181) I changed code to:

import "mod_grproc"
import "mod_video"
import "mod_map"
import "mod_say"

begin
    set_mode(800,600,32);
    set_fps(0,0);
    loop
        particle(400,300);
        if (key(_esc)) break; end
        frame;
    end
end


process particle(int x,int y);
begin
    graph=new_map(10,10,32);
    size=1;
    say( graph+"|"+size+"|"+x+"|"+y+"|");
    frame;
onexit
    if (graph) unload_map(0,graph);graph=0;end
end


With no crash. With new libblit I have no crash too.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 02, 2011, 05:56:25 PM
yes, several particles in the same loop.

I need test the previous test sample.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on January 03, 2011, 12:59:53 AM
tic tac, tic tac...

and ????

eckolin???
Title: Re: [bug] in libblit.dll
Post by: Arcontus on February 26, 2011, 04:18:13 PM
Hello,

I have a similar issue. When I ussing size_x with lower value that 10, sometimes the program crash. In the other hand, i tried to run it in debug mode, and I can't reproduce the crash. If I change anything of code, sometimes is possible that it run correctly. I think that it is a possible bug in this function, but I not rule out that this is a bug in my code...

Regards!

Title: Re: [bug] in libblit.dll
Post by: SplinterGU on February 27, 2011, 01:44:13 AM
Quote from: Arcontus on February 26, 2011, 04:18:13 PM
Hello,

I have a similar issue. When I ussing size_x with lower value that 10, sometimes the program crash. In the other hand, i tried to run it in debug mode, and I can't reproduce the crash. If I change anything of code, sometimes is possible that it run correctly. I think that it is a possible bug in this function, but I not rule out that this is a bug in my code...

Regards!



which version?
Title: Re: [bug] in libblit.dll
Post by: Arcontus on February 27, 2011, 01:29:19 PM
Quote from: SplinterGU on February 27, 2011, 01:44:13 AM
Quote from: Arcontus on February 26, 2011, 04:18:13 PM
Hello,

I have a similar issue. When I ussing size_x with lower value that 10, sometimes the program crash. In the other hand, i tried to run it in debug mode, and I can't reproduce the crash. If I change anything of code, sometimes is possible that it run correctly. I think that it is a possible bug in this function, but I not rule out that this is a bug in my code...

Regards!



which version?

I Tried to update to last version yesterday (bgd-1.0.0RC21(r228)-win32), and I have equal result. I don't understand what is the problem if the mistake is in my code, because all times the program execute the same process, and it work fine if I change the minimum value for size_x over 10.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on February 28, 2011, 02:47:26 AM
mmm, I already fix this bug... can you send me a sample with this error?
Title: Re: [bug] in libblit.dll
Post by: Arcontus on February 28, 2011, 07:14:50 PM
Quote from: SplinterGU on February 28, 2011, 02:47:26 AM
mmm, I already fix this bug... can you send me a sample with this error?

It's difficult because the program have a lot of lines for analice all code, but the implicated process is very simple:


PROCESS BarraEnergia()
PRIVATE
contador;
BEGIN
file=interfazFPG;
x= 468;
y=Resolucion_y -140;
graph = 26;
z = Z_INTERFAZ+1;
LOOP
if (contador < 1) contador = 100;else contador--;END
size_x = contador;
if (contador > 90)
graph = 26;
else
        if (contador > 80)
graph = 27;
else
        if (contador > 70)
graph = 28;
else
if (contador > 60)
graph = 29;
else
if (contador > 50)
graph = 30;
else
if (contador > 40)
graph = 31;
else
if (contador > 30)
graph = 32;
else
if (contador > 20)
graph = 33;
else
if (contador > 10)
graph = 34;
else
if (contador > -1)
graph = 35;
END
END
END
END
END
END
END
END
END
END
FRAME;
END
END


This process countdown every frame the variable "contador", and it's equal to size_x. For other hand, the anidated "IFs" is for change the collour of the bar every 10 values. The graph that I use for this function have a resolution 373x7 pixels. When I tried to debug this code with debug mode, never crash. It's very strange.

I don't try if the code of this process alone can run fine (obviously with main process).

If antythink don't understand, I can send you the reply in spanish if you prefer :D

Thank you,

Regards!
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on February 28, 2011, 07:24:24 PM
I need a compilable code.
Title: Re: [bug] in libblit.dll
Post by: Arcontus on February 28, 2011, 07:59:23 PM
Quote from: SplinterGU on February 28, 2011, 07:24:24 PM
I need a compilable code.

Ok, I'll send you when it's ready.
Title: Re: [bug] in libblit.dll
Post by: Arcontus on February 28, 2011, 08:46:39 PM
Sorry, you were right. I was ussed an obsolete version, and I was an error when I tried to change the current version in my compiler. With the new version, run fine.

Thanks again.
Title: Re: [bug] in libblit.dll
Post by: SplinterGU on February 28, 2011, 09:40:24 PM

;)