Epic Freefall - Now With Bennu And Other Improvements


Imerion

Member
Joined
Feb 24, 2005
Messages
218
Since there now is a Bennu port for Wiz I decided to port my games to the Wiz using it instead of Fenix. I started with Epic FreeFall to try it out. I believe I have got it all right, but I am not certain. So if someone wants to try this new version and tell me if I did it correct, that would be great!

The file can be found here : Epic FreeFall Bennu-version
 
Hmm, must have done something wrong then. The firmware shouldn't matter, I guess I just set it up wrong. If someone knows how to correctly use the Wiz-port of Bennu, any help would be appreciated!
 
Im not very familar with Bennu, don't know about Fenix, but i looked into this for curiosity.
I compared your game with the pacman port and noticed you try to start the game using the "ufxi" which i believe is Fenix related, as it is not used in the Pacman clone and the Bennu Wiki does not know about some "ufxi" :) Pacman is run using "bgdi" if im correct
 
Madman said:
Im not very familar with Bennu, don't know about Fenix, but i looked into this for curiosity.
I compared your game with the pacman port and noticed you try to start the game using the "ufxi" which i believe is Fenix related, as it is not used in the Pacman clone and the Bennu Wiki does not know about some "ufxi" :) Pacman is run using "bgdi" if im correct

I'm no Fenix or Bennu expert either, but that's exactly what I thought.

There's an English forum at the developer homepage. Perhaps you can get help there...

http://www.bennugd.co.uk/
 
Last edited by a moderator:
I tried hacking a Bennu like startscript for EF but i ended up at the Wiz menu when running it.
 
Oh. Now I am feeling silly. Seems I simply just posted the wrong link.
This should be the correct version : http://www.mediafire.com/download.php?mvqei1qtuj2
Please try that one instead.

Thanks Madman, for mentioning ufxi. I kept checking the file I had on my computer for errors but found none. When you mentioned that however, I realized I must have posted a link to the old version...

There's an English forum at the developer homepage. Perhaps you can get help there...

http://www.bennugd.co.uk/

I did a quick check there, but found nothing. But if the program does not work now with the correct file, Ill post a question there instead. Please try it once again though, I believe it should work now.
 
OK, better now. The game loads and the intro is visible. Music plays too.
But the controls don't work. Neither d-pad, buttons, volume or touchscreen.
 
Great! Now at least it runs. Thanks for the help.

Strange thing though, I remapped all the buttons as stated in the information. Ill check it again. Once I have figured this all out I can finally port my other games too.
 
No luck. Still no controls. :(

I logged the output:

Code:
BGDC 1.0.0 (Jul 23 2009 23:36:16)
Copyright © 2006-2009 SplinterGU (Fenix/BennuGD)
Copyright © 2002-2006 Fenix Team (Fenix)
Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
Bennu Game Development comes with ABSOLUTELY NO WARRANTY;
see COPYING for details

/mnt/sd/game/EpicFreeFall/librender:0: warning: Variable redeclared ("ALPHA_STEPS")
/mnt/sd/game/EpicFreeFall/libscroll:0: warning: Variable redeclared ("CTYPE")
/mnt/sd/game/EpicFreeFall/libscroll:0: warning: Variable redeclared ("CNUMBER")
/mnt/sd/game/EpicFreeFall/freefall.prg:96: error: Undefined procedure ("JOY_GETBUTTON")
FB_OpenMouse()
Using tslib touchscreen

Regards,
Stephan
 
Ok, regarding to the bennu GD wiki of "JOY_GETBUTTON" i found you seemed to be missing the line

import "mod_joy"

which i believe contains definition the JOY_GETBUTTON function.
After adding it to the .PRG file at the >import "..."< lines, the game starts playing music and exits to the Wiz menu as soon as it tries to display the menu
from which to choose wether starting / quiting the game.

Edit: Taking a peek at the SourceCode and uncommenting the Line
if (joy_getbutton(0.8) or Selection==3) frame; frame; frame; frame; frame; exit("Quit",0); end
It wont exit but ends up in a loop on restarting the menu. Which is pretty strange due to the repeat..until statement before.

Edit2: The problem seems to be the get_joybutton function. It seems to return something, exiting the repeat..until and re-entering the loop...end
which displays the logo. (Skipping the intro as ShowLogo is set to 1 once it was displayed - period.)
Unfortunately, the function is undocumented in the Bennu wiki as of yet, so i got no way of telling how its used properly.
 
/mnt/sd/game/EpicFreeFall/freefall.prg:96: error: Undefined procedure ("JOY_GETBUTTON")
Ok, regarding to the bennu GD wiki of "JOY_GETBUTTON" i found you seemed to be missing the line

import "mod_joy"

Ah, of course! I thought it was part of "mod_key". I am still not used to the modularity of Bennu.


which i believe contains definition the JOY_GETBUTTON function.
After adding it to the .PRG file at the >import "..."< lines, the game starts playing music and exits to the Wiz menu as soon as it tries to display the menu
from which to choose wether starting / quiting the game.

Edit: Taking a peek at the SourceCode and uncommenting the Line
if (joy_getbutton(0.8) or Selection==3) frame; frame; frame; frame; frame; exit("Quit",0); end
It wont exit but ends up in a loop on restarting the menu. Which is pretty strange due to the repeat..until statement before.

Edit2: The problem seems to be the get_joybutton function. It seems to return something, exiting the repeat..until and re-entering the loop...end
which displays the logo. (Skipping the intro as ShowLogo is set to 1 once it was displayed - period.)
Unfortunately, the function is undocumented in the Bennu wiki as of yet, so i got no way of telling how its used properly.


Once again, thanks for all the help! It seems porting a game without the actual hardware or any documentation is a bad idea. :) But perhaps the solution is quite simple. The standard "key(_button)" didn't return any value unless a button press was registered, so it was possible to use it like this "if (key(_button))" and nothing more. But it seems get_joybutton returns some value even if it isn't pressed, however if it registers something it should return "1". Therefore, "if (get_joybutton(0.8)==1)", should work. I hope.

An updated version is here if you feel like giving it one more try : http://www.mediafire.com/download.php?gymhyojf2yt
 
Imerion said:
An updated version is here if you feel like giving it one more try : http://www.mediafire.com/download.php?gymhyojf2yt

Hmm this one is a slight improvement. The menu does not re-initialize, but it still keeps looping, which i can hear by the Bip.wav being played.
However i noticed you make use of the joy_getbutton by handing over a float (e.g. joy_getbutton(0.18) )
This seems to be wrong. Regarding to the Bennu wiki ( http://wiki.bennugd.org/index.php?title=Tutorial:Joystick_tester ) the function requires
an integer, identifying the joystick. So i made some changes to your code:

First i copied the pacman demo constants:

CONST
KEY_UP = 1;
KEY_DOWN = 2;
KEY_LEFT = 3;
KEY_RIGHT = 4;
KEY_A = 5;
KEY_B = 6;
KEY_C = 7;
KEY_D = 8;
KEY_START = 9;
KEY_CLOSE = 10;

Later i changed the corresponding function calls like this:

repeat
if (joy_getbutton(0) == KEY_UP ) play_wav(Bip,0); Selection--; end
if (joy_getbutton(0) == KEY_DOWN) play_wav(Bip,0); Selection++; end
if (Selection==4) Selection=1; end
if (Selection==0) Selection=3; end
frame; frame;
until(joy_getbutton(0)==KEY_START or joy_getbutton(0)==KEY_ B) ;

This seems to work better, the repeatedly playing bip.wav is gone. However i cant select any menu item or start the game. Means this does not return anything at all.

I will look into this some more, as i am considering to learn Bennu myself, this is a good sample to start with :)

Edit: Whatever i try on the joy_getbutton is working when running the game in Windows, but not working on the Wiz. However the Joystick sample from the Bennu wiki works on the Wiz as well. I suspect this is an adressing type of thing, as the wiki sample seems to use pointers like stuff (&b[j])

Edit2: On a sidenote, regarding the game: Not sure if this is intended, but sometimes i cant slip through certain blocks, as the space between the random placed barriers is too narrow.
 
Last edited by a moderator:
Strange indeed. No idea what the trouble could be. What you just tried was the last idea I had, so I really don't know what more to do to make it work. Perhaps we should just wait for the next version of the Bennu port. There might be some better documentation then.


I will look into this some more, as i am considering to learn Bennu myself, this is a good sample to start with :)

Please do if you feel like it. If you have any idea and need help implementing it or if you wonder how some part of the code works, just ask here and I'll help.


Edit2: On a sidenote, regarding the game: Not sure if this is intended, but sometimes i cant slip through certain blocks, as the space between the random placed barriers is too narrow.

Well, it isn't intended and it should not happen. It still does sometimes, even though I tried to fix it a few times. :) In the end, I decided to let it be. It makes the game a bit more challenging, since you have to check each gap to see if it is wide enough before you try it. But I might have a look again to see if it can be fixed.
 
OK, i managed to make this work! B)
Please update your PRG file with the one i uploaded here. http://www.mediafire.com/?sharekey=c1ea5968d18a9e790dec85adfe0a530ae04e75f6e8ebb871

It probably does not exit correctly on "quit" so you may need to reboot the wiz, and the tearing needs to be addressed, but it starts and is playable.
May look into this some more if you dont mind ;)

Edit: I uploaded another file which quits correctly now. but thats it for today
 
Awesome! Thank you so much! Now I can look at this and make the other games work as well.

I am not certain I completely understand it though. There is quite a lot of code added. Surely it must be possible to make it work in a simpler way?

"if (player_key_state(0,0))" is the same as "if (player_key_state[PLAYER_1][KEY_UP])", so why didn't that work?

And if "player_key_state[PLAYER_1][KEY_UP"] is the same as "joy_getbutton(0,0);", why not simply use "if (joy_getbutton(0,0)". (As we tried first?)


May look into this some more if you dont mind ;)

No problem at all. The code is free and open. :)
 
Im not quite sure either, (i had some beer while playing around with it), but i suspect a timing issue.
The button checking is now done in a process or thread, which updates the player_key_state array each frame.
The |= operator in the process could also be the key.
I only copied the related parts from the demo code and adjusted your script.

I prefer the way it is done in the demo:
This way you can play the game on both Windows and Wiz. So you dont need to copy the PRG file to the Wiz each time you
like to test something, which i found pretty annoying. I will probably tweak this stuff a little more and have some
Wiz Controller "class" released.

Oh and btw: If possible, indent your code and add a comment now and then :rolleyes: . What IDE do you use?
I got Flamebird yesterday as an IDE and its much better than Crimson Editor. http://fbtwo.sourceforge.net/en/home.php

And one last question: How did you create the FPG file? Is there some tool to look at the contents?
 
I prefer the way it is done in the demo:
This way you can play the game on both Windows and Wiz. So you dont need to copy the PRG file to the Wiz each time you
like to test something, which i found pretty annoying. I will probably tweak this stuff a little more and have some
Wiz Controller "class" released.

It's strange it doesn't work like in the GP2X port of Fenix though. That one worked exactly the same as the PC-versions, so you could write the game with the buttons you would use on a computer, like Ctrl and Alt and they would work as X and B on the GP2X without any change in the code. But if you release some kind of class which does just that it would be really useful. I was thinking about sending a mail to Splinter who made the port and ask for something similiar.


Oh and btw: If possible, indent your code and add a comment now and then :rolleyes: . What IDE do you use?
I got Flamebird yesterday as an IDE and its much better than Crimson Editor. http://fbtwo.sourcef...net/en/home.php

Ah, sorry about that. I have always used small and few indendts because I don't want my code spread all over the page. So I used two spaces instead of a tab.

However, I have started using a bit more and nicer indents in my latest projects so it should get a bit better then. :)
As for comments, I know I should do them. It's just that I am so used to the code I never need them myself. But I will try to make more of them in the future so others can read my code to.

I don't use any IDE at all, because non of them runs well in Linux. I used one previously that worked well in Wine, but my standard text editor worked better in the end so I started using it instead. There are a few Bennu-based IDE's in development for Linux though, so I might start to use one of them when they are more complete.

And one last question: How did you create the FPG file? Is there some tool to look at the contents?

There is a tool called Fpg Edit, but it is rather old by now. I can find a link to it if you want, but I believe this program is better and should work the same : http://forum.bennugd.org/index.php?topic=399.0
 
Back
Top