FRONTIER 1337 - a port of FRONTIER: Elite II for PSP

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

FRONTIER 1337 - a port of FRONTIER: Elite II for PSP

Post by Ats »

Hi everyone!
I'm pretty new to c development but lately, I've managed to compile rRootage for PSP following Deniska's rRootage fast porting tutorial. Easy and cool!
So I think to myself "Let's go on, cut some corners and try to port Frontier: First Encounters..."

I used JJFFE sources, a recompiled replacement executables that can be found at http://www.eliteclub.org.uk/
After some tries, I recognize that porting a game is not as easy as Deniska claims it. In fact, I've got problems with the Makefile and with some mismatch in operand sizes in ASM file...
Can someone more experienced than me put an eye on JJFFE sources and tell me if it is possible to port it, or if I'm wasting my time?
Thank you.
Last edited by Ats on Wed May 17, 2006 1:59 am, edited 2 times in total.
Jabberwocky
Posts: 43
Joined: Wed Aug 03, 2005 6:58 pm

Post by Jabberwocky »

With a brief scan through the source distribution, I would say this would be a big job. There's lots of decompiled x86 assembly from the original game (I'm guessing), which you need an x86 compatable processor to run. As the PSP uses a MIPS, you're out of luck unless you rewrite all the assembly code. Not something I'd want to do... look for a game which already runs on multiple processors if you want something to port.

-Jw
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Ok, thanks for the quick reply.
Never mind, I will find something else to work on :)
User avatar
groepaz
Posts: 305
Joined: Thu Sep 01, 2005 7:44 am
Contact:

Post by groepaz »

.o(subliminal message: ABUSE_SDL)

:=P
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

not dead yet

Post by Ats »

.o(subliminal message: ABUSE_SDL)
Nice try groepaz :)

I've found some new code of a reverse-engineering Frontier Elite 2 here: http://soul-less.pwp.blueyonder.co.uk/glfrontier/

The author says the native frontier 68k code can be compiled either to i386 asm or to C source file, and that it should be trivial to port to other platforms with SDL.
I study all this right now while installing psptoolchain (again). :)
Last edited by Ats on Sat Apr 22, 2006 5:53 am, edited 1 time in total.
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

I wrote to the author of FrontierVM to ask him some questions. Thanks for his quick reply.


Can the 68k assembly language be compiled to MIPS processor (PSP) by generating the huge C source file?

> Yes. The C output mode should compile for any CPU although this hasn't been tested and there may be endian issues to be debugged. Of course the ideal solution would be for someone to write a MIPS asm generating bit for as68k, like x86 has.

When I try to compile frontvm3-20060226 Makefile-C (not for PSP), I'm having some troubles with fe2.part2.o
For example:
fe2.s.c: In function `__F28ed2':
fe2.s.c:35091: error: parse error before "s32"
fe2.s.c: In function `__F28ed8':
fe2.s.c:35124: error: parse error before "s32"
... and so on

> What exactly is at fe2.s.c at these line numbers?
s32 should be defined 'typedef signed int s32' somewhere in _host.c iirc.
I can't check because I'm not at my usual computer.

I'm working under Cygwin with SDL, openGL and other libs properly installed. Can you give me a clue to pass through this?

> Is this some weird cross-compiler setup for building PSP binaries, or a question related to building a win32 binary? For win32 I used mingw not cygwin, and there is a makefile in the archive for mingw. Otherwise I'm not sure but try adding the typedef (which is there anyway and surely this couldn't possibly happen...) or find out what is at those lines that it pukes at.


I continue my research :)
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Hi.
Today I had time to take a new look at Frontier code. With the help of Tom Morton, I manage to compile the game correctly for win32 using the 68k to C source file.

Now I'm trying to compile it as an eboot.
I changed the screen.c and input.c to fit them for the psp. This should work but I'm not very at ease with Makefile, especially when there are several of them. In fact, there is a Makefile for the project itself and another for the c files that are in another folder.

Here's the first one :

[Makefile-C]

Code: Select all

export CC = gcc
export CFLAGS = -O2 -g -Wall
export LIBS = -lglu32 -lopengl32 -lvorbisfile -lvorbis -logg
export FE2OBJS = ../fe2.part1.o ../fe2.part2.o

THIS = Makefile-C

default:
	$(MAKE) -C as68k/
	$(MAKE) -f $(THIS) fe2obj
	$(MAKE) -C src/

fe2obj:
	as68k/as68k --output-c fe2.s
	$(CC) -DPART1 -O1 -fomit-frame-pointer -Wall -Wno-unused -s `sdl-config --cflags` -c fe2.s.c -o fe2.part1.o
	$(CC) -DPART2 -O0 -fomit-frame-pointer -Wall -Wno-unused -s `sdl-config --cflags` -c fe2.s.c -o fe2.part2.o
and the other one :

[./src/Makefile]

Code: Select all

SDLLIB = $(shell sdl-config --libs) $(LIBS)
SDLFLAGS = $(shell sdl-config --cflags) -L/usr/X11R6/include

SRCS = audio.c hostcall.c keymap.c main.c screen.c shortcut.c input.c

OBJS = $(SRCS:.c=.o)

.c.o:
	$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;INCFLAGS&#41; $&#40;SDLFLAGS&#41; -c $<

../frontier&#58; $&#40;OBJS&#41;
	$&#40;CC&#41; $&#40;OBJS&#41; $&#40;FE2OBJS&#41; $&#40;SDLLIB&#41; $&#40;LIBFLAGS&#41; -o ../frontier
Can a more advanced user help me to create a Makefile for psp?
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Now I have only one Makefile :

Code: Select all

CC = gcc
CFLAGS = -O2 -g -Wall
LIBS = -lglu32 -lopengl32 -lvorbisfile -lvorbis -logg

SDLLIB = $&#40;shell sdl-config --libs&#41; $&#40;LIBS&#41;
SDLFLAGS = $&#40;shell sdl-config --cflags&#41; -L/usr/X11R6/include

FE2OBJS = fe2.part1.o fe2.part2.o
SRCS = src/audio.c src/hostcall.c src/keymap.c src/main.c src/screen.c src/shortcut.c src/input.c

OBJS = $&#40;SRCS&#58;.c=.o&#41;

THIS = Makefile

default&#58;
	$&#40;MAKE&#41; -C as68k/
	$&#40;MAKE&#41; -f $&#40;THIS&#41; fe2obj
	$&#40;MAKE&#41; -f $&#40;THIS&#41; .c.o
	$&#40;MAKE&#41; -f $&#40;THIS&#41; frontier

fe2obj&#58;
	as68k/as68k --output-c fe2.s
	$&#40;CC&#41; -DPART1 -O1 -fomit-frame-pointer -Wall -Wno-unused -s `sdl-config --cflags` -c fe2.s.c -o fe2.part1.o
	$&#40;CC&#41; -DPART2 -O1 -fomit-frame-pointer -Wall -Wno-unused -s `sdl-config --cflags` -c fe2.s.c -o fe2.part2.o

.c.o&#58; $&#40;SRCS&#41;
	# $&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;SDLFLAGS&#41; -c $<
	$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;SDLFLAGS&#41; -c src/audio.c -o src/audio.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;SDLFLAGS&#41; -c src/hostcall.c -o src/hostcall.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;SDLFLAGS&#41; -c src/keymap.c -o src/keymap.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;SDLFLAGS&#41; -c src/main.c -o src/main.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;SDLFLAGS&#41; -c src/screen.c -o src/screen.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;SDLFLAGS&#41; -c src/shortcut.c -o src/shortcut.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; $&#40;SDLFLAGS&#41; -c src/input.c -o src/input.o

frontier&#58; $&#40;OBJS&#41; $&#40;FE2OBJS&#41;
	$&#40;CC&#41; $&#40;OBJS&#41; $&#40;FE2OBJS&#41; $&#40;SDLLIB&#41; -o frontier
Just for my thirst of knowledge, how can the .c.o part be optimized?
Next stage: translate this Makefile to compile an eboot (a little assistance is always welcome).
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Welcome back in my topic where I speak all alone and nobody seems to care. :D

Today I have translated the win32 Makefile-C into PSP Makefile. The compilation is working fine until it's reaching the objects linking.
screen.o is asking some OpenGL functions that are not implemented yet in PSPGL.

Those are:

glColor3ui
glLightiv
glPointSize
glVertex3iv

gluCylinder
gluDisk
gluErrorString
gluNewQuadric
gluNewTess
gluTessBeginContour
gluTessEndContour
gluTessBeginPolygon
gluTessEndPolygon
gluTessCallback
gluTessProperty
gluTessVertex

After spending some search time here and there, I still dont know if those functions will be implemented to PSPGL in the future.
Since I am new to OpenGL, I think I will wait for this functions to come out...
But I will also improve my skills to try to bypass this problem.

Next stage: Compile the game without screen display to see if I can get an eboot.
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

I care, I care!

I would recommend replacing the missing functions with appropriate (usually empty) stubs just to get it compiling.

By the sounds of it, you've got a lot of code there. With the PSP being as tricky to code for as it is, and you being as new to this as you are, you need to get a simple version running on hardware before it gets too complex to debug.

Because it will crash when you run it, and you'll need to find out why.

Pete
crowba
Posts: 13
Joined: Sat Oct 15, 2005 1:58 pm

Post by crowba »

I care too, really looking forward to an Elite II port.. i wish you all the luck !!!
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

For the moment, I totally disabled the rendering of the screen to compile the eboot.
On the PSP, the game itself can't be launched without the data file fe2.s.bin in the same folder, so this is a good point.
Because it will crash when you run it, and you'll need to find out why.
Indeed! I get the blue crash screen, all is "normal" :)

But after correcting four little_endian conversions errors, I get another error that goes like this:

Code: Select all

psp-addr2line -e frontier.elf -f -C 0x8d5ab14 0x408b000 0x8d5aab0
_free_r
../../../../../newlib/libc/stdlib/mallocr.c&#58;2696
??
??&#58;0
_free_r
../../../../../newlib/libc/stdlib/mallocr.c&#58;2632
Do you know if this could come from the RAM needed by the game to be launched? Or is it another kind of problem?
Please, give me a clue so that I can continue to battle on this after a good sleep :)
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

Could be trying to free a null pointer?
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Apparently, the problem comes from audio.c

With the audio totally disabled, the eboot is working correctly without blue screen. But as the screen display is still disabled, the game is nothing more than a black screen...

Next stage: Try to get screen.c works (a little) without the missing OpenGL functions.
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Yesterday, I made the mouse pointer to show up during the game, but nothing more because all the openGL functions gave me a blue screen. So after a lot of tries and searching through the forum, I found this post.
As I had installed SDL before PSPGL, I didn't know if -D HAVE_OPENGL was automatically added in the CFLAGS of SDL makefile. So I decided to install SDL once again, and check if this flag was there.

Now all openGL functions seems to be working on the PSP, no blue screen anymore :)
But all I get is a black window on a nightblue screen, and the mouse pointer that appears at the end of the introduction time.
A log.txt is automatically created by PSPGL at the root of memory card to tell what's wrong: the problem comes from glTexImage2D and glTexSubImage2D, that are only used once respectively in the Screen_Init and draw_control_panel function.

Code: Select all

*** GL error 0x0500 in glTexImage2D ***
*** GL error 0x0502 in glTexSubImage2D ***
To start, can you help me to find where is the error in Screen_Init function, or give me a hint so that I can get rid of the problem myself?

Code: Select all

#define SCR_TEX_W	512
#define SCR_TEX_H	256

// The SDL screen surface
SDL_Surface *sdlscrn;
                        
// fe2 UI blits are done to old screen memory and copied to this texture.
static unsigned int screen_tex;

// Set window size, I kept the original 1.6 ratio for now
int screen_w = 432;
int screen_h = 270;

void Screen_Init&#40;void&#41;
&#123;
	const SDL_VideoInfo *info = NULL;
	float ratio;
	int _3dview_h;

	info = SDL_GetVideoInfo &#40;&#41;;

	assert &#40;info != NULL&#41;;

	SDL_GL_SetAttribute &#40;SDL_GL_DOUBLEBUFFER, 1&#41;;

	if &#40;&#40;sdlscrn = SDL_SetVideoMode &#40;screen_w, screen_h, info->vfmt->BitsPerPixel, SDL_OPENGL | SDL_DOUBLEBUF&#41;&#41; == 0&#41; &#123;
		fprintf &#40;stderr, "Video mode set failed&#58; %s\n", SDL_GetError &#40;&#41;&#41;;
		SDL_Quit &#40;&#41;;
		exit &#40;-1&#41;;
	&#125;

	_3dview_h = screen_h - &#40;32*screen_h&#41;/200;
	ratio = &#40;float&#41; screen_w / &#40;float&#41; _3dview_h;
	
	glDisable &#40;GL_CULL_FACE&#41;;
	glShadeModel &#40;GL_FLAT&#41;;
	glDisable &#40;GL_DEPTH_TEST&#41;;
	glClearColor &#40;0, 0, 0, 0&#41;;

	glViewport &#40;0, 32*screen_h/200, screen_w, _3dview_h&#41;;
	glMatrixMode &#40;GL_PROJECTION&#41;;
	glLoadIdentity &#40;&#41;;

	glEnable &#40;GL_TEXTURE_2D&#41;;
	glGenTextures &#40;1, &screen_tex&#41;;
	glBindTexture &#40;GL_TEXTURE_2D, screen_tex&#41;;
	glTexImage2D &#40;GL_TEXTURE_2D, 0, GL_RGBA, SCR_TEX_W, SCR_TEX_H, 0, GL_RGBA, GL_INT, 0&#41;;
	glTexParameterf &#40;GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP&#41;;
	glTexParameterf &#40;GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP&#41;;
	glTexParameterf &#40;GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST&#41;;
	glTexParameterf &#40;GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST&#41;;

	glBlendFunc &#40;GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA&#41;;
	glDisable &#40;GL_TEXTURE_2D&#41;;

	glClear &#40;GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT&#41;;
	glMatrixMode &#40;GL_MODELVIEW&#41;;
	glLoadIdentity &#40;&#41;;

	// Configure some SDL stuff
	SDL_EventState&#40;SDL_MOUSEMOTION, SDL_ENABLE&#41;;
	SDL_EventState&#40;SDL_MOUSEBUTTONDOWN, SDL_ENABLE&#41;;
	SDL_EventState&#40;SDL_MOUSEBUTTONUP, SDL_ENABLE&#41;;
	SDL_ShowCursor&#40;SDL_ENABLE&#41;;
&#125;
Thank you.
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

From gl.h

Code: Select all

#define GL_INVALID_ENUM				0x0500
#define GL_INVALID_OPERATION			0x0502
So you're passing dud values to glTexImage2D, some unknown pixel format for instance.

Jim
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Thank you Jim :D
Now I know where the PSPGL error list was hiden.

The error was :
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, SCR_TEX_W, SCR_TEX_H, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
instead of GL_INT.

Now the game is working on the PSP!
The framerate is slow and there is no button input yet, but the introduction sequence is playing fine without any graphical glitches!
Do you have some advises to give me for the framerate improvement?

I will make a special page for the game on my website when I'll have the time.

Next stage: Allow the joystick input.
Mike/Pippin
Posts: 40
Joined: Sun Jun 05, 2005 4:23 am

Post by Mike/Pippin »

Is the PSP CPU on 222mhz or at 333mhz. If its at 222mhz then change to 333mhz.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

Mike/Pippin wrote:Is the PSP CPU on 222mhz or at 333mhz. If its at 222mhz then change to 333mhz.
Um... why? Unless there is some major reason to, you're just going to drain the batteries faster...
Shoot Pixels Not People!
Makeshift Development
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Pre-swizzling textures, storing/caching textures in vram, using smaller vertex formats, using display lists instead of banging away at glVertex - these are all ways of speeding it up. Look at pspgl and see where the optimal path is...

Jim
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Thanks for your answers.

I tried Frontier at 333Mhz using iR Shell. The framerate is a little faster than before, but I don't think this is the good solution.

For the moment, the original as68k sourcecode from the Atari game can be converted either to i386 ASM (very good for x86 PC but does not work on PSP) or C (huge 8Mo file that is not optimized at all). I talked with Tom Morton (the author of GLFrontier) and the best way to have direct results in speed increase would be to write an as68k converter to MIPS ASM... Too difficult for me as I know almost nothing in ASM.

So I can only improve the SDL/OpenGL part by following the advices of Jim, and I hope it will be enough...
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

Have you tried compiling with -Os, -O2 or -O3 if that doesn't break it?

Also, is 8MB the stripped exe?
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Here's the Makefile that I made with commentaries inside.
I compile the game by typing: make default kxploit

Code: Select all

TARGET= frontier
PSPSDK = $&#40;shell psp-config --pspsdk-path&#41;
PSPBIN = $&#40;shell psp-config --psp-prefix&#41;/bin
SDL_CONFIG = $&#40;PSPBIN&#41;/sdl-config

DEFAULT_CFLAGS = $&#40;shell $&#40;SDL_CONFIG&#41; --cflags&#41;
MORE_CFLAGS = -O2 -g -Wall
CFLAGS = $&#40;DEFAULT_CFLAGS&#41; $&#40;MORE_CFLAGS&#41;

LIBS = -lGL -lpspvfpu $&#40;shell $&#40;SDL_CONFIG&#41; --libs&#41;

THIS = Makefile

OBJS = src/audio.o src/hostcall.o src/keymap.o src/main.o src/screen.o src/shortcut.o src/input.o fe2psp.part1.o fe2psp.part2.o

default&#58;
	# Compile the as68k.exe that will convert as68k to i386 ASM or C file
	# It's got his own makefile as it is a PC program
	$&#40;MAKE&#41; -C as68k/
	# Convert the fe2.s as68k file to fe2.s.c &#40;huge source file&#41;
	# and fe2.s.bin &#40;file needed by the game to be launched&#41;
	$&#40;MAKE&#41; -f $&#40;THIS&#41; fe2obj
	# Compile the SDL/OpenGL/audio/input/display part
	$&#40;MAKE&#41; -f $&#40;THIS&#41; srcobj

fe2obj&#58;
	as68k/as68k --output-c fe2.s
	# Unlike the PC version, I can't optimize this part at all, it gives me an error like
	# cc1&#58; out of memory allocating 1863535968 bytes after a total of 62455800 bytes
	$&#40;CC&#41; -D PART1 -D LITTLE_ENDIAN -O0 -fomit-frame-pointer -Wall -Wno-unused -s $&#40;DEFAULT_CFLAGS&#41; -g -c fe2.s.c -o fe2psp.part1.o
	# This part can be optimized up to O3 but I don't know yet if it is better or not
	$&#40;CC&#41; -D PART2 -D LITTLE_ENDIAN -O2 -fomit-frame-pointer -Wall -Wno-unused -s $&#40;DEFAULT_CFLAGS&#41; -g -c fe2.s.c -o fe2psp.part2.o

srcobj&#58;
	# I didn't try it before, but this part can also be optimized up to O3
	$&#40;CC&#41; $&#40;CFLAGS&#41; -c src/audio.c -o src/audio.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; -c src/hostcall.c -o src/hostcall.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; -c src/keymap.c -o src/keymap.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; -c src/main.c -o src/main.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; -c src/screen.c -o src/screen.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; -c src/shortcut.c -o src/shortcut.o
	$&#40;CC&#41; $&#40;CFLAGS&#41; -c src/input.c -o src/input.o

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = FRONTIER - Elite II
PSP_EBOOT_ICON = icon.png

include $&#40;PSPSDK&#41;/lib/build.mak
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

Congrats on your progress!

By the way, have you looked at Frontier: Elite 2 for the Atari ST running on CaSTaway PSP also? That should give you an indication of the kind of speed you should at the very least be able to manage, I think. My experience so far is that this Atari ST emulator is able to run nearly all games at pretty much full speed - I use and enjoy it a lot.
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

Thank you, although I got a lot more to do...
I tried Frontier on CaSTaway (Atari ST) and even on PSP-UAE (Amiga) months ago. For now, the Atari emulator is faster than my port :( but has a lot of graphical glitches :)
Anyway, I started to make a mini-site for the game. It's explaining the futur features and you can try the game controls on a Flash mockup.
Here it is: http://atien.free.fr/jeux/1337/index.htm
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

congrats site looks very simple and accessible
to users ...good luck with this game
10011011 00101010 11010111 10001001 10111010
Erant
Posts: 33
Joined: Fri May 13, 2005 6:19 am

Post by Erant »

Looks like an amazing effort. I really liked Frontier, back in the days. I hope you get it to go a bit faster, as I'd be really interested in playing this!

Edit:

You could ofcourse try compiling everything with -O3. If it doesn't break it.
Live free, prosper, and under my rule.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

Erant wrote:Looks like an amazing effort. I really liked Frontier, back in the days. I hope you get it to go a bit faster, as I'd be really interested in playing this!

Edit:

You could ofcourse try compiling everything with -O3. If it doesn't break it.
-O3 rarely makes anything faster, and in many cases makes code slower.
The primary difference between -O3 and -O2 is that -O3 unrolls just about every loop it can, which trashes the instruction cache in order to possibly save some time by getting rid of the branches from the loop...

In a lot of cases, especially on archs with small instruction caches and/or big hits for cache misses, this can slow things down quite noticably, and except in the very best of cases the gain is rarely noticable.
Shoot Pixels Not People!
Makeshift Development
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

-O3 provided a visible speed-up over -O2 and -Os in Quake, but I accept that it doesn't guarantee better performance for other projects.

So Quake is definitely one of the "very best of cases" ;-)
Ats
Posts: 37
Joined: Mon Dec 05, 2005 6:08 am
Location: Biarritz - France
Contact:

Post by Ats »

In fact, part2 optimized to -O3 makes the game slower. But it would be very good if I was able to optimize the part1.
This leads me to some questions ^^'

First, is the cc1: out of memory allocating can be bypassed for optimising the part1?
I'm using cygwin under winXP with a 2.16GHz AMD Athlon and 512Mo of RAM.
Should I buy another memory chip? Freeing some memory by shuting down every win32 little things? Get rid of windows :D ?
I need to compile it only once because it is a lot of little ASM functions and I don't want to touch it for now.

Second: I finished to map all the PSP buttons and it works great. The only thing which lack is the joystick.
I need to replace this code:

Code: Select all

case SDL_MOUSEMOTION&#58;
	// Relative motion in the X/Y direction
	motion_x += event.motion.xrel;
	motion_y += event.motion.yrel;
	// The X/Y coordinates of the mouse
	abs_x = event.motion.x;
	abs_y = event.motion.y;
break;
by this one:

Code: Select all

case SDL_JOYAXISMOTION&#58;
	if &#40;&#40;event.jaxis.value < -3200&#41; || &#40;event.jaxis.value > 3200&#41;&#41; &#123;
		if &#40;event.jaxis.axis == 0&#41; &#123;
			// some code here using event.jaxis.value to obtain motion_x and abs_x
		&#125;
		if &#40;event.jaxis.axis == 1&#41; &#123;
			// Same code but for motion_y and abs_y
		&#125;
	&#125;
break;
What is the best way to convert joystick motion into mouse coordinates and motion? I didn't find any example.
Thank you!

With the joystick working, I'll then take care of the rendering optimization in order to gain machspeed, because the game is in slooooow motion. :(

EDIT: Ok, so after getting some sleep, i found the solution in 5 seconds...

Code: Select all

case SDL_JOYAXISMOTION&#58;
	switch &#40;event.jaxis.axis&#41; &#123;
		case 0&#58; motion_x = event.jaxis.value / 6500; break;
		case 1&#58; motion_y = event.jaxis.value / 6500; break;
	&#125;
break;
and outside the SDL events:

Code: Select all

abs_x += motion_x;
abs_y += motion_y;
I need to sleep more :D
Post Reply