Page 1 of 3

Prison Age questions

PostPosted: Mon Mar 24, 2008 6:16 am
by Justintime9
Ok, I've been trying to make a prison age (not a D'ni one mind you, I hate when people claim to Discover ages, in GoW, we're supposed to write them, not find them :P) and, I have a few questions.
Image
1. how can I make the bars fade from a rusty texture, to a clean metal texture? I can't do a stencil, because it's not just one surface like other things, and I can't use decal blending... so how can I blend the texture on a 3D object like that? and, the inside walls of the building (which are going to be round)
2. I know how to animate, but how can I make it so that the player must press a button, and the door will open?

Re: Prison Age questions

PostPosted: Mon Mar 24, 2008 7:30 am
by Nek'rahm
errrrr...

You could probably use 3 textures. Have a rusty texture with a triangular pattern going from top left to bottom right. Then have a steel/metal texture go from about one foot to the right of the rusty texture and follow the walls. Then, by using a third texture, you could have the actual progression occur between them. I'm not incredibly sure how to do the last step... but I've seen it done... sorry if I'm not much help :(

Re: Prison Age questions

PostPosted: Mon Mar 24, 2008 7:41 am
by andylegate
2. I know how to animate, but how can I make it so that the player must press a button, and the door will open?


MWHAHAHAHAHAHAHAHAH......Prepare for a LOT of python scripting!!!!!!!!!!

No, seriously though, you're going to be surprised and what all you have to do to get it so that the avatar can interact with things, and so that the player can do things like open doors, pull levers, push buttons, etc, etc.

Right now I'm working on making a door in Zephyr Cove swing open when you click on it. Sounds simple, yes? Sure. But that's now how it's done I'm afraid.
There are 3 examples of doors that swing open in Uru: Teledahn, Ahnonay Cathedral, and Ahnonay Sphere 4 Maintenance Room.

Ahnonay Cathedral is the simplest of the bunch. You link in, step forward and the doors automatically swing open for you. If you import that Age and look at it, you'll see a DoorDetect Region that the avatar steps into after linking in. This is what detects the proximity of the avatar and tells the doors to open.
Now for the surprising part: the only other thing that is there, is the doors themselves, a couple of sound emiters for the door opening sounds, and a collider that's used to keep you from walking through the doors when they are closed, and also while they are opening. That's it.
With the way the Age is imported right now, the only ALCscripting you see deals with cameras and camera regions. It does not show anything else for like the doors or the detect region, so one can only guess what might be there.
There is NO python file for these doors that I can find. So good luck on making it work that way.

Teledahn. The doors are the ones by the cannon. When you first get to the AGe, that back door is closed. When you click on it, all sorts of things happen. If you're in 1st person mode, you're forced to 3rd person mode to show the animation of the avatar grabbing the door handle and pushing on that door. Later inside, you have the same thing for what is called the Catwalk Door, only in this case the avatar grabs the door handle and pulls.
When you import this part of the Age, you will see a external and internal detector region, click dectectors, a Door Sweep Region, sound emiters, etc, etc. Rather complex looking. Again, importing the ALCscripting only shows Camera Regions stuff.
There's a python file. It's called xStandardDoor.py and that's the one that gets used in Teledahn. I know this as yesterday I loaded up Uru, deleted my Teledahn book to reset the age (did this because, though importing the Age, and looking at the python file it acts as though you can close the door, but it won't let you, I tried). I then worked my way through again to the door. Right after I opened the door, I quit, and loaded up the python log file to see what was going on, and that's the file it points to: xStandardDoor.py

Okay, you take a look at that python file and what do you see? All sorts of things talking about the state of the door (indicated by the age's SDL file), and stuff for disabling the collision plane after you've opened the door, etc, etc.
But it does not show, nor say how the door is being swung open, nor pointing to any animations.
That's because it's all put in the Age itself. But again, ALCscripting right now will only show Camera Regions.

Ahnonay Sphere 4 Maint. Room. A lot like Teledahn, except you're having to satisfy conditions first.

So, let's say you want to just have your doors slide open, like Trylon's gate in his Function Test Age.
Well, the way he did it, is not how it's done in Uru. He had to make a work around. Because, again, many of the things are being put in the Age itself.
There's a xStar_TrekDoor.py file in python, but again, it's not telling the mesh to be moved, only checking on the state of things to make sure that you can open the door.

To do it Trylon's way, you have to set up the click region (for either a lever, button, or door itself), then you have to use math and a timer to make your door move. It does work just fine. In his Age there, you click the button and the gate opens up. If you want it to move in a different direction of faster, you can just change some of the things in his python file.

Anyway, that's one thing about objects moving and animations in Uru, a lot of it is being put in like we put stuff in our Ages with Blender and ALCscripting. I've seen another thread with a lot of the ALCscripting listed, just no examples of how to use it (and of course someone said that even the Tool Team doesn't understand them all yet). But I have a feeling if we can ever get ALCscripting fully understood, we'd have a very powerful tool on our hands for doing things like object animations, etc, etc.

As for your rust stains, I'd use some texture blending on the objects. Should make them look fine. There's a tutorial for doing that on the Wiki.

Re: Prison Age questions

PostPosted: Mon Mar 24, 2008 7:53 am
by Justintime9
:shock: wow... I had no Idea :P I suppose I should just wait until more is know about it? or, how did you say trylon did his? you lost me there... and, which texture blending tutorial did you mean? the ones about using stencils? if so, how would I do that on a 3D object?

Re: Prison Age questions

PostPosted: Mon Mar 24, 2008 8:22 am
by andylegate
Yah, here's the Wiki link. read it all the way through.

Tutorial

And yes, even 3D objects......I mean you have to UV map stuff right? That's why you unwrap it to do so. Objects might be 3D, but their textures are all 2D.

Re: Prison Age questions

PostPosted: Mon Mar 24, 2008 8:27 am
by Nek'rahm
"Jeez, can anyone take care of it?" ~Fox McCloud, Star Fox

Seriously though, that's five times the work than I used to do for scripting stuff for my last game (Star Wars Jedi Knights Jedi Academy)...

I'm scared o-o andy, could I have my warm milk please?

Re: Prison Age questions

PostPosted: Mon Mar 24, 2008 8:37 am
by andylegate
Seriously though, there's nothing very easy about manipulating objects right now. That's why nobody's Age has birds flying around, or quabs dancing. It's not easy to do until more things get reversed engineered, and from what I've seen in Uru's original python files, it still is not easy to do.

Trylon's Gate in his Age is actually not that hard IF you pay attention to what you're doing. First he made the stuff (IE Gate, Button, Click Region, Animation point), and then put in the ALCscripting, which is not that hard if you import that age and look at it.

But then you have to make a python file like his, only with your own stuff in it. Here's what his looks like:

As you can also see, he kindly put in remarks so that you can try to understand what is doing what in here. This works, as we have his Age to prove it, and in Camp Bravo Night Time, I used it and have a bright yellow bouncing ball going up and down in the air.
Code: Select all
# emacs-mode: -*- python-*-
from Plasma import *
from PlasmaTypes import *
from PlasmaKITypes import *
from PlasmaVaultConstants import *
from PlasmaNetConstants import *
import xLocalization
import string
import time

GateStateOpen = 1
GateStateClosing = 2
GateStateClosed = 3
GateStateOpening = 4

actClickableObject = ptAttribActivator(1, 'Act: Clickable Object')
ObjectMsg = ptAttribString(2, 'Object String')

class FuncChk01Clickables(ptModifier):
    __module__ = __name__

    def __init__(self):
        ptModifier.__init__(self)
        self.id = 1570001
        self.version = 1
        self.AgeName = None
        self.GateCollider = None
        self.Gate = None
        self.StartTime = 0
        self.GateState = GateStateClosed
        self.ZHeight = 19.5
        self.ZClosedPos = 10
        self.ZOpenPos = self.ZClosedPos - self.ZHeight
        self.GateTimerInterval = .03
        self.GateOpenTimerId = 1
        self.GateCloseTimerId = 2
        self.GateMoveDuration = 5.0

    def OnFirstUpdate(self):
        self.AgeName = PtGetAgeName()
       
    def OnServerInitComplete(self):
        # Obtain the gate collision object
        self.GateCollider = PtFindSceneobject("GateCollider",self.AgeName)
        if self.GateCollider == None:
            print 'OnServerInitComplete - could not find GateCollider!'
        # Obtain the visible gate object
        self.Gate = PtFindSceneobject("Gate",self.AgeName)
        if self.Gate != None:
            # Turn off its physics, since we will be moving it
            self.Gate.physics.suppress(true)
        else:
            print 'OnServerInitComplete - could not find Gate!'


    def OnNotify(self, state, id, events):
        print 'OnNotfiy: id=',
        print id
        print 'ID of Clickable logicmod:',actClickableObject.id
        if (id == actClickableObject.id):
            print "Message:",ObjectMsg
            print "Value of message: '%s'"%(ObjectMsg.value)
            # Check for the button press
            if ObjectMsg.value == "GateButton" and self.Gate != None:
                print "Processing Gate"
                # Close the gate, if it is open
                if self.GateState == GateStateOpen:
                    self.StartTime = time.clock()
                    self.GateState = GateStateClosing
                    # Enable the gate collider, to prevent access during the close
                    self.GateCollider.physics.suppress(false)
                    # Register a timer callback for closing the gate
                    PtAtTimeCallback(self.key,self.GateTimerInterval,self.GateCloseTimerId)
                # Open the gate, if it is closed
                elif self.GateState == GateStateClosed:
                    self.StartTime = time.clock()
                    self.GateState = GateStateOpening
                    # Register a timer callback for opening the gate
                    PtAtTimeCallback(self.key,self.GateTimerInterval,self.GateOpenTimerId)


    def OnTimer(self, id):
        if (id == self.GateOpenTimerId):
            currentTime = time.clock()
            # Calculate the Z position of the gate, based on the
            # duration since the button press
            zPos = self.ZClosedPos - ((currentTime - self.StartTime)/self.GateMoveDuration)*self.ZHeight
            oldPos = self.Gate.position()
            newPos = ptPoint3(oldPos.getX(),oldPos.getY(),zPos)
            # Warp the visible gate object to the new position
            self.Gate.physics.warp(newPos)
            if zPos <= self.ZOpenPos:
                self.GateState = GateStateOpen
                # Turn off the collider - the gate is now open
                self.GateCollider.physics.suppress(true)
            else:
                PtAtTimeCallback(self.key,self.GateTimerInterval,self.GateOpenTimerId)
        elif (id == self.GateCloseTimerId):
            currentTime = time.clock()
            # Calculate the Z position of the gate, based on the
            # duration since the button press
            zPos = self.ZOpenPos + ((currentTime - self.StartTime)/self.GateMoveDuration)*self.ZHeight
            oldPos = self.Gate.position()
            newPos = ptPoint3(oldPos.getX(),oldPos.getY(),zPos)
            # Warp the visible gate object to the new position
            self.Gate.physics.warp(newPos)
            if zPos >= self.ZClosedPos:
                self.GateState = GateStateClosed
            else:
                PtAtTimeCallback(self.key,self.GateTimerInterval,self.GateCloseTimerId)


EDIT: PS......don't quell at this. Remember, Cyan had people that built, people that textured, and people that did coding. So if you can master this (and I don't fully understand Python, but was able to use it), then you're doing a heck of a job, 'cause you're doing all the jobs several people at Cyan had all by yourself. So if you don't understand something, you're NOT stupid or ignorant. You have to remember you're trying to do something that a whole team does, not one person, and just attempting it should earn you pats on the back.

Re: Prison Age questions

PostPosted: Mon Mar 24, 2008 10:00 am
by D'Lanor
Again it must be stressed that animating objects with Python is not the way Cyan does this. They use proper animations. Since animations have not been implemented in PyPRP yet Python is the only way we have right now.

Although even with proper animations you would need some Python to make them work correctly in a multiplayer environment.

Re: Prison Age questions

PostPosted: Tue Mar 25, 2008 4:28 am
by Justintime9
ok, well I'll put that on hold for now... but now I'm on the actual prison age part of the age... and it's soooo annoying!!!! if the camera isn't close enough to the rock, it doesn't show up on the render screen!!!!!! is like, disapears! and the only spot I can get it, is too close!!! take a look: http://www.mediafire.com/?n7jz1v3mkbr what's my problem? (btw, the rock is supposed to be purple... or rather, I began UVmapping a rock texture, but then decided to use a stencil, so I deleted the original rock texture.)

Re: Prison Age questions

PostPosted: Tue Mar 25, 2008 5:20 am
by Robert The Rebuilder
I've taken a look at your Blend file. To prevent the geometry from disappearing as you rotate the view, you'll need to move out your far clipping plane:

- In the 3D View window, choose "View Properties..." from the View menu
- In the View Properties dialog, set "Clip End" to 1000 and hit Enter