mjbWorld - VRML File Format - forum discussion - From collection of nodes to game entities

By: Nobody/Anonymous - nobody
file From collection of nodes to game entities  
2005-12-03 08:25

Ive been working on a x3d implementation for use to make games. I've been making pretty good progress on the x3d implementation itself but i've still not resolved how I will map game entities to x3d nodes. 
What is an entity? I know that an entity needs to be synchronized over a network, its visual representation needs to correspond with its data representation in the scoring/rules simulation.  
Is an entity a pointer to a root transform node that encompasses all of that objects sub-nodes? Well if that's the case, then what happens when a humanoid mounts a tank or steps into the cockpit of a jet or car or motorcycle.  
What happens when a wheel gets blown off of a car? If its detached from its hierarchy? Probably not a problem as its now no longer apart of that entity. 
Anyone been thinking about these issues? 
Look forward to your ideas. 

By: Nobody/Anonymous - nobody
file RE: From collection of nodes to game entities  
2005-12-03 08:40

Also, the humanoid animation extensions seems to use a container to represent the entire person, but this seems to be a break from the standard vrml way of representing the world. 
What about "entities" like tanks and such?  
And with regard to HAnim again, does a gun placed in the humanoid's hand become apart of the human entity?  
I've only just begun to tackle these questions but hopefully they've been thought through already by others. Help. 

By: Martin Baker - martinbakerProject Admin
file RE: From collection of nodes to game entities  
2005-12-03 09:49

Hi Mike, 
Yes, I'm also interested in these issues, although I don't claim to have the answers. 
I think your probably right about placing things in the hierarchy of the humanoid's to make them move with it. Anything placed inside a Transform hierarchy will move with it and some of the humanoid nodes have Transform like properties, similarly with placing a humanoid under a Transform node hierarchy. However I'm not and expert on this and you might get a more definitive answer on the newsgroup comp.lang.vrml or on the mailing lists at: http://www.web3d.org/message_boards/ 
Does x3d define how events are "synchronized over a network"? Are you talking about a multiuser game here? I always though of x3d as a file format which does not define these things? However it does define an event mechanism, so I guess there is no reason this should not be extended across a network? 
Another thing that interests me is handling multiple copies of things. I really like the x3d concept of a PROTO. A tank could then be defined as a PROTO with parameters such as position, turret rotation, gun elevation, etc. The scene could then contain many tanks each with different parameters. 

By: Nobody/Anonymous - nobody
file RE: From collection of nodes to game entities  
2005-12-03 11:53

Hi Martin, 
Yes, im planning on making a network simulation and what I meant by "synchronized over a network" i was referring to the game entities that must be in sycn with the server and other clients in their respective area's of interest. 
What i'm trying to figure out is how to describe an entity from the scene components that describe how its rendered (and with physics node) how it behaves in the world.  
Being able to serialize x3d nodes and send them compressed over the network seems a good way to spawn new types of items into the world for dynamic updating of the world. 
I havent implemented PROTO yet and need to read up on it first before I try. So far I just have the X3DBindableNodes, transform, shape, appearnce, imagetexture, multitiexture, material, texturetransform, directionallight, indexedfaceset and related coordinate nodes. 
Ive been thinking about the entity problem and the i'm leaning towards using special prefixes in the node DEF fields. In this way, no special nodes are needed that might confuse a 3rd party x3d editor. 
So to signifiy the start of a new entity (say a tank with 1 body, 1 turret and 2 tracks) you could use DEF= "newEnt_Tank" for the group node, and DEF = "component_Body" , DEF = "component_TrackLeft" , DEF = "component_TrackRight", DEF = "component_Turret" 
(or whatever naming convention you like.) 
During initial traversal to load the scene, callback functions to your simulation manager could spawn new entities easily by parsing the DEF names. In the case of an entity within an entity, the "newEnt_*" marker would make it easy to know that a new entity should be spawned and that susbsequent children "component_*" nodes belong to this entity.  
What got me into x3d in the first place is how generic everything is and so I'm searching for an equally generic method of representing and deriving entities both functionally in the simulation. Being able to spawn a 6 armed monster (as opposed to having everything classical 2 arm 2 leg like in my first person shooters) in a generic fashion.  
Its kinda hard to explain exactly what i'm looking to do. Hope this makes sense. 

By: Nobody/Anonymous - nobody
file RE: From collection of nodes to game entities  
2005-12-03 12:21

Hi again.  
Martin with regard to PROTOs i have been reading and I want to see if I understand fully. Is the purpose of PROTO's only a file size saving feature?  
Because outside of that, I dont see the benefits. You can already easily share geometry and other content nodes like imagetextures via USE= "blah" so i'm not even sure that it really saves you that much file space. 
What am I missing? 

By: Martin Baker - martinbakerProject Admin
file RE: From collection of nodes to game entities  
2005-12-04 08:42

Hi Mike, 
Yes, I agree with you about how generic x3d is, its certainly the best 3D file format that I've come across although, from my point of view, its not quite perfect. 
I take your point that you can make multiple copies of an "entity" by duplicating some of its nodes and parameters and USEing parameters where they don't change. This should allow big arrays etc. to be defined only once and so avoid and major file size issues. I still think that its a bit messy especially if the "entity" has a complicated node hierarchy with things changing in different layers of the hierarchy. PROTOs just seem a more "generic" and powerful way of doing it. 
I find the DEF/USE a bit clunky, its a bit like a programming language where instead of procedures/methods/subroutines you only define these things inline the first time they are used. The PROTO is much more like a procedure with parameters. 
Another issue I have with x3d is physics (or the lack of it). Some of the humanoid have physics type parameters (mass etc.) but physics should really have been built in at a much deeper level to allow for collisions and interactions between any type of object. 
These are just some of my personal gripes, I'm not suggesting you do anything differently, PROTOs can be quite complicated to implement so only you can judge what is the most practical way to do it. 

By: Nobody/Anonymous - nobody
file RE: From collection of nodes to game entities  
2006-01-06 09:59

Hi Mike, sounds interesting. It's a good question - what is an entity...? 
I think what you could do when a player/NPC gets into a vehicle is detach the entity from the world's children and add it to the children of the vehicle. It will then transform with the vehicle - you'll also need to trap the player moves/input and pass these to the vehicle steering or aiming etc. (depends if he's the driver, gunner or passenger etc.). 
However, I've had a go at implementing autonomous NPCs with a mind to multiplayer games. The best solution I came up with is for them to take input events of where everything else is in the world. The entity has a standard interface into which you pass it's model representation plus other info like physics (speed, mass, gravity etc.) and world obstacles/terrain along with the other player/NPC positions (updating every frame or game tick). I also implemented a command type system to control their behaviour e.g. "go to position XYZ", "avoid player N", "attack target T" (and doing all those things at once as necessary). I didn't get around to "get in vehicle V" but if I had, I think I would then have passed the vehicle position and orientation to all players on-board rather than using the attach child method above. I would probably have flagged the 'driver', 'gunner' etc. too and pass their inputs to the control system for those entities. A simple 'passenger' would therefore not affect anything but would still be able to look around and maybe take control of a gun if the gunner gets hit (or even commandeer the gun from a NPC like in CoD2). 
What I ended up doing was creating an entity for each type of NPC. A flying craft can do lots more than a tank for example but they both need to avoid, attack and go places. 
It all comes down to parameterising the interface for the entity and the functionality you need to implement. What I'm tending toward is a world where everything is an entity in it's own right but with attchments/dependancies to other entities and limitations on it's capabilities. 
Like you said; your tank has a gun that can go up and down relative to the turret which can rotate relative to the tank body. The tank 'commander' steers the tank body with his 'movement' controls and aims the turret and gun with his 'look' controls. A Mech Warrior or even a humanoid uses the same control system but with slightly different overall movement capabilites (jumping, crouching etc.). 
I hope some of this helps. The ideal solution is for the entity animation to take control input from a player or AI interface and move the model accordingly whilst applying the constraints imposed by the physics and the other world objects.

metadata block
see also:


Correspondence about this page

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.