Just when I thought I was out...

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

User avatar
matt634
Deadly
Deadly
Posts: 206
Joined: Tue Mar 21, 2006 6:32 pm
Location: Colorado, USA

Post by matt634 »

Roberto, I was thinking that if you're updating the Taranis Corp OXP it might do well to have a couple Frigates. It only makes sense that the Navy would allow their contractor to keep a few in a private defense fleet. If you're interested, and want to send me an image baring the Taranis Logo (no background just the logo) I could put one together for you in short order.
User avatar
Roberto
---- E L I T E ----
---- E L I T E ----
Posts: 318
Joined: Sun Jun 11, 2006 1:16 pm
Location: London, UK

Post by Roberto »

Heh - "ease myself back in" indeed! I've spent much of this evening running up against my own limitations :) Still, I guess the only way from here is up...

On the texturing front...

I've tried tinkering with the main texture - even installing a new graphics program, GIMP, to see if that would help me - but only succeeded in making it worse :) I think the problem (aside from my woeful lack of knowledge when it comes to computer-arty stuff) is that the sheer size of the model relative to the dimensions of the texture (512 x 512) means it ends up being pretty lo-res. I deliberately held back on the texture size to prevent the thing from crippling performance on lower-spec machines - do you guys think this was the right decision, or would it be safe to go higher? For now I've just made a very subtle change and moved on to the docking bay...

Well, I say moved on - mostly what I've done is (attempt to) read up on this whole materials/shaders malarkey, while uttering such exclamations as "Oh, Jesus Christ!" and "But... but... how?!" and wishing I had more liquor to hand :) My goal is to emulate the "glow" of the docking bay on the Navy Station (with Sung's textures). My best hope would appear to be borrowing from Griff's Illumimated Docking Bay OXP (assuming he would be OK with this).

Now then... The Shaders dictionary in shipdata makes sense to me. The shaders themselves... :) Would I be right in thinking that ahruman-generic.vertex is an all-purpose vertex shader that'll give reasonable results with anything? Similarly, will griff_dockingbay.fragment work with my textures? Looking at the code for this scares me, quite frankly - I can see how to adjust the "glossiness" and the glow colour, I assume I can lose the two "uniform float" lines near the top, but I'm stumped by just about everything else! My fear is that some of this stuff is linked to coordinates on Griff's textures - if this is the case, then I'm probably screwed.

And then we come to the textures themselves, which is where I'm going to sound really stupid :) Clearly I need three textures - my standard one (the equivalent of Griff's unshaded_diffuse texture), the standard one simply renamed (for the shaders to use) and a third one containing red- and blue-channel information. Now, I can see how to select each channel of an image separately in GIMP. But, uh, what do I actually do? :oops: In what channel(s) should I draw, and with what colour/type of tool, to end up with my nice blue-, red-and-black texture, with red denoting "constant light", blue "ambient light" and black "shadow"?

On the AI front...

@Eric Walsh
The HQ successfully launches defence ships despite not having the station role. I'm assuming that increaseAlertLevel is working too, though that's not so observable. Here is the DEFENSE_MODE part of the AI, so you can see the full picture:

Code: Select all

    "DEFENSE_MODE" = { 
        ATTACKED = (setTargetToPrimaryAggressor, increaseAlertLevel, launchDefenseShip); 
        ENTER = (checkTargetLegalStatus); 
        EXIT = (); 
        "RED_ALERT" = (launchDefenseShip); 
        "YELLOW_ALERT" = ("setStateTo: IDLE"); 
        "CONDITION_YELLOW" = ("setStateTo: IDLE"); 
        "CONDITION_GREEN" = ("setStateTo: IDLE"); 
        "INCOMING_MISSILE" = (fireECM, increaseAlertLevel, setTargetToPrimaryAggressor, launchDefenseShip); 
        "TARGET_OFFENDER" = (increaseAlertLevel); 
        "TARGET_FUGITIVE" = (increaseAlertLevel); 
        "ENERGY_FULL" = ("pauseAI: 1800.0", "setStateTo: IDLE"); 
        "OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 15", launchDefenseShip, increaseAlertLevel); 
        "TARGET_DESTROYED" = ("pauseAI: 1800.0", "setStateTo: IDLE"); 
        "TARGET_LOST" = ("pauseAI: 1800.0", "setStateTo: IDLE"); 
        "NO_TARGET" = ("pauseAI: 1800.0", "setStateTo: IDLE"); 
        UPDATE = (); 
    }; 
Ah Ahruman put a very powerful debugging tool in for this. "Target_key_dump". Select the target, press capital "H" and look inside Oolites logfile.
Forgive my ignorance - I'm feeling very stupid tonight. So in Oolite, I press (shift?) H, then close the program and look... where? :oops: It's been too long since I did any of this stuff.

setTargetToPrimaryAggressor - yes, I spotted the new info on this on the Wiki. Will setTargetToFoundTarget work as a response to ATTACKED and "INCOMING_MISSILE"? Or does it require a scanFor...?

@matt634
The HQ is already ridiculously well defended, but it might be nice to have a random chance of encountering a Frigate undergoing a final test flight in the system, prior to being handed over to the Navy. I could even have it perform a weapons test on a stationary target! Let me know what you think - at the moment I've got more than enough on my plate, but it would make a nice finishing touch to the package :)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Roberto wrote:
Forgive my ignorance - I'm feeling very stupid tonight. So in Oolite, I press (shift?) H, then close the program and look... where? :oops: It's been too long since I did any of this stuff.
Depends what OS you’re using. (Also, it’s only enabled by default in 1.70.)
User avatar
Roberto
---- E L I T E ----
---- E L I T E ----
Posts: 318
Joined: Sun Jun 11, 2006 1:16 pm
Location: London, UK

Post by Roberto »

Mac OS X 10.4, version 1.70 (I believe - am at work atm).
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Mac OS X 10.4, version 1.70 (I believe - am at work atm).
Somewere deep in the aplicationfolder of OX 10 there is buried a program called "console". Search it and start it. It lets you see all logfiles. Oolite is one of them.

Alternatively you can (must as mac developer) download the 1.70 "debug menu OXP". This one has also the option to open this log file directly over the menu bar.
-----
The HQ successfully launches defence ships despite not having the station role. I'm assuming that increaseAlertLevel is working too, though that's not so observable.
You are right, I looked inside the OXP and saw you have set "isCarrier = true". This key also will make it act like a station and the role station is not necessary.
----
setTargetToPrimaryAggressor - yes, I spotted the new info on this on the Wiki. Will setTargetToFoundTarget work as a response to ATTACKED and "INCOMING_MISSILE"? Or does it require a scanFor...?


I changed it recently on the wiki, but it is still not complete. Problem it that Oolite uses at least three targets.

Code: Select all

- FOUND_TARGET is what you get as result of a search, 
- PRIMARY_TARGET is what the player would see in his cross-hairs, 
- PRIMARY_AGGRESSOR is a latent target that the system sets as response of a missile or a laser beam.
Several commands change these targets. e.g. fightOrFleeHostiles changes both PRIMARY_AGGRESSOR and PRIMARY_TARGET into FOUND_TARGET. This is not always clear to the scripter as he often is not explicitly changing these targets. Normally there is no problem, but sometimes the results are not what you expect because of this. In my case it was an escort (that always must have his mother as primary target) that started shooting at his mother in response of a misused setTargetToPrimaryAggressor command.

When you are attacked and get a ATTACKED or "INCOMING_MISSILE" message the system has also put the attacker ID in PRIMARY_AGGRESSOR and with ATTACKED also in FOUND_TARGET.

It my intention to put all/some commands that change targets in a list so one can see at a glance what gets changed by what command.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Roberto wrote:
Mac OS X 10.4, version 1.70 (I believe - am at work atm).
In that case, logs live in ~/Library/Logs/Oolite/ (~ being your home folder). As Eric says, the Debug OXP provides a Show Log command.
User avatar
Roberto
---- E L I T E ----
---- E L I T E ----
Posts: 318
Joined: Sun Jun 11, 2006 1:16 pm
Location: London, UK

Post by Roberto »

Thanks, chaps - that Debug OXP is very handy!

@Eric Walch
The HQ's AI does seem to be behaving sensibly after all - I think you were right about the "launching queue". Things are now nice and simple: both the IDLE and "CLEARANCE_GRANTED" (renamed from TRAFFIC) states are dice-rolling with no pause, but a very low probability of launching a ship. I'll fine-tune this so there's just the right amount of traffic in the system as a whole (I'm hoping to have ships launching from the system station to fly to the HQ, and ships flying to the HQ from the witchpoint).

Reading your explanation of how Oolite handles targeting, it would appear that my use of setTargetToPrimaryAggressor is OK. I've not yet witnessed the effect of an NPC ship attacking the station, but based on what you've said, I'm fairly confident it would respond correctly. Though players could still get caught in the (considerable) crossfire!

@matt634
I've added a small chance of encountering a Navy Frigate in the system (I'll sort out its AI and give it a target later). Would it be OK to include the model, texture and shipdata info within the OXP (in case someone downloads it without having downloaded yours as well)?

@Shader experts
In the absence of any feedback (so far) on my shading questions, I've incorporated the shaders from Griff's Illuminated Docking Bay OXP into mine (obviously this is subject to his approval). This hasn't caused any problems - but it's not doing anything yet either, undoubtedly because my third texture (for red- and blue-channel info) is just another copy of the standard diffuse texture! I seriously don't know what I'm supposed to do on the "channels" front, so if anyone could enlighten me, I'd be very grateful :)
User avatar
matt634
Deadly
Deadly
Posts: 206
Joined: Tue Mar 21, 2006 6:32 pm
Location: Colorado, USA

Post by matt634 »

You can absolutely add the needed frigate info to the OXP. And, if you would like, I could give it a custom Taranis texture and Taranis turrets.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2478
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

Hi Roberto
There's a much simpler illuminated docking bay shader in the spacebar which you can find in LittleBears Random Hits. oxp https://bb.oolite.space/viewtopic.php?t=3977 (download link on page 10 of that thread)
Image

The relevant shader files to copy into your oxp are "griff_spacebar_dockingbay.vertex" and "griff_spacebar_dockingbay.fragment" - obviously rename them to anything you want, the griff bit is because i'm a massive ego-maniac just to keep my files from overwriting anybody elses accidentally! If you do rename them, make sure you update the entries in the shipdata.plist accordingly.
You'll just need to provide 1 texture map for this shader - just the usual type, no need for any colour channels or anything like that, just replace griff_spacebar_dockingbay.png in the code below with the name of your texture, notice it appears twice, the first instance is the name of the texture to use if shaders are switched off or not supported on the players computer, the second instance is the name of the texture to use if shaders are enabled - so you can provide different textures depending on wether shaders are on or off or just use the same texture for both as in this example. make sure your .dat file references the no shaders texture.

The shaders entry in the shipdata.plist looks like this:-

Code: Select all

	shaders = 
		{ 
            "griff_spacebar_dockingbay.png" = 
			{ 
                vertex_shader = "griff_spacebar_dockingbay.vertex"; 
                fragment_shader = "griff_spacebar_dockingbay.fragment"; 
          
                textures = ("griff_spacebar_dockingbay.png");           
			}; 
		}; 
or in XML, it looks like this:-

Code: Select all

			<key>shaders</key>
				<dict>
					<key>griff_spacebar_dockingbay.png</key>
					<dict>
						<key>textures</key>
							<array>
							<string>griff_spacebar_dockingbay.png</string>
							</array>
						<key>vertex_shader</key>
						<string>griff_spacebar_dockingbay.vertex</string>
						<key>fragment_shader</key>
						<string>griff_spacebar_dockingbay.fragment</string>
					</dict>
				</dict>	
Last edited by Griff on Sun Dec 09, 2007 11:29 am, edited 1 time in total.
User avatar
Roberto
---- E L I T E ----
---- E L I T E ----
Posts: 318
Joined: Sun Jun 11, 2006 1:16 pm
Location: London, UK

Post by Roberto »

Thanks guys.

@matt634
My thinking is that it's a ship that's undergoing final testing prior to being delivered to (or picked up by) the Navy, so it should probably be the same as a standard Frigate design-wise. Having said that, there's no reason why it couldn't have a "test" paint job (perhaps "painting" each ship in the Navy style is the last thing to be done), so I've done you a Taranis logo on a transparent background (it's really basic stuff - just a couple of custom shapes and some text in Photoshop). I've chosen a random light blue, but feel free to make it whatever colour you want. PM me your email address and I'll send it over to you. Looking forward to seeing what you come up with :)

@Griff
Cheers - I'll give that a try. I'm kind of curious about the use of colour channels, though - I'm assuming that would enable me to play around with areas of light and shadow, whereas the simpler shader is more of an overall-illumination thing? If I knew how you ended up with your red/blue/black image for the more complicated shader, I could give it a go. I'll try looking at GIMP's help info...
User avatar
Roberto
---- E L I T E ----
---- E L I T E ----
Posts: 318
Joined: Sun Jun 11, 2006 1:16 pm
Location: London, UK

Post by Roberto »

Gah! I've been trying to get to grips with this for two hours now, and it's really starting to damage my calm...

It seems like I have two choices. I can either:

1. Draw directly onto the image in white, black or any shade of grey, with one colour channel selected. Drawing in white boosts that colour to 100% (in the area of the image where I'm drawing); black takes it down to zero.

2. Use "selection masks", which would appear to work like layers that I can edit separately and then apply to a channel.

The second option would appear to be the smart one - except that it's stubbornly refusing to behave. For some reason selecting black means it draws in white (why? why?!), and it keeps wanting to turn what I've drawn into a selection, which then prevents me from drawing anywhere else :x

I'll give it another go tomorrow, but if any graphically able person could tell me whether I'm at least on the right track, that would be great :)
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2478
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

Hi Roberto
Yeah, the spacebar illumination shader won't allow you to specify any variations in illumination or shadow, it basically works by simply not including any lighting calculations in the fragment shader so the illumination level is constant across the whole object.

I wrote out short pdf document talking a bit about the shaders used in the griff_boa. It mainly deals with getting models and maps into rendermonkey ( a free windows only shader development program) but there's a short tutorial using photoshop to split an images colour channels to drive some specularity shader effects.
You can download the pdf here http://www.box.net/shared/ig02aaj6e6 (about 950Kb), i think it's also included in the griff_boa oxp (along with the texture maps .obj format models and the rendermonkey .rfx files )

When you're working in seperate colour channels in an image they will appear as greyscale images, when you combine them all back together that's when you'll see then as mixtures of red, green and blue. the pdf above explains how to split and recombine colour channels.
User avatar
Roberto
---- E L I T E ----
---- E L I T E ----
Posts: 318
Joined: Sun Jun 11, 2006 1:16 pm
Location: London, UK

Post by Roberto »

Thanks - but I'm still stuck :( Unfortunately, my cut-down version of Photoshop doesn't seem to have a Channels menu option. And I can't work out how to get grayscale images of the channels in GIMP. This is what I'm trying to work with: http://docs.gimp.org/en/gimp-channel-dialog.html
User avatar
Roberto
---- E L I T E ----
---- E L I T E ----
Posts: 318
Joined: Sun Jun 11, 2006 1:16 pm
Location: London, UK

Post by Roberto »

I'll try and show you what I'm up against:

Image

This is what a "selection mask" looks like when I create one. Which it seems like I have to do. I can draw on it, but I can't actually see what I'm drawing unless I make one (or more) of the channels visible too. Which is really handy.

Image

Here I've been drawing in white on the selection mask, over one of the "arrows" on the image. You can see this because I've made the red channel visible too. What I don't know is how to "overwrite" the channel with the stuff I do on the selection mask once I've finished. I seem to have every kind of save option under the sun except for that one! And I've no idea how to edit a channel separately in greyscale, as you do in your Photoshop tutorial. Answers on a postcard, please! :) :(
User avatar
Roberto
---- E L I T E ----
---- E L I T E ----
Posts: 318
Joined: Sun Jun 11, 2006 1:16 pm
Location: London, UK

Post by Roberto »

A thought has occurred to me, Griff - if no one knows how to solve my GIMP problems (as it were), would it be possible to email you my image for you to split into three channels and then email back to me? I could then send you the three images to be recombined when I've finished with them. Or wouldn't this work?
Post Reply