Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#77777 - 04/03/2002 23:14 games
kswish0
enthusiast

Registered: 06/02/2002
Posts: 212
Loc: Virginia, USA
i spend a lot of time sitting in my car waiting for other people and it would be nice if there were a few simple games on the empeg that would help me pass the time. the breakout game in hijack is good and i know there is a tetris game out there (emptris) although i have never been able to get it working. maybe some games that would be accessed through hijack. is this possible? some games like a racing game where you hvae to steer a car down a curving road without hitting the other cars, or a simple side scrolling space game where you fly a space ship and have to shoot the aliens, or a game like pacman or something. i wouldn't even know where to begin doing this with my very limited knowledge of programming or else i would try it myself

Top
#77778 - 04/03/2002 23:35 Re: games [Re: kswish0]
justinlarsen
old hand

Registered: 31/12/2001
Posts: 1109
Loc: Petaluma, CA
ya definatly a good idea.. i was reading pong in a very earler version of hijack.. im not sure if it was just break-out with a differnt name thou.. as i didt exist back in the early hijack versions.. more games would definatly be nice.. emptrivia is a fun one.. thou the install is very hard i forget who wrote it, but maybe mark or the writer of that program can write to to easier twine into the hijack menu, so it oculd be easier to laod for new users..
_________________________
---- Justin Larsen

Top
#77779 - 05/03/2002 00:56 Re: games [Re: justinlarsen]
duranike
journeyman

Registered: 20/06/1999
Posts: 84
if i wanted to develop games for the empeg what would i need to do that? Like what code should i use? C++? Is there an empty source that i could use?
_________________________
1st Original Mark I Owner in California: Serial Number 27.

Top
#77780 - 05/03/2002 02:17 Re: games [Re: duranike]
justinlarsen
old hand

Registered: 31/12/2001
Posts: 1109
Loc: Petaluma, CA
ya ill help you too.. i belive there is the arm tool box on marks page.. http://empeg-hijack.sourceforge.net/ i dont think c++ will work.
_________________________
---- Justin Larsen

Top
#77781 - 05/03/2002 02:24 Re: games [Re: justinlarsen]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
C++ works fine. You could also conceivably use Objective C, Fortran, Java (compiled natively), and Chill (whatever that is). None of those are enabled by default in Mark's toolchain, though.
_________________________
Bitt Faulk

Top
#77782 - 05/03/2002 02:28 Re: games [Re: wfaulk]
justinlarsen
old hand

Registered: 31/12/2001
Posts: 1109
Loc: Petaluma, CA
interesting.. looks like im going to be making some games then.. wooohoo i hope.. first on the list asteroids
_________________________
---- Justin Larsen

Top
#77783 - 05/03/2002 10:58 Re: games [Re: kswish0]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
There are currently three games that I know of for the empeg.

- There is the breakout game that's built into Hijack.
- There is emptris.
- There is the trivia game.

Does anyone have links to the latest versions of the latter two, and do they work under the Hijack interface?
_________________________
Tony Fabris

Top
#77784 - 05/03/2002 11:20 Re: games [Re: tfabris]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Speaking of the Hijack interface..

I think it's a bit cumbersome, and possibly backwards from how many apps might want it to work. This can all be fixed with (1) a mmap() interface for the displaybuf, and (2) an exec() interface for invoking applications from the menu.

I need somebody to code up the in-kernel "exec() and wait()" interface for me. I fiddled with it a while ago, but it took up too much of my time figuring out the in-kernel API semantics (very close to, but slightly different from, the userland libc semantics).

Cheers

Top
#77785 - 05/03/2002 11:32 Re: games [Re: tfabris]
justinlarsen
old hand

Registered: 31/12/2001
Posts: 1109
Loc: Petaluma, CA
emptriv does.. emptetris you have to accully log out of the player to play it so basically useless
_________________________
---- Justin Larsen

Top
#77786 - 05/03/2002 11:34 Re: games [Re: mlord]
justinlarsen
old hand

Registered: 31/12/2001
Posts: 1109
Loc: Petaluma, CA
so mark what you want is kinda like a folder for the userland apps so your menu dosent get crazy out of control too long like it has potentions to do very soon with all these new features people are wishing for and yo being so nice to implant them
_________________________
---- Justin Larsen

Top
#77787 - 05/03/2002 11:38 Re: games [Re: justinlarsen]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
If the menu gets huge because of user apps, I'll be a very happy person (and move them all to a sub-menu).

Cheers

Top
#77788 - 05/03/2002 12:56 Re: games [Re: tfabris]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Emptris is written by Brian Mihulka. It doesn't integrate with Hijack so it can't be played at the same time as the player is running. Also, since he's a bit busy these days with buttons I wouldn't want him to be distracted porting Emptris to Hijack. But if anyone wants to do it, it should be relatively easy if you study up on the Hijack interface.

The latest version is 0.2.2 and it's at Brian's programming page near the bottom.

EmpTriv, my trivia game, is the only game that uses the Hijack interface. Unfortunately I haven't had time enough to get the source into releaseable condition, and wanted to do some improvements to the speed and such. It's also remarkably difficult to install and takes up a lot of space due to the large number of questions. Then I got distracted with the lyrics scroller and most recently the alarm clock, so EmpTriv became truly back burner material.

I will try to release something with full source in the near future to help out anyone who wants to be able to bind to the Hijack interface... But all of these games are kinda useless to most non-hackers without a nice easy installer. Someone was working on that, right?

Edit: Tony, any way to move this to the Programming forum?


Edited by yn0t_ (05/03/2002 13:05)
_________________________
- Tony C
my empeg stuff

Top
#77789 - 06/03/2002 12:23 Re: games [Re: tonyc]
johnmcd3
enthusiast

Registered: 19/04/2001
Posts: 369
Loc: Seattle, WA (formerly Houston,...
hey tony, if you can release your source for the emptriv (especially the part with the hijack binding) I think I'd like to try my hand at porting emptris to the hijack menu. I've been giving myself a crash course in Linux, prgramming in the UNIX environment, and C (I knew C++ already) for the past week or two. This sounds like something I might be able to handle. I'll be on vacation all next week, so if it takes a few days to tidy up, that might more helpful than trying to get it done before I leave. Anyway, consider me an interested party.

- John

P. S. I know the hijack binding method is documented in the source, but it'd be nice to see your impletmentaion as well.
_________________________
1998 BMW ///M3 30 GB Mk2a, Tuner, and 10 GB backup

Top
#77790 - 06/03/2002 17:23 Re: games [Re: johnmcd3]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Okay well for what it's worth, here's my int main() and globals. This should get your started...



int fd;
int rc=-99;
gdImagePtr image, teenyFontImage, leftArrowImage, rightArrowImage;
unsigned char screenbuf[EMPEG_SCREEN_ROWS][EMPEG_SCREEN_COLS/2]= {0,};
int off, dim, med, bri;
CATEGORY categories[ MAXCATEGORIES ];
int g_iNumCategories=0;
int g_iNumSelectedCategories=0;
int g_iCatNum=0;
int g_iDiffMin = 0;
int g_iDiffMax = 100;
int g_iGameMode=0;
int g_iScore=0;
int g_iRight=0;
int g_iWrong=0;
question_t theQuestion;

menu_t g_menuMain, g_menuOptions, g_menuGameMode, g_menuOkCancel, g_menuNext, g_menuNextDone;

/*---------------------------------------------------------------------------
int main()
---------------------------------------------------------------------------*/
int main() {

// declarations
int looping=1;
int menu_index;
char *menulabels[] = {"EmpTrivia", NULL};
pthread_t theTimerThread;
pthread_attr_t attr;
unsigned long data=0, buttons[6] = {6,
IR_KNOB_PRESSED,
IR_KNOB_RELEASED,
IR_KNOB_LEFT,
IR_KNOB_RIGHT,
IR_TOP_BUTTON_PRESSED};

hijack_geom_t geom = {0,7,0,EMPEG_SCREEN_COLS-2}, fullscreen = {0,EMPEG_SCREEN_ROWS-1,0,EMPEG_SCREEN_COLS-1};

int xMenu;
int i;
int iChoice=0, iChoice2=0, iCategory=0;
unsigned int charS[5][3] = { { 1, 3, 3}, { 3, 1, 0}, { 1, 3, 1}, {0, 1, 3}, {3, 3, 1} };
FILE* imgfd;
FILE* fdConfig;
FILE* fdTriv;

int iNumCategories = -1;
int iCatNum = 0;
int iQuesNum = -1;



// create the main image object
if(!(image = gdImageCreate(EMPEG_SCREEN_COLS, EMPEG_SCREEN_ROWS))) {
fprintf(stderr, "Cannot create GD image\n");
exit(1);
}
// need to allocate colors for GD library
off = gdImageColorAllocate(image, 0, 0, 0);
dim = gdImageColorAllocate(image, 64, 64, 64);
med = gdImageColorAllocate(image, 128, 128, 128);
bri = gdImageColorAllocate(image, 255, 255, 255);

// main menu
strcpy(g_menuMain.szName, "Main");
g_menuMain.iNumChoices = 4;
strcpy(g_menuMain.aszMenuChoices[0], "Play");
strcpy(g_menuMain.aszMenuChoices[1], "Options");
// strcpy(g_menuMain.aszMenuChoices[2], "Fix");
strcpy(g_menuMain.aszMenuChoices[2], "About");
strcpy(g_menuMain.aszMenuChoices[3], "Quit");

strcpy(g_menuOptions.szName, "Options");
g_menuOptions.iNumChoices = 4;
strcpy(g_menuOptions.aszMenuChoices[0], "Game");
strcpy(g_menuOptions.aszMenuChoices[1], "Categories");
strcpy(g_menuOptions.aszMenuChoices[2], "Level");
strcpy(g_menuOptions.aszMenuChoices[3], "Back");

strcpy(g_menuGameMode.szName, "Game Mode");
g_menuGameMode.iNumChoices = 3;
strcpy(g_menuGameMode.aszMenuChoices[0], "Normal");
strcpy(g_menuGameMode.aszMenuChoices[1], "Survival");
strcpy(g_menuGameMode.aszMenuChoices[2], "Back");

strcpy(g_menuOkCancel.szName, "");
g_menuOkCancel.iNumChoices = 2;
strcpy(g_menuOkCancel.aszMenuChoices[0], "OK");
strcpy(g_menuOkCancel.aszMenuChoices[1], "Cancel");

strcpy(g_menuNext.szName, "");
g_menuNext.iNumChoices = 1;
strcpy(g_menuNext.aszMenuChoices[0], "Next");

strcpy(g_menuNextDone.szName, "");
g_menuNextDone.iNumChoices = 2;
strcpy(g_menuNextDone.aszMenuChoices[0], "Next");
strcpy(g_menuNextDone.aszMenuChoices[1], "Done");



/*
gdImageFill(image, 100, 16, dim);
gdImageArc(image, 100, 16, 32, 32, 0, 360, bri);
gdImageString(image, gdFontGiant, 3, 0, "[censored] you!", bri);
*/

fd = open("/dev/display", O_RDWR);

imgfd = fopen("ascii_small.gd", "r");

if ( imgfd == NULL) {
fprintf(stderr, "cannot open font file\n");
exit(-1);
}

// rc = ioctl(fd,EMPEG_HIJACK_SETGEOM, &geom);
// printf("geom set\n");
// checkRC("setgeom()\n", rc);

teenyFontImage = gdImageCreateFromGd(imgfd);

fclose(imgfd);

imgfd = fopen("leftarrow.gd", "r");
if ( imgfd == NULL) {
fprintf(stderr, "cannot open font file\n");
exit(-1);
}
leftArrowImage = gdImageCreateFromGd(imgfd);

fclose(imgfd);

imgfd = fopen("rightarrow.gd", "r");
if ( imgfd == NULL) {
fprintf(stderr, "cannot open font file\n");
exit(-1);
}
rightArrowImage = gdImageCreateFromGd(imgfd);

fclose(imgfd);



srand( time(NULL)) ;
loadCats();

/*
rc = pthread_attr_init(&attr);
checkRC("pthread_attr_init()\n", rc);

rc = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
checkRC("setdetachstate()\n", rc);

rc = pthread_create(&theTimerThread, &attr, timerThread, NULL);
checkRC("pthread_create()\n", rc);

rc = pthread_join(theTimerThread, NULL);
*/

// -======================================================================-
// main program loop
// -======================================================================-
top:
while (1) {
looping = 1;

rc = ioctl(fd, EMPEG_HIJACK_WAITMENU, &menulabels);
if (rc < 0) {
fprintf(stderr, "rc waitmenu: %d", rc);
}
else {
menu_index = rc;
}

rc = ioctl(fd,EMPEG_HIJACK_BINDBUTTONS, buttons);
if ( rc != 0) {
fprintf(stderr, "rc bind: %d", rc);
}

while (looping) {
clearScreen();
iChoice = chooseMenu(g_menuMain, 1, 0, iChoice);
switch (iChoice) {
case 0:
play();
break;
case 1:
clearScreen();
optionsMenu();
break;
case 2:
//fixAscii();
showAbout();
//askQuestion( 0, 40 );
break;
case 3:
clearScreen();
looping = 0;
goto top;
break;
case 4:
looping=0;
break;
default:
break;
}
}
}}

_________________________
- Tony C
my empeg stuff

Top
#77791 - 27/03/2002 21:25 Re: games [Re: tonyc]
kswish0
enthusiast

Registered: 06/02/2002
Posts: 212
Loc: Virginia, USA
just a follow up to see if anyone is having any luck with any of this. is anyone actually trying or did you all just give up?

Top
#77792 - 30/03/2002 03:22 Re: games [Re: kswish0]
justinlarsen
old hand

Registered: 31/12/2001
Posts: 1109
Loc: Petaluma, CA
i gave up, all the stuff i created jsut enede up being too buggy and crashign the player after 2min of play, it worked fine without the players software running, but when i tried to get it to work on top, it was just too much, oh well
_________________________
---- Justin Larsen

Top