Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - François Vanzeveren

#31
Marvellous, it even better.

Thanks for your quick answer.

François
#32
Hello,

I am wondering how to define a local array within a function.
I tried this
Code (glbasic) Select

LOCAL DIM myArray[10];

but this does not work. If i left out the word LOCAL, then it looks ok. Is it normal? Is myArray still local?

Secondly, is it ok to return a local array from a function like this:

Code (glbasic) Select

FUNCTION BuildSequence: pLevel
// These values are defined LOCAL:
// pLevel
DIM tSequence[pLevel+2];

FOR i = 0 TO pLevel+1
tSequence[i] = RND(7);
NEXT
RETURN tSequence
ENDFUNCTION


How should the "receiving" variable look like?

Thanks for your help.

François
#33
Announcements / Bombs Panic
2008-Apr-28
Hello everybody

From now, I will edit this post to give you updates on "Bombs Panic", a Nintendo DS mini-game clone for the GP2X-F200

The latest version (0.3.0) features a first attempt of level management! I would really appreciate if you could give some feedback on its suitability.

What's next?
- Bonus/malus management
- Music!

Enjoy ;)

Download Bombs Panic
Version History
---------------
0.3.0 (02/05/2008)
Level management.

0.2.2 (01/05/2008)
* BUG: Pause mode did not stop the clock
* BUG: When a bomb exploded, it was still possible to drag and drop it in the containment zone!

0.2.1 (01/05/2008)
* BUG: menu Pause/Restart Game was unreachable with the joypad

0.2.0 (29/04/2008)
* Game Over screen
* Different sizes for bombs

0.1.0 (27/04/2008)
Alpha version

#34
Hello,

How can I get the serial number of the gp2x on which the game is running? I would like to develop an "on line" score system. Of course, the GP2X does not support network gaming (as far as I know), but the idea is to generate a code base on the serial number and the score. The player then enters the code on the web site. The code is interpreted and the 'on line" scores are updated!

BTW: Anyone knows how I could develop the appropriate algorithms?

Thanks a lot!

François
#35
Thank you Andy, this is very interesting.

I will apply your advice asap and go back to this thread to let you know the progress.

Again, thank you for your time ;)
#36
Ok,

I first adapt the code to compute dX and dY only when necessary (i.e. after a collision) and with QCOS/QSIN, but this did not improve performance.
Then I slightly adapt the code to check the collision and this had a positive impact on performance: now, performance issue appears at around 18 bombs on the screen (instead of around 12).

The latest version of the project is available here: bombsorting_build2008042004.rar - 0.36MB

Of course, i am still open to any advice for improvements.

Thank you very much for your help so far

François

Quoteyou could always do if X>320 or X<0 then dx=-dx to change direction (do the same for DY).
This would definitely save the ANIMCOLL and improve performance... but in the next version, the bombs will bounce on the black and green boxes as well --> using pictures as masks and ANIMCOLL is easier than playing with all coordinate combinations... But I think that when I will consider the collisions between bombs... this will become unavoidable!
#37
thank you for  your comments so far...
QuoteIf you look in the samples folder that comes with GLBasic, you'll find a QSIN and QCOS function that does faster calculations than the normal COS/SIN.
QuoteI'm not sure if it make sense to store precalculated values for SIN etc.  I made some tests some time ago and the usage of SIN/COS within the loops was always faster then using precalc. values in arrays.
Ok, thanks for the tips. It will make the code easier, and combined with the newt tips, should have a positive impact on performance.
QuoteNot sure if you are using your sin tables all the time to calculate the movement or not, but if you are then try working out the DX and DY offset at the start only and when you want to change direction, then just INC x,dx and INC y,dy... you could always do if X>320 or X<0 then dx=-dx to change direction (do the same for DY).
I think you spot a good point! dx and dy should indeed be constant as long as there is no collision with the border. I will adapt my code!
QuoteYou could also ensure you redraw as little as possible, eg: use LOADBMP to load in the game screen and then only add in your bombs on top.
Quoteyou don't have to use LOADBMP within the game loop, just load the picture one time e.g. at start of sub Play()
Code (glbasic) Select
LOADBMP "resources/home.png";was indeed misplaced, but has no effect when playing the game. It only affects the drawing of the main manu; So, this does not explain the low performance.
QuoteThere are four ANIMCOLL statements for each bomp. Is this really necessary? Perhaps you can save some of them.
Unfortunatelly, yes as I need to check collision with all borders.

Now, let's go back to work! ;)

PS: btw, any clue on how to improve the display of the sprites?
#38
Hello,

I have started to code a mini-game designed for the GP2X-F200 and facing some performance issues. I beleive this is because I am new on GLBasic AND game programming.
Currently, bombs are just moving on the screen and bouncing against the borders. With 12 or more bombs on the screen moving simultaneously, performance is decreasing sharply.
In the code, I tried to appy "fixed point" calculation instead of "floating point" to improve performance (as the GP2X does not have a floating point unit), but I feel that the way i applied it in GLBasic might be wrong.

Therefore, I would really appreciate if some more experienced game programmers could review my code and explain me what I am doing wrong.

PS: another problem is the  display of png images on the GP2X: the quality is poor compared to a "windows" build

Here is the whole projet in its latest state: bombsorting_build2008042001.rar - 0.56MB

Thanks a lot to those you will help me to improve my skills and the project.

François
#39
Thanks, I will try this instead.

But it used to work with previous versions...

So let's say it is good practice to declare variable before assigning value ;)
#40
Hello,

With build 5.235, the PLATFORMINFO$ function generates a freeze on a black screen with the GP2X:
The code below only works when commenting the line with PLATFORMINFO$ (the fourth line of code)...
Code (glbasic) Select
SETSCREEN 320, 240, 0; // Set the screen size (not full screen)
LIMITFPS 60; // Limit to 60 frames per second
ALLOWESCAPE TRUE; // Disable instant Esc function

GLOBAL gDevice$ = PLATFORMINFO$("DEVICE");
//IF gDevice$ = "POCKETPC" OR gDevice$ = "F200"
// SYSTEMPOINTER FALSE; // device with touchscreen!
//ELSE
// SYSTEMPOINTER TRUE; // device without touchscreen --> simulate pen with the mouse!
//ENDIF

LoadMedia(); // Call function to load media files

// Boucle principale.
// Quitter la boucle --> quitter le jeu et revenir au menu GP2X
WHILE TRUE
// Affichage et gestion de l'écran de démarrage
LOCAL touchedMenu, highlightedMenu;
LOCAL isMenuSelected = FALSE, dpad = FALSE, pen = FALSE;

LOADBMP "resources/home.bmp";
DrawHomeMenu(0);
SHOWSCREEN;

WHILE isMenuSelected = FALSE
touchedMenu = GetTouchedHomeMenu();
IF pen = FALSE AND touchedMenu > -1
// L'utilisateur vient tout juste de pointer un menu avec le stylet/la souris
highlightedMenu = touchedMenu;
pen = TRUE
ELSEIF pen = TRUE AND touchedMenu = -1
// L'utilisateur vient de relacher la pression sur un menu avec son stylet.
isMenuSelected = TRUE;
pen = FALSE;
ELSEIF dpad = FALSE AND (KEY(200) OR KEY(208))
IF KEY(200) THEN highlightedMenu = MAX(0, highlightedMenu-1); // up arrow
IF KEY(208) THEN highlightedMenu = MIN(4, highlightedMenu+1); // down arrow
dpad = TRUE;
ELSEIF KEY(200) = 0 AND KEY(208) = 0
dpad = FALSE;
ENDIF
DrawHomeMenu(highlightedMenu);
SHOWSCREEN;

// les boutons 'SELECT' (15) et 'B' (45) provoquent
// la sélection du menu en surbrillance.
IF KEY(45) OR KEY(15) THEN isMenuSelected = TRUE;
// Le bouton 'HOME' (F200) permet de quitter le jeu.
IF KEY(28)
isMenuSelected = TRUE;
highlightedMenu = 4;
ENDIF

WEND

IF highlightedMenu = 4 THEN END // Quit game
WEND

END // End the program

FUNCTION LoadMedia:
LOADANIM "resources/font-15px.png", 0, 15, 15;
LOADANIM "resources/home-menu.png", 1, 180, 30;
LOADANIM "resources/pause-menu.png", 2, 180, 30;
LOADANIM "resources/bombs-20px.png", 10, 20, 20;
ENDFUNCTION

FUNCTION DrawHomeMenu: tSelectedMenu
LOCAL offset;
FOR i = 0 TO 4
offset = 0;
IF tSelectedMenu = i THEN offset = 1;
DRAWANIM 1, 2*i+offset, (320-180)/2, 60+30*i;
NEXT
ENDFUNCTION

FUNCTION DrawPauseMenu: tSelectedMenu
LOCAL offset;
FOR i = 0 TO 1
offset = 0;
IF tSelectedMenu = i THEN offset = 1;
DRAWANIM 1, 2*i+offset, (320-180)/2, 60+30*i;
NEXT
ENDFUNCTION

FUNCTION GetTouchedHomeMenu:
LOCAL retval = -1;
MOUSESTATE mx, my, b1, b2;
IF b1 = 1 // pushed
FOR i = 0 TO 4
IF IsPointInRect(mx,my, (320-180)/2, 60+30*i, 180, 30) THEN retval = i;
NEXT
ENDIF
RETURN retval;
ENDFUNCTION

FUNCTION IsPointInRect: px,py, rx,ry,rw,rh
LOCAL retval = FALSE;
IF px > rx AND px < rx + rw AND py > ry AND py < ry + rh
retval = TRUE;
ENDIF
RETURN retval;
ENDFUNCTION
#41
Hello,

I think there is a small bug in lesson 5 in the following code:
Code (glbasic) Select
IF py    en.dify=0-RND(3)
ELSE
    en.dify=RND(3)
ENDIF
There is a chance that the speed of the enemy is 0... and it will stay in memory, but outside the screen...

I think it should be something like:
Code (glbasic) Select
IF py    en.dify=-(1+RND(2))
ELSE
    en.dify=1+RND(2)
ENDIF
Voilà!
#42
Hello,

I am done wit this fantastic tutorial. I really enjoyed following it and it convinced it to invest into the GLBasic Premium Pack (bought with a GP2X-F200 on www.gp2x.de).

So, the next steps...
Programming in GLBasic looks so simple, that now I have the feeling the most difficult task to develop a game is to create nice graphics...
So,my question is simple: is there a good tool that allows to build graphics and animations for those whith no drawing capabilities/skills :) (e.g. based on templates)...
I would be also interested in any web sites dedicated to 2D games graphics.

Thanks for your help

François
#43
THank you, XaMMaX,

It works!
#44
Hi XaMMaX,

I tried without SETSCREEN... but that does not help :(
#45
Hello,

I am reading PeeJay's Tutorial and adapt the first lesson to run on my GP2X-F100 (i.e. setting the screen resolution to 320x240
Here is the code:
Code (glbasic) Select
SETSCREEN 320,240,1
LIMITFPS 60
SETTRANSPARENCY RGB(0,0,0)
LOADSPRITE "player.bmp",0
GLOBAL px= 320/2 - 32/2
GLOBAL py= 240/2 - 32/2

WHILE KEY(01)=FALSE
DrawTheScreen()
WEND
END

FUNCTION DrawTheScreen:
DRAWSPRITE 0,px,py
SHOWSCREEN
ENDFUNCTION
I loaded the following files on my GP2X in a folder /Projects/MyFirstGame/
MyFirstGame.gpe
player.bmp

I am using the demo version.

This is maybe an issue with the screen depth?

Thanks for your precious help!

Regards

François