climbing

Blitz3D Forums/Blitz3D Programming/climbing

Ruz(Posted 2004) [#1]
anyone done any climbing code for 3rd person /tombraider style.
Hard or easy?


Jeroen(Posted 2004) [#2]
What do you mean with 'climbing code'?
What do you actually want to achieve? Please be specific.

I *guess* you want certain spots where the character can 'hang' or 'pull himself' on to. Platforms?

In that case, parent a pivot on the player's hands, check (on jump event) if the pivot is near a platform (a seperate entity) and if those two entities are smaller than a certain value (entityDistance) trigger events (e.g character animation of someone pulling him/her self up, etc)


Ruz(Posted 2004) [#3]
I *guess* you want certain spots where the character can 'hang' or 'pull himself' on to. Platforms?

yeas thats exactly what i meant. should have explained better.
cheers


(tu) sinu(Posted 2004) [#4]
This seems to be a tricky thing, all depends on how you want to achieve it. Do you want climeable walls of one height or various heights ie waist height upto high jumping range ledges?
I had loads of ways of doing this in theory which seemed to have everything workable, just tell me which way and i'll try and explain it as easily as possible since i was doing it for my 3d platformer engine.


Ruz(Posted 2004) [#5]
I just started thinking baout it today seriously. I like the way tombraider handles it. I want to make use of my animations as much as poss, so its basically jump with arms outstreteched, hands grab , then pull up.its nice if yuo can jsut hang there for while also.

the platforms will all be above head height or at least most of them.
I was thinking of climbable walls bit I am not careful my control sytems will be an exact replica of tombraider.

I managed to get the character to 'stop' when aligned with the platform , but is a bit annoying, because of gravity.
getting all sort of weird things happening.

another approach would be to have the player pull himself up and kind of leap on to the platform. might look nice and be easier to handle


Ruz(Posted 2004) [#6]
the main problem I am having is making the character 'stop'
because gravity is acting on it and the way i have it set I can't seem to stop gravity working.

I tried setting the collision response on the platform to 1, but that just makes the character completey stop in one place forever.


jfk EO-11110(Posted 2004) [#7]
You can use a transparent box. Well it's semi-transparent in in your level editor and fully transparent in the game engine. Then you should Dim an array with 6 Floats to store the Minimum X/Y/Z and the Maximum X/Y/Z of all the "ladder-boxes". Now in the game you can check the array each frame and determine if your character is standing inside one of the boxes (btw I handle underwater mode this way too).

If your char is inside a ladderbox, set a gravityflag to zero and handle the keys diffrently: "forward" will be "foward" AND "upward" and "backward" will be the opposite. you need to fiddle a bit with the part when he jumps off the ladder or reaches the ground or the top of the ladder, but I think it will work nicely the sooner or the later.

The usage of such an invisible ladderbox makes it easy to make any part of your level "climbable". If you use your homebrew Level editor to add such things in a WYSIWYG Mode then this will be easy. But you can do it also with a Tool like 3dsMax etc, simply name that part "ladder" or something. (Unfortunately you'll need to load the level using LoadAnimMesh to determine the Children Names, somebody correct me if I'm wrong - so it would be a good idea to add such helper geometry in a second step with a little placement tool)

To determine the world positions of the ladder-boxes vertices you need to use Countvertices,VertexX, VertexY VertexZ together with the tformpoint commands. The Array could look like this:
dim minmax_ladder(5,number_of_ladders)
where index 0,1,2 are Min xyz and index 3,4,5 are Max xyz.

The hardest part is the init and exit of the climbing mode.

EDIT: I just saw I didn't read your question carefully and maybe I kinda misunderstood it. The artistic Move when Lara reaches the top of whatever could be achieved with a further helper box which would trigger an animation. However, with the Method I described you will probably not have "grip-perfect" climbing, but at least quake2-like as seen in adventures like "Indy: Tower of Babel".


Ruz(Posted 2004) [#8]
sounds interesting jfk. I will give that a try also.
At this stage I am not saying i have to have perfect climbing, I am just explorng the idea and see what comes out.
I made a very rough version, that basically works but is a bit crap.
you jump, grab hold of the platform by pressing CTRL( this turns off gravity) so you stop(or hang in the air), then pull up to platform level using move entity. this relies on entity distance so is a bit kludgey and doomed to failure , since once you are on the platform you bounce up and down.(?)


BTW can't do findchild with loadmesh?

I am tempted to make a little placement tool, but have not looked in to that.
I would like to place entities with my mouse inside my level, then save the b3d file.

What i am doing now is placing them in max , then making a note of the x,y,z. works pretty ok, bit of a pain though


jfk EO-11110(Posted 2004) [#9]
You could use Droplet from Dr.Av or my Interior Dropper or write your own little Tool. Just keep it simple. I suggest not to save everything as a mesh, instead save a File that contains all paths, positions, scalings etc. of the meshes of a level. You could then use a simple walktrough code with a little gui including fileselector, primitives, Parameter Editor etc. Don't make a big deal out of it.

Maybe you tried the Placement tool I released for Plasma. you could try that too, the demo comes with a loader example.

The good thing with it is - the level will look absolutely the same in the game and in the editor.
-----
Yes, if you load a Mesh using LoadMesh, the seperate Parts will be Surfaces, and afaik there is no command like "FindSurface(string)". If you load them using "LoadAnimMesh" then the seperate Parts will be Children (and the Children have to be checked recursively), which can handle FindChild(string). At least that's what I believe until now :)
Using LoadAnimMesh isn't a good idea if it doesn't contain animations at all IMHO. Nevertheless, if you use it, it will make it easy to identify materials on collision, such as footsteps on diffrent materials and so on. From this point of view LoadAnimMesh is the better choice. To be honest - I am not sure anymore what's better :]


Ruz(Posted 2004) [#10]
good idea on the editor jfk. I will use yours, cause it worked fine on my machine.
My village loaded fine, althogh it was huge, cause I normally scale my meshes way down when loading them in blitz .

'if you use it, it will make it easy to identify materials on collision, such as footsteps on diffrent materials and so on'

actually i used loadmesh for my village and managed to get my footstep sounds on different materials working fine using
GetSurface( )

anway i haven't learned enough to write a good editor yet, but I would like to at some point.
I seem to have only learned the stuff I need to do particular bits of my demo so far, leaving big gaps in my knowledge.


jfk EO-11110(Posted 2004) [#11]
Yes, the GetSurface() Way is the way for LoadMesh, although it's a bit more tricky. If you use my Editor you can also use the "user name" string field to store some information with an object, plus you can position 3D sounds, although they all use the same drop off parameters and so on.

BTW it would be possible to mute 3D Sounds when a linepick signals that the source of the sound cannot be seen (to prevent sounds go trough walls like trough air), but this would be a remarkable speedkiller because of the Linepicks.

A level Editor (placement tool) isn't that hard. Most work is the gui. I usually suggest to use a generic Object structure, be it a type or a number of arrays or a multidimensional array (as in the csp engine). Basicly it's an Entity-Parameter Wrapper. This will give you a variable for every possible setting of an entity: scale, rotation, position, alpha, textureflags, FX, Collision flag and so on. Maybe you need to sit down first and write a list of all Properties you want to store. You can also scroll trough the Blitz Command Reference and simply note every kind of possible setting command to produce that Wrapper.

Then you implement a feature that will let you load Meshes, position, rotate, scale etc. them. While you do this you always store the values in the said arrays in the same time. Then you have to make a save function. This will simply store all Property Arrays of all Objects in a File.

Now take the Save-Function and modify a copy of it to be a Load Function. That's dead easy and it will help you to make it load things in the correct order.


Ruz(Posted 2004) [#12]
BTW , how do i use a PLD file opnce i have saved it . Obviously I wish to just load the b3d plus all the info on the additional objects that are stored in the pld file.
Normally I load everything seperately using loadmesh.

is there a specific loader funtion for use in my own project, which encompasses the main b3d plus all the additional entities listed in the pld file.

suppose it just a case of stripping down the load level function in your loader_only.bb. looks a bit intimidiating to me he he.
I have been getting to grips with the more basic stuff though, like storing info in files, then reading the files. I got a 'barrel' to load doing this.
so far all I have is the b3d name in the file( barrel.dat), no extra properties yet.


jfk EO-11110(Posted 2004) [#13]
You really should take it easy and use the level-loader. It is already stripped down. It includes the loading of sounds, meshes including Texture Flags (also for automaticly loaded textures, using TextureFilter) as well as one example of filename-triggered functionality (lightflares)

I can send you the documentation of the fileformat, which is part of the csp engine 2.0 source release. Although the format is slightly diffrent, the generic object structure is the same, only the file header is slightly diffrent.


Ruz(Posted 2004) [#14]
that would be helpful, cheers
I basically understand whats going on , but its implementing it in my particular set up which is as usual causing me problems. I will look at it again tomorrow


Gurra(Posted 2004) [#15]
do somebody know how to create a siple AI?


jfk EO-11110(Posted 2004) [#16]
Gurra - there are many diffrent kinds of AI. I would also say that this question is off topic in this thread. Maybe you better start a new thread about it.

And browse the code Archives, maybe you gonna find the simple AI you are looking for. At least you can learn a lot from the high number of goodies.