Pages: [1] 2
|
|
|
Author
|
Topic: Creating star system without planets (Read 4524 times)
|
superbutcherx
*Many bubbles*
Offline
Posts: 116
|
Hi again!
The game obviously doesn't like it when I try to force a star system to have no planets or moons at all there. (Crashes when trying to enter such system). I haven't looked too closely into GENERATE_PLANETS and the function it's calling, but maybe I could change something there to make zero-planet systems work. Would anyone know what is the particular cause for crash and where in the jungle of code it lies hidden?
Also: Regarding the same star system tryout: Is it possible to change the star itself into an object one can interact with? I'd like to create a "portal" system of sorts that has absolutely nothing in it except that portal in place of the star and perhaps some Orz ships flying around.(Dang, now I gave that away!) One way to emulate the effect would be to stick a planet with MIN_PLANET_RADIUS in a super giant system, but it would seem just... half-assed.
Just tell me if I'm bothering you too much with all these questions... It's just that if someone has managed to do this already, it would be kind of waste of time to re-invent the wheel
|
|
|
Logged
|
|
|
|
meep-eep
Forum Admin
Enlightened
Offline
Posts: 2847
|
In response to your first question, I would suggest that you run the game in a debugger. It should tell you quickly enough where the crash occurs.
As for making the star a portal, that sounds like a fun idea. I have a few ideas of what might be involved, but there are probably other issues which I haven't foreseen. There's a function CheckIntersect in solarsys.c, where the sun is explicitly skipped. The line involved actually has a comment "can't intersect with sun". You will need to remove that check. Then you could add a check to the GENERATE_ORBITAL case of GenerateRandomIP() so that nothing happens when you bump into a sun, unless you override it into a generate function for the specific solar system. But there are a few more issues involved. In ChangeSolarSys, just before the call to GenFunc, there is a call to GetPlanetInfo(). That function isn't able to handle a sun, so you should probably just avoid calling it. It is only relevant for planetary exploration. And after the call to GenFunc, you should make sure that nothing happens for a sun as well.
Be sure to read doc/devel/generate
Also, I happen to be in the process of cleaning up that planet generation stuff (in particular the "overrides" for special planets). You can expect my changes to be checked in into SVN in the next few days.
|
|
|
Logged
|
“When Juffo-Wup is complete when at last there is no Void, no Non when the Creators return then we can finally rest.”
|
|
|
superbutcherx
*Many bubbles*
Offline
Posts: 116
|
Success!
Thanks yet again for advice! Now Talana literally has a 'place in the sun' at otherwise empty and void Alpha Lyrae...
The empty solar system was easy to make work partially: Just define number of planets for the sun] as 0 at the special star system generation code's GENERATE_PLANETS case. Already this would work otherwise, but if battlegroups were generated inside the system the game would crash.
The problem was in the point in grpinfo.c where all the battlegroups were placed in certain coordinates in the star system. The code would place their coordinates regarding to planets and when there are no planets, it's trouble time.
To correct it, I wrote special cases in grpinfo.c's GetGroupInfo() in couple of places which would work like if (number of planets==0) {place battle groups in about middle of the screen.}
---
Intersecting with the sun worked by changing that "can't intersect with sun" bit of code to work like "can't intersect with sun except if there are 0 planets in the system". To test it I put the syreen conversation code in GENERATE_ORBITAL for Sundesc[0].
At first that crashed, but it seems that when I put GenerateRandomIP for GENERATE_MOONS, GENERATE_ORBITAL and GENERATE_PLANETS and only after the GenerateRandomIP I defined the numplanets=0, the conversation would start upon hitting the sun.
Now the game would crash only when exiting the sun. This was due to DrawOrbit function in solarsys.c. I Changed pPlanetDesc->image.frame = SetAbsFrameIndex (OrbitalFrame, (Size << FACING_SHIFT) + NORMALIZE_FACING ( ANGLE_TO_FACING (ARCTAN ( pPlanetDesc->pPrevDesc->location.x, pPlanetDesc->pPrevDesc->location.y))));
to
pPlanetDesc->image.frame = SetAbsFrameIndex (OrbitalFrame, (Size << FACING_SHIFT) + 2;
in case there were 0 planets in the system so it wouldn't try to read the pPrevDesc's location since I guess there is no pPrevDesc for the sun. This piece of code decides how much zoomed the star should be when drawn on the screen, just a graphical thing.
---
So all in all, it works! Only thing is that the battlegroups are very insistent on moving from the very center to the left edge of screen to circle some invisible point there. I guess that is because GroupPtr->dest_loc given as a number of planet and when there are no planets...
I Didn't yet try to give -1 as the dest_loc since that just might be the sun (if it works like sortPlanetPositions at solarsys.c) so that's what I need to try next. Oh, and instead of syreens, make it a transition to hyperspace or something better
Again, I sounded like a technical manual here... I hope this post will be helpful to some modder out there!
|
|
|
Logged
|
|
|
|
superbutcherx
*Many bubbles*
Offline
Posts: 116
|
As for the something better...
Currently the *Below* a.k.a ORZ space hosts only one portal at 600.0:600.0 that leads back to hyperspace 100.0:100.0 but all kinds of crap can now be thrown in there!
BTW. Is there a better way to modify those colortable files than hex editor and painful labor ?
|
|
|
Logged
|
|
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
That's quite a coalition you have going, there, isn't it?
|
|
|
Logged
|
|
|
|
superbutcherx
*Many bubbles*
Offline
Posts: 116
|
Doc would be nice, docs are good!
Hmm, so no shortcuts here. Well, it wasn't too hard a thing to do to modify the quasispace green colormap to that Orz space blue, 20 minutes about with a Hex editor. Things might get hairy though if there was a need to do some more intense stuff like producing graphics for a new race.
But I guess it's just a matter of then doing it in photoshop with a 256 color palette and copying the palette values to a .ct file. Perhaps it is even possible to copy the whole chunk of 256*3 bytes from .act to .ct instead of copying them one-by-one!
|
|
|
Logged
|
|
|
|
fossil
Core Team
Frungy champion
Offline
Gender:
Posts: 94
|
But I guess it's just a matter of then doing it in photoshop with a 256 color palette and copying the palette values to a .ct file. Perhaps it is even possible to copy the whole chunk of 256*3 bytes from .act to .ct instead of copying them one-by-one!
Certainly, that was the idea. A decent hex editor will let you c&p large chunks of data. However, if I ever undertook a UQM project that required creating new or editing many colormaps, I'd probably first write a tool to disassemble/reassemble colortables. It's not hard to write one at all.
EDIT:
BTW. Is there a better way to modify those colortable files than hex editor and painful labor ? No, we never had the need to edit them, afaik. Oh, forgot to mention that I did indeed have to edit the colormaps, but the edits were not very large, so I did that by hand.
|
|
« Last Edit: December 03, 2009, 05:09:56 am by fossil »
|
Logged
|
|
|
|
|
fossil
Core Team
Frungy champion
Offline
Gender:
Posts: 94
|
Ah, that one... It wasn't written for Project6014. I wrote that ctconv for UQM to expand 3DO CLUTs to full 256-color palettes in the colortables. 3DO used a colormap system different from what we are using now. The CLUTs were 32 colors each (instead of 256), 5 bits per channel (15 total), with an implied 3-bit luminosity value. So 32 x 8 = 256, the expanded count. The CLUT system was thusly limited, and there was substantial color loss from DOS originals in some parts of the game. But yeah, I had forgotten about this tool. At the very least, it handles the colortable format already and can be adapted to disassemble/reassemble colortables for editing.
|
|
|
Logged
|
|
|
|
|
Quinarbre
Frungy champion
Offline
Posts: 60
|
My mistake, I must admit I'm not familiar with the various repositories here and there.
|
|
|
Logged
|
|
|
|
superbutcherx
*Many bubbles*
Offline
Posts: 116
|
Hmm, interesting!
The ctconv was already there in the tools of my current subversion so I can use it as a starting point if I want to create a tool for changing the colortables.
Currently I've been fiddling about with the hyperspace stars and spoor graphics. Planting the normal hyperspace graphics into the Orzspace leaves and ugly red glow around the graphics. A most efficient way of eliminating this would of course to define in something like orzspace.ani that the graphics in orz space use a different color table.
This color table is specified by a number after the .png file name and its transparency color index in the .ani file.
Where in the .ct files it is defined which number it is? For example, hyperstars. ani specifies the graphics to use colortable number 54.
Also, when editing the .png files with photoshop, the 4 kB files always bloat into 50kB+ files after saving. I specified that PS doesn't add color profile (the original game gfx don't use these) but even that only lowered the filesizes from 57kB to 53kB. This isn't major issue, but I like to optimize things, a nerdy idiot that I am.
|
|
|
Logged
|
|
|
|
|
Pages: [1] 2
|
|
|
|
|