PDA

View Full Version : Need help porting an MMORPG client


Radu
2005.03.12, 02:43 AM
We (the Eternal Lands (http://www.eternal-lands.com) team) are looking for a programmer that has access (preferably at home) to an OSX machine, and knows C.

Eternal Lands is a relatively successful MMORPG, with over 300 players playing at the same time every day of the week, and more than 400 playing in the weekends. The current record of players online is 466, but we estimate it to increase over 500 by the end of the spring.

Our MMORPG's client is Open Source, and it currently runs fine on pretty much any OS that has OpenGL (Windows, Linux, FreeBSD, and other Unix clones), and on any little endian processor.
The libraries used are: OpenGL, SDL, SDL_net, OpenAL, libxml2, and ogg/vorbis, so I don't forsee any problem related to them.

Now, our goal is to find someone to fix the endian stuff so that it can work on big endian CPUs, especially for OSX computers.
If possible, this person should also provide an OSX binary every time we update the game (which is every few months). This is not necesary, but it would be nice.

The payment: The client is an Open Source project, and the game is free. We do make some income, but not enough to pay a good programmer (much less live off the game). However, I can offer some money (~200 USD) for you work.
If you are interested, please reply to this thread, OR, if you want, you can post in our programming forum (http://www.eternal-lands.com/forum/index.php?showforum=6).

P.S. The other programmers will happily assist you if you have questions, problems, etc.
Thank you,
Radu

Corun
2005.03.12, 10:10 AM
It sounds incredably easy to port. I'll have a look at it this afternoon and tell you how easy it will be. I've managed to port another sdl/gl game to OS X in an afternoon but it didn't do networking.. Well, I'll let you know how I get on.

Radu
2005.03.12, 01:34 PM
The graphic code shouldn't be very hard to port, but the networking code will take a while, because we use a lot of pointer casting in pretty much any command from the server.
If you have any questions, please let us know.

Corun
2005.03.12, 02:04 PM
Ok pointer casting of network stuff shouldn't be too much of a problem (unless you use bitfield structs). It's pretty close to compiling at the moment. I am just about to compile cal3d for X. You sure have used a lot of libraries!

Do you have an IRC Channel or some instant message based communication?

Radu
2005.03.12, 02:08 PM
You don't need cal3d right now, it's used only for some development testing (I think by default it doesn't even include it).
Yes, we used a lot of libraries, but most of them are sort of necesary, with the exception of libxml2 (we could have used other ways to read some files, but it was easier this way).
I'll send you a PM for my ICQ number and e-mail address.

[edit]
Hmm, can't send you a PM or e-mail . Please contact me at chaos_rift at yahoo.com

Corun
2005.03.12, 06:59 PM
Not sure what's wrong with my email...

So far I've managed to get everything compiling and running properly. Networking isn't working because of endian problems and I'm currently working on making your md2 loader endian happy.

Radu
2005.03.12, 08:49 PM
Great, please let me know of you progress.
Did you manage to identify which parts need changes?

Corun
2005.03.12, 09:11 PM
Wow. Everywhere I look you are reading straight in to structs. It's getting really repetative putting in this endian stuff. MD2 works now and everything works fine up untill you press done on the character create screen at which point it crashes while loading the map. I'm in the middle of making the map loading endian happy at the moment.

Radu
2005.03.12, 09:21 PM
Yes, reading from structures is not the most portable thing in the world, but it works fine under most of the cases and it's the fastest way.
BTW, while changing the code, can you please use #ifdef MAC or something like that, so that we can use the same source file to compile for all the platforms?

OneSadCookie
2005.03.12, 09:35 PM
should probably use BIG_ENDIAN, since there are other big-endian platforms (PPC linux, for example) :p

Radu
2005.03.12, 09:45 PM
Yes, actually two defines would be needed: MAC and BIG_ENDIAN
The BIG_ENDIAN should be used for endian purposes, and the MAC one for other stuff such as using only one mouse button, the paste code (ctrl+v), and possibly other MAC specific changes.

Blorx2
2005.03.13, 12:21 AM
Don'tknow how to port, but I'd love to beta test it! :D Can you post a link here when it's done being ported?

Radu
2005.03.13, 12:34 AM
Of course :)
Once it's ported and it's relatively stable, we'll need as many people as we can get to test the new client.

Puzzler183
2005.03.13, 10:19 AM
Raduprv? Well well, when I first saw the MMORPG thing, I was sad for a sec and then I saw Radu and hoped it was you. Good to see you here:).

Radu
2005.03.13, 11:27 AM
Yeah, it's me :)
Good to see someone I know posting here :)

Corun
2005.03.13, 12:59 PM
http://www.evula.org/corun/elscreen.jpeg

:-D

Problems at the moment:

- Music is off
- There looks to be some weird z buffer fighting with the snow..Is that a mac os x bug or is it on the pc version aswell?
- Bags never seem to contain anything... Is that right or am I doing something wrong?
- Probably an endian swap or two that I missed out.
- The "overall" bar at the bottom shows a minus number... Is that right?
- No pasting yet
- Delete key doesn't work.
- Loading seems slow... Possibly because I have to endian swap a lot.
- Anything else look wrong from that screenshot?

Radu
2005.03.13, 01:35 PM
Wow, that's great! :)
The music is not distributed by default, because it's big. You can try getting it from: http://el.tfm.ro/music.zip
Here is more info on how to isntall the music, if there are probems: http://www.eternal-lands.com/forum/index.php?showtopic=9891

There is some Z fighting in the game, but that depends on the video card, video mode, etc. Is it really bad, or just some 2d objcts flickering?

The bags always contain something, otherwise they dissapear (if you take everything out)

The bars should always be positive, except for the food bar (the one that is -1 in that screen shot)

How slow is it? Like how many seconds until the game loads, after you press the "done" button?

Puzzler183
2005.03.14, 11:11 AM
For the record, endian conversions shouldn't be too slow... I know on x86 platforms there is the bswap instruction which ine 1 clock (IIRC) will do an endian swap. If there isn't something like that on Mac, you might be better off storing as big endian and then doing conversions on x86 stuff since it's fast and big endian is network byte order anyway.

OneSadCookie
2005.03.14, 03:15 PM
PowerPC has load word byte reversed instructions, but they're probably no great win.

Make sure your endian conversion routines are inlined ;)

Radu
2005.03.14, 06:33 PM
Well the thing is that we load the some files from the disk as a structure. So on x86 and other little endian CPUs you can just load the file in the memory, and there you have it. But on big endian CPUs you have to process the files as well, not just load it in the memory, and that takes some time.

Anyway, we can't change the order of the bytes we send, would require a lot of work (server and client), and most of our players use little endian CPUs anyway.

Corun
2005.03.15, 06:46 AM
Ok, most things are fixed now. I can't do any work on it during the week though. I will be done by the weekend.

Radu
2005.03.15, 05:21 PM
Great, thanks a lot and take your time!

schnarr
2005.03.16, 02:09 PM
I thought I should warn you that BIG_ENDIAN appears to be defined in GCC 3.4, as I found while the port I'm working on. Basically, it compiled fine on mac, but when I tried the same code on my little-endian Mandrake 10.1 box it failed to compile (more specifically, it interpreted BIG_ENDIAN as true, which it wasn't! I even tried passing the undefine BIG_ENDIAN macro flag into the compiler without luck). Another developer running gcc 3.3 on his SuSE linux box compiled the code without a hitch, as did I a few months back running GenToo (also 3.3, I think - lost the drive, so I don't remember) so it appears to be something added between 3.3 and 3.4.

I would strongly recommend using a different name or at least testing the code on a little endian linux box with a 3.4 compiler and making sure I wasn't just seeing a quirk (I was running 10.1beta and upgraded to 10.1, so there is potential).

Radu
2005.03.16, 07:31 PM
Thanks for the warning. Perhaps we can name the define something like EL_BIG_ENDIAN

Blorx2
2005.03.19, 01:59 AM
Hey, Corun and Radu, how do you like the game? I've been waiting to play and need a little background info

Radu
2005.03.19, 11:38 AM
Well, I am not the best person to ask on how I like the game, since I am the project manager, and was, until recently, the lead programmer (right now I am working at another game, but still oversee the EL development).
Corun didn't have much time to actually play the game, so he can't really say how he lieks the game. But anyway, a lot of people like it, and a lot of people don't like it, so you'll have to see for yourself, once it's ported :)

Blorx2
2005.03.21, 08:04 PM
Where's Corun? He was going to update us on what's going on this weekend...I wonder what kept him

Radu
2005.03.22, 12:16 AM
He is posting on our programming forums.
Basically he got almost everything (important) working fine, hopefully next week or so there will be an alpha binary for OSX.

Blorx2
2005.03.22, 08:15 AM
Ok, that works...didn't notice that he went on the EL forums

nabobnick
2005.03.22, 06:50 PM
If you want examples on how to incorporate the reversed load assembly instructions check out the file (and related files in i386/ppc/machine):

/System/Library/Frameworks/Kernel.framework/Headers/libkern/OSByteOrder.h

You cannot link to this framework and use it directly but you can copy the code and modify it to suit your tastes. If you just need little endian support you can simplify the code a bit. Also included are the #define's to check to see if the system is little or big endian and to check if the processor/compiler supports the assembly instructions. And lastly there is a generic implementation of byte swapping if you don't want to use the assembly instructions.

OneSadCookie
2005.03.22, 07:03 PM
/usr/include/gcc/darwin/default/ppc_intrinsics.h (#include <ppc_intrinsics.h>) has user-visible functions that expand to the load and store byte reversed instructions, as well as many other useful ones:

* Byte-Reversing Functions
* __lhbrx - Load Half Word Byte-Reverse Indexed
* __lwbrx - Load Word Byte-Reverse Indexed
* __sthbrx - Store Half Word Byte-Reverse Indexed
* __stwbrx - Store Word Byte-Reverse Indexed

nabobnick
2005.03.23, 11:34 PM
After looking closer it looks like it's safe to use both CFByteOrder.h (Carbon) and NSByteOrder.h (Cocoa) functions instead of rolling your own. Both sets of functions are static inline and both sets use the optimized assembly code when available.

Raylborn
2005.04.04, 09:34 PM
Yea where is he? I've been following this cuz the game looks fun and interesting. I was hoping to play soon.

Corun
2005.04.05, 12:20 AM
Sigh. Give me a chance!

I'm basically done. Watch eternal-lands.com over the next few days and it will probably appear

Raylborn
2005.04.05, 05:41 PM
Woohoo! I cant wait, thanks a lot man!

Radu
2005.04.08, 09:50 PM
Here is a test version: http://el.tfm.ro/elc-osx.zip
Please let us know if it works, if there are bugs, etc.

Raylborn
2005.04.09, 01:41 PM
Its very cool, but laggy. What are mim reqs? Im running a 400mhz g3, its fast on every other game I play. Hmmm...maybe fix the laggyness :(

Radu
2005.04.09, 02:43 PM
What video card do you have? And how many FPS do you see in the game? (upper left corner)

Raylborn
2005.04.10, 02:43 AM
Not sure but I can play Diablo 2 and Warcraft 3 perfectly.

Corun
2005.04.10, 03:12 PM
Is it a Blue and White G3?
If so then it doesn't even have an AGP graphics slot...

Try running it in a lower resolution, less graphics options, in fullscreen etc.

PowerMacX
2005.04.11, 01:03 AM
Found a bug: the delete key doesn't seem to work. No other problems so far (except trying to read that ugly-looking text ;) )

OS X 10.3.8, Rage 128 Pro 16MB

Raylborn
2005.04.24, 02:20 PM
No it isnt blue and white but it is g3, its one of those white ones. I'll check if it runs good on my G4.

Raylborn
2005.04.24, 02:28 PM
Hmmm this is weird. Ony my G4 the little paper with pencil thing wont open, on any program. Any idea whats wrong?

socksy
2005.04.24, 05:36 PM
Did you check the console?

Raylborn
2005.04.24, 11:48 PM
What d'you mean check the console?

PowerMacX
2005.04.25, 12:25 AM
Hmmm this is weird. Ony my G4 the little paper with pencil thing wont open, on any program. Any idea whats wrong?

little paper with pencil thing

:lol:

New Mac user? :)

You can find the console in Applications/Utilities. Double click on the game and watch the text that appears in the console, then post it here.

socksy
2005.04.25, 01:28 PM
As the last guy wasn't too informative on what it was (no offence meant), the little paper with a pencil on it is an application. You don't open it with anything as it is a standalone app.

Raylborn
2005.04.25, 11:50 PM
Im not exactly new, just wasn't exactly sure what is was called. Im 13 years old man :P Well on my G3 I just double clicked on EL and it opened, no console or anything. But so I have to get into the console, then open EL? What will that do, and then post what it says? I'll do it tommorow but why post what it says?

PowerMacX
2005.04.26, 01:07 AM
Im not exactly new, just wasn't exactly sure what is was called. Im 13 years old man :P Well on my G3 I just double clicked on EL and it opened, no console or anything. But so I have to get into the console, then open EL? What will that do, and then post what it says? I'll do it tommorow but why post what it says?

OK, as snakey said, that icon is the application and all you need to do is to double click on it. If it doesn't start, some information that could indicate why will be written to the log files. The Console is one simple way to check the contents of said logs, so if you look at the text that is written to the log when the app fails to load, you'll see some error message. If you are not sure what it means, post it here.

BTW, what OS version do you have on the G4?

socksy
2005.04.26, 01:30 PM
Im 13 years old man :P
So am I, check my profile.
In my personal experience, OS X is extremely slow with G3s (we have loads) and can't work with half the apps... The console is standard for finding out what is wrong with it, then to hopefully fix it...

ravuya
2005.04.28, 11:09 AM
Check the program in /Applications/Utilities called Console.

Radu
2005.09.13, 06:11 PM
Corun, are you still around? I tried to reach you via e-mail but I am not sure you got my e-mail.
We just updated the game, we have a new version now, with a LOT of improvements.
Would it be possible to compile it for OSX and send us the binary?
Thanks!

0ctane
2005.12.14, 07:39 PM
The latest version of Eternal Lands has many changes from Corun's build. SDL, OpenGL, and OpenAL are all used (among many other libraries). I have made many attempts to compile from CVS (dual G5 10.3.9), so far to no avail. Please look here (http://www.eternal-lands.com/forum/index.php?showtopic=18673) and here (http://www.eternal-lands.com/forum/index.php?showtopic=21022) for my progress. While the program will compile, with some hefty Makefile editing, I get bus error while running it. From gdb:Program received signal EXC_BAD_ACCESS, Could not access memory.
0x909156b4 in glMatrixMode ()
(gdb) bt
#0 0x909156b4 in glMatrixMode ()
#1 0x0002ec18 in resize_root_window () at gl_init.c:773
#2 0x0002ec18 in resize_root_window () at gl_init.c:773
#3 0x0001e0b4 in change_projection_float (var=0x1701, value=0xbfffd780) at elconfig.c:437
#4 0x0001e6e8 in check_var (str=0x1701 "%\213�*\004ÛÔÄ", type=INI_FILE_VAR) at elconfig.c:697
#5 0x00020314 in read_el_ini () at elconfig.c:1100
#6 0x00034f58 in read_config () at init.c:192
#7 0x00035b58 in init_stuff () at init.c:531
#8 0x0003fa38 in SDL_main (argc=5889, argv=0xbfffd780) at main.c:227
#9 0x0000388c in -[SDLMain applicationDidFinishLaunching:] ()

From the error log:Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000a40

Thread 0 Crashed:
0 libGL.dylib 0x909156b4 glMatrixMode + 0x2c
1 el_osx.exe 0x0002ec18 resize_root_window + 0x3c (gl_init.c:774)
2 el_osx.exe 0x0001e0b4 change_projection_float + 0x14 (elconfig.c:438)
3 el_osx.exe 0x0001e6e8 check_var + 0x370 (elconfig.c:698)
4 el_osx.exe 0x00020314 read_el_ini + 0x50 (elconfig.c:1100)
5 el_osx.exe 0x00034f58 read_config + 0xa8 (init.c:192)
6 el_osx.exe 0x00035b58 init_stuff + 0x34 (init.c:534)
7 el_osx.exe 0x0003fa38 SDL_main + 0x3c (main.c:229)
8 el_osx.exe 0x0000388c -[SDLMain applicationDidFinishLaunching:] + 0x68 (crt.c:300)
...
28 dyld 0x8fe1a278 _dyld_start + 0x64

PPC Thread State:
srr0: 0x909156b4 srr1: 0x0000d030 vrsave: 0x00000000
cr: 0x22002448 xer: 0x00000000 lr: 0x90915690 ctr: 0x90915688
r0: 0x0002ec18 r1: 0xbfffd4c0 r2: 0x00000000 r3: 0x00001701
r4: 0xbfffd7c0 r5: 0x00000003 r6: 0x80808080 r7: 0x00000065
r8: 0x00000065 r9: 0x000ce3b8 r10: 0x0001d714 r11: 0x9092b14c
r12: 0x90915688 r13: 0x00000000 r14: 0x00000000 r15: 0x00000000
r16: 0x00000000 r17: 0xbfffe640 r18: 0x00000000 r19: 0x00000000
r20: 0x062278e0 r21: 0x0d9a1072 r22: 0x0000000d r23: 0x0620c194
r24: 0x00000000 r25: 0x0620c180 r26: 0xa2e75180 r27: 0x00000002
r28: 0xa090f004 r29: 0x00001701 r30: 0xbfffd4c0 r31: 0x90915690
...
Binary Images Description:
0x1000 - 0xcdfff el_osx.exe ./el_osx.exe
0x5215000 - 0x521afff libvorbisfile.3.dylib /opt/local/lib/libvorbisfile.3.dylib
0x5227000 - 0x5229fff libogg.0.dylib /opt/local/lib/libogg.0.dylib
0x5277000 - 0x528dfff libvorbis.0.dylib /opt/local/lib/libvorbis.0.dylib
0x6008000 - 0x60b5fff libcal3d.11.dylib /usr/local/lib/libcal3d.11.dylib
0x30000000 - 0x3004bfff SDL 1.2.9 /Library/Frameworks/SDL.framework/Versions/A/SDL
...
0x9090f000 - 0x90929fff libGL.dylib /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib
...

I do all this from the command line, since I am not familiar with Xcode, and I just care to have it run under X11 for now. I am unfamiliar with Carbon and Cocoa. This new client version DOES NOT use GLUT, while Corun's build did IIRC. Does anyone have an idea why libGL.dylib might be failing? Does anyone have simple example code that uses SDL and OpenGL without GLUT?

Corun
2005.12.17, 06:53 PM
Sorry, Yeah I am around. I'm pretty busy at the moment. I've got exams in January. I'll try and get that done sometime before january. Make sure you email me repeatedly or I'll probably forget about it. I've got a lot of stuff on my mind at the mo. Just email me once every few days and I'll get it done eventually.

0ctane
2005.12.18, 11:27 AM
Corun,
You do not have your iDev account setup to let me e-mail you. So, maybe you can fire an e-amil to me so that things get rolling. Did you see any openGL issues with your original port? IIRC, you did not use X11, so which path did you take, Carbon, Cocoa, other?

0ctane
2006.01.06, 12:02 AM
Well, with the help of OneSadCookie, I was able to fix some final issues with this port. Woohoo! :D The code still uses SDL and GLUT. I traced some calls that were not Mac-friendly and fixed them. Work is keeping me a little busy right now, but I have started some pseudo-beta testing with volunteers. Stay tuned for a completed product.

Radu
2006.02.15, 03:20 PM
Just to let you know, we now have a semi stable version for public testing, located here: http://www.other-life.com/osx
Thanks everyone for your help!

0ctane
2006.03.29, 11:58 PM
FYI, the location of the EternaL Lands port has been moved to a new location (http://www.0ctane.net/elosx.html).

igame3d
2006.03.30, 05:18 AM
Looks like a neat game, but uhm, what does it do?
I mean I read the help and the read me and I can move the camera around, but there's not a word about how to move the character!

None of the keys seem to do anything, mouse, alt-mouse, control mouse, command mouse, none of those do anything (well alt mouse pivots camera).


Maybe command click is broken on MacIntels?

0ctane
2006.03.30, 03:06 PM
Looks like a neat game, but uhm, what does it do?
I mean I read the help and the read me and I can move the camera around, but there's not a word about how to move the character!

None of the keys seem to do anything, mouse, alt-mouse, control mouse, command mouse, none of those do anything (well alt mouse pivots camera).


Maybe command click is broken on MacIntels?
It works as well on my MacIntel (MacBook Pro) as it does on the dual G5 I have at work. Not sure why you are having issues though. You left click on the environment to move around in the game. Did you ask others in game for help? You can also look at the game's forums (http://www.eternal-lands.com/forums).

igame3d
2006.03.30, 03:30 PM
Ok its working, nothing works until the "DONE" button is pressed in the username/password thing, and it takes you to a different location, it ("Done" button) didn't respond last night, probably because I chose a "Pay to play" character and didn't see the message under the other windows.

0ctane
2006.03.31, 09:17 AM
Ok its working, nothing works until the "DONE" button is pressed in the username/password thing, and it takes you to a different location, it ("Done" button) didn't respond last night, probably because I chose a "Pay to play" character and didn't see the message under the other windows.
Sounds like you were just in the "Character creation" part of the game. Yeah, you cannot move around while customizing your name/clothes/hair/race/... but that is not unlike the beginning of many games. Since you had a problem with it, there might be other people too, so we should make clear mention of the new character process.

igame3d
2006.03.31, 02:47 PM
yeah no need for terrain in the character creation process, could just be floating around in some primordial plasma particle stuff.