PDA

View Full Version : "Super Mario War" - SDL and C


DaveN
2006.03.10, 06:35 AM
So, hi guys!
From a windows-using friend I just got a good tipp; he told me about the game "Super Mario War", a multiplayer-deathmatch-mario-clone ( also with an AI ) that's written in C and SDL. After seeing the good-lokking screenshots I decided to make a quick port, but 'cause I can't programm in any C-Language, I didn't got it to work, even not after a long time trying around with the sdl-libraries to kill those dumb errors.

So because it's written in languages, that are also avaible for the Mac, I thought it shouldn't be much work for a C-developer to make a short port of that game, the sources are also avaible at http://smw.72dpiarmy.com/.

It is avaible for Linux, Windows, the XBox and the PS2.

mfg Dave

Edit: That's where I get the error:

I use this command to compile:
g++ -I/usr/local/include/SDL -D_THREAD_SAFE -Wall -I. -Dstricmp=strcasecmp -DSleep=SDL_Delay build/MapList.o build/gfx.o build/map.o build/SFont.o build/main.o build/gamemodes.o build/player.o build/interactionobject.o build/menu.o build/splash.o build/eyecandy.o build/sfx.o -L/usr/local/lib -lSDLmain -lSDL -framework Cocoa -framework OpenGL -framework SDL_net -framework SDL_image -framework SDL_mixer -framework SDL_net -o smw


But he searches for the SDL Library at the @executable_path, but the executable isn't even compiled:
/usr/bin/ld: warning can't open dynamic library: @executable_path/../Frameworks/SDL.framework/Versions/A/SDL (checking for undefined symbols may be affected) (No such file or directory, errno = 2)

akb825
2006.03.10, 12:35 PM
Instead of compiling from the command line, try just dumping all the files into an XCode project and putting SDL in a copy frameworks rule for the executable. It would probably be quite a bit easier.

0ctane
2006.03.19, 11:27 AM
I have been porting a SDL game (http://www.idevgames.com/forum/showthread.php?t=8714) to Mac, and I encountered a few SDL issues along with endian bugs. I am not sure how much this will help, but I included the following commandline options:
-I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_net.framework/Versions/A/Headers/
...while I was using SDL and SDL_net frameworks. You are pointing to -I/usr/local/include/SDL, which I think are non-framework libraries.

For my linking options I included -headerpad_max_install_names so that I could go back later with install_tool to fix my @executable_path problem...but that was a problem with OpenAL I think.

A question for akb825: is there a good tutorial for moving a SDL program from commandline to Xcode? I do not completely understand how to use Xcode. I tried dumping my source code into Xcode using a SDL template, but I could never get a successful compile. Commandline works just fine though.

lokijki
2006.03.19, 03:26 PM
If you do get this ported, could you post a download link here. This game looks like a lot of fun.

DaveN
2006.03.22, 08:58 AM
So, I managed to get it ported like two days after posting the first post, but thanks a lot for the help, anyway. The hardest thing was, that I couldn't just compile it, there were somethings in the code that didn't worked with my compiler, so I changed these things per XCode.
To run it, just use the applescript-application in the folder, it's called "Super Mario War" or something like that. And DON'T CHANGE the name of the binary file "smw". Oh, and you've got to have SDL installed..

File: http://home.pages.at/davenaegeli/smw-1.6%20-%20ported%20by%20DaveN.zip [ Zipped 7.2 MB / Unzipped 32MB ]

mfg dave

PS: Tell me if there are some bugs, please..

akb825
2006.03.22, 03:00 PM
You really should include the SDL framework. It would be best if you create a package rather than just an executable file and add a copy frameworks build phase. Telling people to install something else is really not the best idea, especially when you can easily include it with your executable.

lokijki
2006.03.23, 07:29 AM
Whenever I open it it says:
dyld: ./ smw can't open library:
@executable_path/ ../
Frameworks/SDL.framework/
Versions/ A/SDL (No such file
or directory, errmo = 2)

Malarkey
2006.03.23, 02:08 PM
Apparently, the SDL_net framework needs to be in there too.

Malarkey
2006.03.23, 02:11 PM
Whenever I open it it says:
dyld: ./ smw can't open library:
@executable_path/ ../
Frameworks/SDL.framework/
Versions/ A/SDL (No such file
or directory, errmo = 2)


You'll have to go to http://www.libsdl.org/ and install SDL or put it in your ~/Library/Frameworks folder.

lokijki
2006.03.23, 03:01 PM
Now it says:
dyld: ./ smw can't open library:
@executable_path/ ../
Frameworks/SDL_image.framework/
Versions/ A/SDL (No such file
or directory, errmo = 2)

Malarkey
2006.03.23, 05:07 PM
Go back to libsdl.org and keep on downloading and installing libraries until you can play the game. In this case, you'll need SDL_image and probably SDL_net since I needed that one.

akb825
2006.03.23, 05:42 PM
It works. It seems to have some uninitialized variables for the game modes, since they start at very high numbers, then move to, say, 5.

As a side note, I had to install 5 separate SDL libraries in order to get this to work. That is unacceptable, IMO. You really should package the ones you need.

lokijki
2006.03.23, 09:34 PM
I got it to work, and its a lot of fun. But the player 1 powerup buttons won't work.

SpookMonkey
2006.08.11, 11:31 AM
I was able to get the game running, but only after downloading 4-5 libraries. Plays good, and it's a lot of fun.

Though, any chance anyone's made an Xcode project for this game? I'm still fairly new at this stuff, and I'm having a heck of a time trying to get Xcode setup to do anything with the code I pulled from their CVS.

ardam the third
2006.08.15, 05:28 PM
Mine says 'Can't make <<class ctnr>> of item "sef:desktop:smw-1.6:super mario war.app" of application "finder" into type string.'