Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Hades on August 31, 2007, 11:21:42 pm

Title: Cloaked ships perhaps?
Post by: Hades on August 31, 2007, 11:21:42 pm
Well?What do you think?





P.S. If you want to know how I did it just ask.

[attachment deleted by admin]
Title: Re: Cloaked ships perhaps?
Post by: Unknown Target on August 31, 2007, 11:39:51 pm
Uh...is this a glitch or did you just use a semi-transparent texture for the entire model?
Title: Re: Cloaked ships perhaps?
Post by: Hades on September 01, 2007, 12:04:24 am
Glass textures up the wazzu. :shaking:
It would be hard to see, it looks kind of cloaked.(No I know nothing about StarTrek)
You could use SEXPs to make it to were you cannot target it.
Title: Re: Cloaked ships perhaps?
Post by: jr2 on September 01, 2007, 01:40:27 am
Ever play Descent?  Looks sorta like that, IIRC
Title: Re: Cloaked ships perhaps?
Post by: --Steve-O-- on September 01, 2007, 09:44:48 am
isn't there a way to get fred to trigger a texture map change by using a keypress? so say you press "C" and FRED swaps the default texture map for the cloak map, press "C" again and it reverses the process. that would be a neat little trick.
Title: Re: Cloaked ships perhaps?
Post by: Mobius on September 01, 2007, 09:46:13 am
I'm not sure, but...you should be able to do it with Scripting.

Or you can simply use change-ship-class. Same entry, same POF, different textures(invisible). It can be easily triggered :)
Title: Re: Cloaked ships perhaps?
Post by: Getter Robo G on September 09, 2007, 09:36:00 am
Hades... Can you make a version of that texture but at even more transparent and lighter so I can test it with a Klingon BOP? I had a texture from Trashman's archangel (The nameplate) and that sorta worked but was too white and needed to be more ghostly (transparent) and was not uniform coverage.

A generic transparent texture for cloaked ships would be great and you could use Fred to control when to change textures (or the SCP team can make a sexp to control cloaking) where you see that as a intermediate stage before going invisible.

Visible-cloaking texture-Invisible (ship cloaked) like that?

Comming out of cloak would be: Invisible-Cloaking Texture-Visible.

With appropriate voice files added of course ("She's Cloaking Captain!" & "Ship Decloaking!") :D
Title: Re: Cloaked ships perhaps?
Post by: colecampbell666 on September 09, 2007, 10:06:40 am
Interesting Idea, but there would be a few complications arising from using "C"

"Now cloaking!" *Presses "C"*
"Orders recieved, attacking target!"
"No! I said cloaking!" *Presses "C" again*
"New orders, all units fire on target GTD Cloaked!"
*Alpha 1's anti-stupidity device detonates*
Title: Re: Cloaked ships perhaps?
Post by: Nuke on September 09, 2007, 11:00:16 am
if they ever get around to fixing rtt it might be possible to sctipt stuff like this in :D

come to think of it you could probibly do this with an animated texture, well sorta. you have several versions of a texture, one with full alpha, and several others incrimentally less alpha. then you tell your script to swap out the ship textures for progressively more transparent ones untill youre using very little alpha. then switch over to invisible when fully cloaked. if i did it id have a few maps with a noisy alpha map in the 0-8 range on the grey meter. then you randomly swap between them. this should cause a ghostly shimmer to hint you that the ship is there. or do like they had in avp, where you get the shimmer texture while moving around and go completely invisible when youre hardly moving.

side effect is you have to have this done for every texture the ship uses, thus increasing texture usage. could probibly be maid faster if you could replace say a -trans map for a model, without touching the diffuse texture. you may also have problem replacing ships that already use animated textures, like thruster flames. least in my build i found i had trouble indexing textures on ships with animated parts. should probibly mantis that bug if it hasnt been already.
Title: Re: Cloaked ships perhaps?
Post by: Getter Robo G on September 09, 2007, 11:14:11 am
Nice, but then an ani would need to be custom for each ship... UNLESS you made it overlay the ship like an effect and it slowly blurred out the ship and the ship mesh  goes before the ani ends... Yes... (well unless I'm thinking of something else) Technically, any glows on a ship should be seen also just dimmer, or getting brighter for an ideal cloak effect.

I already posted in the trek thread last year I think of what it looked like "going cloaked" it was a fredded timed event not a key press event. Once I foudn I did not like the look I stopped exploring the possibility.
Title: Re: Cloaked ships perhaps?
Post by: Nuke on September 09, 2007, 11:50:54 am
youd need rtt to get a smooth translation or alot of textures. you could probibly do a white elephant ship, that would be used in certain mission. but the solution is not really feasable for every ship in the game. you might be able to do a rapid cloak effect, concealing the texture changeover in a cloud of particles.
Title: Re: Cloaked ships perhaps?
Post by: Gregster2k on September 09, 2007, 12:56:10 pm
you might be able to do a rapid cloak effect, concealing the texture changeover in a cloud of particles.

That's sort of what Freelancer did. It worked pretty well.
Title: Re: Cloaked ships perhaps?
Post by: Nuke on September 09, 2007, 01:31:07 pm
i was about to report that texture replacement bug on mantis, but i tried to write a script to explain the bug but i couldnt get it to not work. so i guess it got fixed. i gonna try to make a cloaking system in the way i stated earlyer. with luck it will work.

http://www.youtube.com/watch?v=OTOWUAY8NJ0

Code: [Select]
;;cloakint


#Global Hooks
$GameInit:
[

cloaktex = { gr.loadTexture("apis-c00"), gr.loadTexture("apis-c01"), gr.loadTexture("apis-c02"),
gr.loadTexture("apis-c03"), gr.loadTexture("apis-c04"), gr.loadTexture("apis-c05"),
gr.loadTexture("apis-c06"), gr.loadTexture("apis-c07"), gr.loadTexture("apis-c08"),
gr.loadTexture("apis-c09"), gr.loadTexture("apis-c10"), gr.loadTexture("apis-c11"),
gr.loadTexture("apis-c12"), gr.loadTexture("apis-c13"), gr.loadTexture("apis-c14"),
gr.loadTexture("apis-c15") } --array of cloak textures

cloakticker = 750 -- countdown timer
cloaklevel = 0 -- cloaklevel, how cloaked we are
cmapindex = 0 -- this stores an index for which texture were using

]
$Simulation:
[

if cloakticker > 0 then --counting down to cloak engage, all this stuff is called every frame
cloakticker = cloakticker - 1
else
cloak = true
end

if cloak and cloaklevel < 160 then --if its time to cloak and were not already fully cloaked
cloaklevel = cloaklevel + 1

cmapindex = math.floor(cloaklevel / 10) --convert are cloaklevel into an index
end

ship = mn.Ships["Alpha 1"] --get alpha 1's ship

if cloaked ~= true and ship:isValid()and cmapindex > 0 then --if alphas alive and were cloaking set texture, but not if our cloak is complete
for i=1, #ship.Textures do
ship.Textures[i] = cloaktex[cmapindex] --change all the ships textures
end

if campindex == 16 then cloaked = true end --tell this if to stop changing textures when were done
end

]
#end

anyway i created a 16 frame cloaking animation, i added some noise to the alpha channel which i brightened up to almost white, i also copied the texture to a new layer and applied the glowing edges filter, set blending mode to darken and opacity to 10%. and saved the first frame as a dxt5. for each frame i increased the opacity the the glowey layer by 10% and decreased the brightness of the alpha chanel by 15. saving each time. when my opacity for my effect layer reached 100, i started increasing its contrast by 20%. untill 16 frames were created. i didnt create an eff instead i let the frames be handeled by the script. you could probibly rewrite it so that the game will automatically load cloak textures automatically for longer or shorter animations. mind you the apis is a 1 texture model. ships with more than one texture might look wierd or youd need to add more maps to the list for the other objects. also you break your lod textures. thruster flames are still drawn and youre still targetable. but i suppose a proper implementation would have fred trigger the script and enable stealth for you. also i only wrote this to engage and stay on, youd have to change the maps in reverse order to decloak, returning to the first map. the cloakmap eats up 5.33 megs of space, and will reside in vid mem untill you exit, as i wrote it. a proper implementation would need to free those textures when theyre no longer in use. i also got this example working in less than an hour.
Title: Re: Cloaked ships perhaps?
Post by: Getter Robo G on September 09, 2007, 04:48:26 pm
WOW!!! I'd say you're halfway there, it certainly did fade out over time!!!! :yes:

Now as to how to "de-cloak" can you Fred it to turn off/reverse?
(Note I barely understood how you did it, but not the implications of true functioning).

I'll send you an "appropriate" ship for testing purposes later.

Hopefully you'll get this to the point an idiot (like me) can use it.  :lol:

Title: Re: Cloaked ships perhaps?
Post by: Nuke on September 09, 2007, 11:04:33 pm
and what exactly is wrong with my zod assault fighter? :D
Title: Re: Cloaked ships perhaps?
Post by: BS403 on September 09, 2007, 11:59:25 pm
wow thats some damn fine work Nuke :eek2:
Title: Re: Cloaked ships perhaps?
Post by: JGZinv on September 10, 2007, 11:55:06 am
A question for you Nuke, is/would your script be compatible with
weapons?

Logistics aside, I've got a potential use for it but I may not end up
using a weapon type for what I'm looking at doing. May have to go with
a ship as weapon.

Great work there and looking forward to see what develops.
Title: Re: Cloaked ships perhaps?
Post by: Nuke on September 10, 2007, 08:11:33 pm
im not sure. both ship and ewapon are dirivitives of the object class. and if you can swap a ship's textures i dont see why you cant change a weapons.

as for cloaking im working on making the cloaking effect controlled by a sexps.
Title: Re: Cloaked ships perhaps?
Post by: Goober5000 on September 11, 2007, 01:36:22 am
*checks watch*

Well, now we have a benchmark.  14 months from SCP implementation to half-assed community reimplementation. :sigh:
http://www.hard-light.net/forums/index.php/topic,40783.0.html
http://www.hard-light.net/forums/index.php/topic,41365.0.html
Title: Re: Cloaked ships perhaps?
Post by: Nuke on September 11, 2007, 02:30:20 am
my implementation was only half assed because i was trying to inspire the others to pick up on scripting. it just happens that my implementation was suprising to me and was showoff worthy :D

i was sorta in the process of de-half assing it :D
Title: Re: Cloaked ships perhaps?
Post by: Col. Fishguts on September 11, 2007, 02:48:27 am
On the topic of cloaking, is there a chance that the cloaking feature from the "Imperial Alliance" code base will find its way into the SCP ?

All these texture replacement hacks are nice and all, but not really suitable for a phase-in/out effect for Shadow ships, which have an animated base map.
Title: Re: Cloaked ships perhaps?
Post by: Nuke on September 11, 2007, 03:20:30 am
id need rtt to work for me to get a proper phase in phase out effect through scripting. on the other hand im pretty sure you can do the same with shaders once thery make it into the engine.
Title: Re: Cloaked ships perhaps?
Post by: Getter Robo G on September 11, 2007, 08:33:45 am
Don't you mean WHOLE-ass it? (cause half is lacking, unlike Jennifer Lopez...)   :drevil:
Title: Re: Cloaked ships perhaps?
Post by: Nuke on September 11, 2007, 09:48:58 am
that ass aint real

anyway the only reason i did a half assed attempt at implementing cloaking (yes i know people have tried to do it before) was because rtt didnt work :D
Title: Re: Cloaked ships perhaps?
Post by: jr2 on September 12, 2007, 03:38:38 am
Guys, the Descent 1/II source code is free, right?  (AFAIK, it is).  Descent has a cloaking system that I think you'd find plenty adequate... I can post a vid if I can figure out how to switch to external view in D2X-XL.
Title: Re: Cloaked ships perhaps?
Post by: Nuke on September 12, 2007, 03:45:55 am
alt-f12 :D

i think a shader based cloak would probibly be more awesomer