Journeywar - Page 47

Journeywar

PicassoCT's stunning mixture of game design and psychedelia, for your enjoyment!

Moderators: Moderators, Content Developer

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

User avatar
Cubex
Posts: 56
Joined: 11 Jul 2012, 00:07

Re: Journeywar

Post by Cubex »

sry, I find this very difficult to masturbate to...

wait... what the....

i need... one sec please....



oh god what I said....
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

currently having some lua troubles.

The idea is to make a rope, or more realistic, a chain...now if the rope is not under pull,it sinks to the ground, by definition then going exactly flat on the surface.

Image

Code: Select all

function setIntervallSmooth(intStart,intEnd)
			if intStart== intEnd then return false end
					
					
					for i=intStart,intEnd,1 do	

					
					resultDeg=0
					groundheight2=0
					
						if i~=1 then
						x,y,z,_,_,_=Spring.GetUnitPiecePosDir(unitID,rope[13-i])		
						groundheight2=Spring.GetGroundHeight(x,z)	
				
						Spring.Echo("Element: ",13-i.." has forerunner Degree: ", nPrevDegTable[13-i+1])
						
						resultDeg=math.floor(-1*nPrevDegTable[13-i+1] + acquireRopeDegree(i)) --bachelors rope by now
						nPrevDegTable[13-i]=resultDeg
							else --start intervall clause 
							
							x,y,z,_,_,_=Spring.GetUnitPiecePosDir(unitID,rope[12])
							groundheight2=Spring.GetGroundHeight(x,z)	
							resultDeg=math.floor(-1*acquireVehicleDegree() + acquireRopeDegree(1))
							nPrevDegTable[12]=resultDeg
							end
					--delMe
					Spring.Echo("Setting Intervall Smooth.. piece ",i.. "Degree",resultDeg)
					--/delMe
					Turn(rope[13-i],x_axis,math.rad(resultDeg),0)
					
						
					nPrevDegTable[13-i]=resultDeg	
					heightTable[13-i]=groundheight2
					end

return true 
end
This is the function that should get the rope to hug the ground. rope[] contains the pieces (in inverse order) and nPrevDegTable stores the degree the current rope element holds, relative to the landscapes horizon (thus avoiding recalcing the whole ropedegree recursively up again and again). In the heightTable i only store the current height of the ropes position for further use later on.

Now for the two centerpieces:

Code: Select all

function acquireRopeDegree(i)
if i ==1 then
						ax,ay,az,_,_,_=Spring.GetUnitPiecePosDir(unitID,rope[13-i])
						ay=Spring.GetGroundHeight(ax,az)
						bx,by,bz,_,_,_=Spring.GetUnitPiecePosDir(unitID,pm2)
						-- by=Spring.GetGroundHeight(bx,bz)
					    local opposite=ay-by --+overfloor
					    local ax=ax-bx
						local az = az - bz
   						local len = math.sqrt( ax*ax +az * az)
						deg=math.floor(math.atan2(opposite, len)*(180/pi))
						Spring.Echo("Aquired RopeDegree for ", i.." is ", deg)
						return deg

		else
								ax,ay,az,_,_,_=Spring.GetUnitPiecePosDir(unitID,rope[13-i])
								ay=Spring.GetGroundHeight(ax,az)
								t=13-(i+1)
								if t==0 then t=1 end
								Turn(rope[t],x_axis,math.rad(-1*nPrevDegTable[13-i]),0) --line added to avoid mathtroubles when getting the pieces point
								WaitForTurn(ropte[t],x_axis)
								bx,by,bz,_,_,_=Spring.GetUnitPiecePosDir(unitID,rope[t])
								-- by=Spring.GetGroundHeight(bx,bz)
								local opposite=ay-by --+overfloor
								local ax=ax-bx
								local az = az - bz
								local len = math.sqrt( ax*ax +az * az)
								deg=math.floor(math.atan2(opposite, len)*(180/pi))
								Spring.Echo("Aquired RopeDegree for ", i.." is ", deg)
			return deg					
		end
end
Somewhere in there, there is a ugly error. The Rope is never stable. It curls and coils, forming strange patterns like stars.
I apologize to anyone thinking i would attempt a real rope simulation here. No this is just simulating the behaviour of one..
Any help appreciated. Good night.
Attachments
screen00472.JPG
(177.25 KiB) Downloaded 4 times
wip.jpg
(898.98 KiB) Downloaded 4 times
chain.jpg
(66.48 KiB) Downloaded 4 times
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Journeywar

Post by rattle »

cool.. it minces je..err something for fuel!
User avatar
Cubex
Posts: 56
Joined: 11 Jul 2012, 00:07

Re: Journeywar

Post by Cubex »

Image
Rock And Roll Treedies, YEAHHH

SideNote: product of a funny Feedback effect caused by a discarriaged variable declaration that souldn't be there
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

nothing to see here citizen, drag along
Attachments
screen00473.jpg
(1.46 MiB) Downloaded 4 times
User avatar
Cubex
Posts: 56
Joined: 11 Jul 2012, 00:07

Re: Journeywar

Post by Cubex »

You know guys, today I dreamed that I had 4 Penises in my pubis, :shock: and when I looked back to watch my strange quadgenital, I had only 1 :roll: , I asked... Where are my other 3 penises... :( and then I just waked :| IDK if it was a erotic or a nightmare dream :lol:



Anyways.... Here is the Tree's pseudo-physics code, remenber to comment the old function and to uncomment the call FloraPhysixLoop() in script.Create()

If you want to change behavior, try to adjust "Parameters" variables

Code: Select all

function FloraPhysixLoop()  --Programmed by Cubex - Warning: This function pseudo-code was mentally programmed in my bathroom and then implemented in lua, can contain shit traces
    --Speed Ups
    local spGetUnitPosition = Spring.GetUnitPosition
    local spGetUnitPiecePosition = Spring.GetUnitPiecePosition
    local spGetUnitVectors = Spring.GetUnitVectors

    local pi = math.pi
    local abs = math.abs
    local random = math.random

    --Functions
    local function GetUnitPiecePos(unit,piece) --function by jK
        local x,y,z = spGetUnitPosition(unit)
        local front,up,right = spGetUnitVectors(unit)
        local px,py,pz = spGetUnitPiecePosition(unit,piece)
        return x + (pz*front[1] + py*up[1] + px*right[1]),
            y + (pz*front[2] + py*up[2] + px*right[2]),
            z + (pz*front[3] + py*up[3] + px*right[3])
    end

    --Parameters
    --local Randomness = 0.50       --Adding some random to trees, never conviced me, use at your wish
    local Scale = 0.4               --Scales the current applied force, bigger means more shakey
    local Speed = 0.5               --How much time takes a tree to turn to spetified angle, improves smoothness (too high might cause too radical moves, too low can cause lack of time to react)
    local RotationLimit = pi / 6    --The maximum angle which a tree can rotate
    local MoveThreshold = pi / 15   --If the movement is less than this, don't move, used to avoid "shake effect" in trees
    local RefreshInterval = 100     --How much ms to wait for each iteration
    local TreePosition = {}         --Each tree position (last x axis, last z axis) used to calculate the diference betwen each loop and checks how much the tree was moved until last check
   
    --Initialization
    --Spring.Echo("RING RING RING!!! BANANA PHONE!!!") --For knowing if unit script runs or it crashed :/
    for i = 70, 90 do
        local Piece = optObjects[i]
        --Show(Piece) --Used for looking all trees
        local px, _, pz = GetUnitPiecePos(unitID, Piece) --Actual Position
        TreePosition[i] = {px, pz} --update the last position with the actual
    end
    
    --Code
    while true do
        for i = 70, 90 do
            local Piece = optObjects[i]
            local px, _, pz = GetUnitPiecePos(unitID, Piece)            --Actual Position
            local lx, lz = unpack(TreePosition[i])                      --get the last position
            TreePosition[i] = {px, pz}                                  --update the last position with the actual

            --calculate the piece base traveled distance until the last update
            px = (px-lx) -- * (random() + Randomness)
            pz = (pz-lz) -- * (random() + Randomness)
            px = px * Scale
            pz = pz * Scale
            
            if abs(px) > RotationLimit then
                if px < 0 then px = -RotationLimit
                else px = RotationLimit
                end
            elseif abs(px) < MoveThreshold then
                px = 0
            end
            
            if abs(pz) > RotationLimit then
                if pz < 0 then pz = -RotationLimit 
                else pz = RotationLimit 
                end
            elseif abs(pz) < MoveThreshold then
                pz = 0
            end
            
            Turn(Piece, x_axis, px, Speed)
            Turn(Piece, z_axis, pz, Speed)
        end
        Sleep(RefreshInterval)
    end
end -- Cubex's Ecosystem ends here, bye indentation :( I will miss you
Attachments
cubexgasm.jpg
(35.19 KiB) Downloaded 4 times
video0.gif
(5.96 MiB) Downloaded 4 times
bandwithbunkerbuster.png
(2.33 MiB) Downloaded 4 times
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

x
Attachments
LICHO.jpg
(590.27 KiB) Downloaded 4 times
User avatar
Cubex
Posts: 56
Joined: 11 Jul 2012, 00:07

Re: Journeywar

Post by Cubex »

Yeah I wish to donate but...

Code: Select all

--Explain/Excuse code
while true do
    if Me.Age < 18 then
        Me.TouchBalls()
    else
        Me.Donate(Licho, "Spring Server", 10)
        break
    end
end
And extra

Image

Edit:
When you use my post to attach your alien rape pr0n? :P
Attachments
Allyouneedislove.gif
(1.37 MiB) Downloaded 4 times
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

Added the stealthforrest, it works now.
Image

Image
Attachments
angertheraphy.jpg
(346.21 KiB) Not downloaded yet
transitnode.gif
(1.08 MiB) Downloaded 4 times
ifyougotperfproblemsifeeldb.jpg
(1.09 MiB) Downloaded 4 times
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

Image
Image
now i have little cars tooo
Attachments
nothingandthis.jpg
(1 MiB) Downloaded 5 times
neddie.jpg
(1.14 MiB) Downloaded 4 times
noU.png
noU.png (37.31 KiB) Viewed 3159 times
littleCars.jpg
(1.15 MiB) Downloaded 4 times
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

Human prounounced in wulfish HU-nom-nom-nom
Image
BaNa
Posts: 1562
Joined: 09 Sep 2007, 21:05

Re: Journeywar

Post by BaNa »

Picasso u crazy but in a good way
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

Image

Sort of sad. I mean, we have what we have with the spring animation system, and we made of it what we could, and now that its starting to become awesome and have some potential (free bones however you like them, randomized animations easily possible, animation subsystems no big deal..) it hits this pieces limit...
Attachments
video0.gif
(11.47 MiB) Downloaded 4 times
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

I have returned to the physiks simulation of the rope. And it is still the same big heap of trouble it was when i left it. So i took the swoard and cut it. Some stuff in it worked, and some simply dont. The real problem was.. that it was no physik simulation at all. Rather - a mimikri of behaviour that a rope would show when put into some situation or another.

It worked.. and did not.. it couldnt do hanging through ropes.. and the mass that is object dragged did not slide really. If not dragged in a straight line.. i basically rolled the harpoon in and hid the not working from the world. Well.

Time for a rewrite. A good one. One with not the ton of EngineCalls this last beast had. The Problem is the Unit this thing is bound to.. It can tilt and Turn at any second, beeing blown away with every cannonball. Guess you never know how ilusoric your hopes for a easy sollution are until you tried it and failed flat.


http://www.youtube.com/watch?v=O3hyRsy0 ... re=mh_lolz
Attachments
better-Explenation.jpg
(407.95 KiB) Downloaded 4 times
picture.jpg
picture.jpg (25.06 KiB) Viewed 2970 times
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

Has anyone a suggestion who to simulate transparency (for example for bioOrganic stuff like amobeas or eggs, without having it as a feature? I would be happy for something like a Drag and Drop GLSL tutorial for such..
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Journeywar

Post by smoth »

maybe lups can fake something? is it a gooey sphere or glowy?
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Journeywar

Post by PicassoCT »

goey.. basically a pulsating egg, like a fishegg..

http://www.youtube.com/watch?annotation ... 9RUuTAM2H0
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Journeywar

Post by smoth »

damn, yeah good luck with that.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Journeywar

Post by gajop »

well i suck at GLSL but this probably should just be changing texture alpha parameter
that is, you create a fragment shader that just has an alpha setting which represents your transparency scale: check here for an example fragment shader: http://en.wikipedia.org/wiki/GLSL#A_sam ... ent_shader
change the last parameter to be the alpha scale you desire, the other values (r, g, b) are obtained from the texture;
you can probably even just assign gl_FragColor.a = _some_transparency_factor;
example of how you can use textures (i think at least):

Code: Select all

#version 330 core

// Interpolated values from the vertex shaders
in vec2 UV;
in vec3 Position_worldspace;
in vec3 Normal_cameraspace;
in vec3 EyeDirection_cameraspace;
in vec3 LightDirection_cameraspace;

// Ouput data
layout(location = 0) out vec3 color;

// Values that stay constant for the whole mesh.
uniform sampler2D myTextureSampler;
uniform mat4 MV;
uniform vec3 LightPosition_worldspace;

void main(){

	// Light emission properties
	// You probably want to put them as uniforms
	vec3 LightColor = vec3(1,1,1);
	float LightPower = 50.0f;
	
	// Material properties
	vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb;
	vec3 MaterialAmbiantColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor;
	vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3);

	// Distance to the light
	float distance = length( LightPosition_worldspace - Position_worldspace );

	// Normal of the computed fragment, in camera space
	vec3 n = normalize( Normal_cameraspace );
	// Direction of the light (from the fragment to the light)
	vec3 l = normalize( LightDirection_cameraspace );
	// Cosine of the angle between the normal and the light direction, 
	// clamped above 0
	//  - light is at the vertical of the triangle -> 1
	//  - light is perpendiular to the triangle -> 0
	//  - light is behind the triangle -> 0
	float cosTheta = clamp( dot( n,l ), 0,1 );
	
	// Eye vector (towards the camera)
	vec3 E = normalize(EyeDirection_cameraspace);
	// Direction in which the triangle reflects the light
	vec3 R = reflect(-l,n);
	// Cosine of the angle between the Eye vector and the Reflect vector,
	// clamped to 0
	//  - Looking into the reflection -> 1
	//  - Looking elsewhere -> < 1
	float cosAlpha = clamp( dot( E,R ), 0,1 );
	
	color = 
		// Ambiant : simulates indirect lighting
		MaterialAmbiantColor +
		// Diffuse : "color" of the object
		MaterialDiffuseColor * LightColor * LightPower * cosTheta / (distance*distance) +
		// Specular : reflective highlight, like a mirror
		MaterialSpecularColor * LightColor * LightPower * pow(cosAlpha,5) / (distance*distance);

}
as far as pulsating goes, you can have an input parameter, of type float, which is your current time frequency, and then just make your ambiant color a factor of it

you change the input parameter every time you use it to render with this shader (which is probably every time in one of those opengl lua callins)

if you want actual dynamic lighting produced by this object i suggest you check the BA's dynamic lighting widget/gadget (and might as well check behe's lava map for pulsating GLSL)
Post Reply

Return to “Journeywar”