Game Development Community

How to change "on the fly" the datablock

by Rafael Marques · in Technical Issues · 03/26/2007 (6:43 pm) · 5 replies

Hello,

I want to change a player datablock and skin in real time, it's possible?

The effect that i want is a transformation (Man to car).

Thanks!!

#1
03/26/2007 (11:56 pm)
You cant change the datablocks in realtime, they are designed to stay constant to reduce network traffic.

there are a number of resources for extracting datablock members from the datablocks. i dont like your chances of making your car to man transform that way.

I would delete one and create the other, just keep in mind you will lose the state of member variables in the objects when you delete them.
Keep them on the local connection object if you can
#2
03/27/2007 (2:59 am)
Umm. you can use setDataBlock on any class that has a datablock, and if done on the server, it will auto-magically do what you want.

What you cannot do is change values within a datablock.
#3
03/27/2007 (8:00 am)
The problem is, Rafael seems to not only want to change a datablock, he wants to switch the object class as well from player to vehicle which isn't exactly the same. you would need to swap out the entire player object for a vehicle object. if you're careful, you could probably pull it off but it wouldnt be easy to make it convincing.

and you can change values within a datablock. the changes just wont be reflected on all clients. for a single player game, changing/modifying datablock values is the same as changing object instance values.
#4
03/27/2007 (8:18 am)
Firs of all fogive my bad english..

Thanks for fast answers!

Well, i'll try setDataBlock, i think the transformation for a vehicle is more difficult, (i'm learning torque) i'll try a forgman, change just the skin and jump.

if somebody have any idea, i'm all ears!

Thanks!
#5
03/27/2007 (8:33 am)
Quote:
and you can change values within a datablock. the changes just wont be reflected on all clients. for a single player game, changing/modifying datablock values is the same as changing object instance values.

Your elaboration is correct, but at the stage of understanding of the poster, I didn't want to fully explain the details of datablocks and their tips/tricks/best practices all at once.

Yes, you can. no you shouldn't change values within a datablock. It's not a good habit or practice to start, because it will bite you in the long run.