The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
December 09, 2022, 02:43:05 am
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  General UQM Discussion (Moderator: Death 999)
| | |-+  Another dumb "I want to mod this game" thread
« previous next »
Pages: [1] Print
Author Topic: Another dumb "I want to mod this game" thread  (Read 2748 times)
Zaidyer
Zebranky food
*
Offline Offline

Gender: Male
Posts: 2



View Profile WWW
Another dumb "I want to mod this game" thread
« on: March 08, 2009, 11:36:08 pm »

So I've played UQM quite a lot. I've looked at the code. Now I'm thinking of using it as a base for some modifications.

I don't want to raise anyone's hopes by starting a long term project, because everyone knows how those turn out. I just want to figure things out and learn how to build up to larger goals. Here is what I'd like to do, sorted in order of importance:
  • Create a new star map. Most of it is procedurally generated, except for a bunch of specific places, right? This seems like the most obvious first step.
  • Relocate aliens to fit them where I want them on the new map.
  • Alter dialog to account for new locations.
  • This is where it gets tricky: Re-skin the graphics. The idea here is to come up with a "new" game this way, not by adding new races or ships, which is practically suicide with the source code the way it is right now. Just rewriting the old races to suit the needs of a new story should work well enough.

I'm not promising anything in this thread. I'm just looking for some input on the methods and difficulties regarding these tweaks.
Logged

~Zaidyer
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Another dumb "I want to mod this game" thread
« Reply #1 on: March 09, 2009, 03:32:09 am »

  • Create a new star map. Most of it is procedurally generated, except for a bunch of specific places, right? This seems like the most obvious first step.
src/sc2code/plandata.c defines the position of the stars. That position is also used as a seed for the pseudo-random number generator.
For some specific star systems, some parts are overridden in src/sc2code/planets/gen*.c. Note that this is in some cases done just by changing some parameters of the randomly generated solar system. It may for instance if you change the type of the third planet. This will go wrong if the random seed is changed so that there is no third planet.

Quote
  • Relocate aliens to fit them where I want them on the new map.
Trivial, see plandata.c again.

Quote
  • Alter dialog to account for new locations.
Trivial if that's the only change. If you add lines of dialog, you need to adjust the timestamps too.

Quote
  • This is where it gets tricky: Re-skin the graphics. The idea here is to come up with a "new" game this way, not by adding new races or ships, which is practically suicide with the source code the way it is right now. Just rewriting the old races to suit the needs of a new story should work well enough.
A drop-in replacement of graphics isn't too hard (from a code perspective; making the artwork is another matter). You just need to make sure you've got the transparency right, and the image descriptions (*.ani, *.sml, *.med, *.big) are correct. See doc/devel/aniformat for that.

Adding races is doable. You can copy one of the other races and modify it according to your wishes. Some other files you will need to change to link your new race to the game: src/sc2code/globdata.h (GAME_STATEs), src/sc2code/races.h, src/sc2code/comm/Makeinfo.
Adding ships is harder, but you can again use the code of other ships as an example. The trickiest part will be making the AI for your ships.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Shiver
Guest


Email
Re: Another dumb "I want to mod this game" thread
« Reply #2 on: March 09, 2009, 03:38:45 am »

We might need a subforum for game modifications to accompany the release of UQM 0.7 if this type of activity continues to pick up.
Logged
Zaidyer
Zebranky food
*
Offline Offline

Gender: Male
Posts: 2



View Profile WWW
Re: Another dumb "I want to mod this game" thread
« Reply #3 on: March 09, 2009, 10:08:43 am »

Hmm, it looks like every single star is laid out in one giant array. Where's the list of letter/name values for the starmap, so I can make sure all my star groups are definitely named correctly and grouped together?

I'm also having a lot of trouble compiling the source. I'm using an IDE called CodeBlocks, which can read the msvc++ project files included with the source, and the MinGW compiler. But it keeps tripping over config.h and several windows-related lines of code at build time.
Quote
:: === UrQuanMasters, Win32 Release ===
StarCon2mod\uqm-0.6.2\sc2\src\config.h:13: config_win.h: No such file or directory
StarCon2mod\uqm-0.6.2\sc2\src\port.h:156: error: conflicting types for 'wint_t'
Dev-Cpp\bin\..\lib\gcc\mingw32\3.4.2\include\stddef.h:354: error: previous declaration of 'wint_t' was here
StarCon2mod\uqm-0.6.2\sc2\src\options.c:: In function `prepareContentDir':
StarCon2mod\uqm-0.6.2\sc2\src\options.c:126: error: `CONTENTDIR' undeclared (first use in this function)
StarCon2mod\uqm-0.6.2\sc2\src\options.c:126: error: (Each undeclared identifier is reported only once
StarCon2mod\uqm-0.6.2\sc2\src\options.c:126: error: for each function it appears in.)
StarCon2mod\uqm-0.6.2\sc2\src\options.c:: In function `prepareConfigDir':
StarCon2mod\uqm-0.6.2\sc2\src\options.c:167: error: `CONFIGDIR' undeclared (first use in this function)
StarCon2mod\uqm-0.6.2\sc2\src\options.c:: In function `prepareSaveDir':
StarCon2mod\uqm-0.6.2\sc2\src\options.c:216: error: `SAVEDIR' undeclared (first use in this function)
StarCon2mod\uqm-0.6.2\sc2\src\options.c:: In function `prepareMeleeDir':
StarCon2mod\uqm-0.6.2\sc2\src\options.c:253: error: `MELEEDIR' undeclared (first use in this function)

I think there might be some sort of misconfiguration on my end. I haven't even modified the code yet, just trying to compile a clean version to see if it will work.
Logged

~Zaidyer
Cedric6014
Enlightened
*****
Offline Offline

Gender: Male
Posts: 701



View Profile
Re: Another dumb "I want to mod this game" thread
« Reply #4 on: March 09, 2009, 08:42:21 pm »

Hmm, it looks like every single star is laid out in one giant array. Where's the list of letter/name values for the starmap, so I can make sure all my star groups are definitely named correctly and grouped together?

Hi I'm one of those making "another dumb mod". You all know how they turn out....

Anyway, there's nothing in the code that groups the stars as such, but you'll notice that in the array towards the end of each line theres a number between 0 and about 14. This denotes alpha, beta etc. The next number denotes constellation name. This refers to a text file under conent smewhere. I dont have access to the code right now (I'm at work shhh) so I cant give you a specific path. But if you search the whole project for "Wolf" or something, you'll find it easily enough.

Logged

Play online melee here! http://irc.uqm.stack.nl/
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Another dumb "I want to mod this game" thread
« Reply #5 on: March 09, 2009, 11:35:07 pm »

Hmm, it looks like every single star is laid out in one giant array. Where's the list of letter/name values for the starmap, so I can make sure all my star groups are definitely named correctly and grouped together?
They're indices into the string list in starcon.txt, relative to STAR_NUMBER_BASE and STAR_STRING_BASE respectively (defined in gamestr.h).

Quote
I'm also having a lot of trouble compiling the source. I'm using an IDE called CodeBlocks, which can read the msvc++ project files included with the source, and the MinGW compiler. But it keeps tripping over config.h and several windows-related lines of code at build time.
We haven't tried Code::Blocks before.
But what you're doing now is using two build systems together. As the backend is MinGW, you should use the files intended for MinGW. The MSVC++ project files are probably going to just make things harder.
So this is what I suggest you do:
  • make sure you have all the dependencies installed. See INSTALL and perhaps INSTALL.mingw.
  • from the MinGW command prompt, from the top dir of the UQM sources (the one containing 'src'), run "./build.sh uqm" once successfully. Choose a debug build (for this example; the release build is analogous). This should (among other things), generate config_win.h, build.vars, and obj/debug/make.depend.
  • create a new project in Code::Blocks. Do not import the msvc++ project files.
  • add all the .c files from make.depend to your project.
  • from the top dir of the UQM sources, from the MinGW command prompt, execute the line
    Code:
    gcc -MM -I. -Isrc -Isrc/sc2code -Isrc/sc2code/libs `sed -e 's,./obj/debug/,,' obj/debug/make.depend` | sed -e 's,^[^:]*: ,,' | tr -d '\n\' | tr ' ' '\n' | sort | uniq -d > hfiles.txt
    to write a list of all the .h files used to hfiles.txt. Then add all the .h files from this list to your project.
  • examine build.vars. It contains an assignment to uqm_CFLAGS and to uqm_LDFLAGS. Somewhere in your project settings you should be able to set the compiler and library flags. Set them to the values of uqm_CFLAGS and uqm_LDFLAGS respectively (without the '' chars).
  • hit the build button
  • pray to the gods of technology
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!