Game Development Community

Model Injection & Screen Resizing

by Welias D. Willie II · in Torque Game Engine · 08/11/2003 (12:05 pm) · 15 replies

I am interested in purchasing TGE but have had trouble finding answers to some of my questions as the documents are only available after purchase...

My first question is this: Does TGE have the ability to inject models at runtime, more specifically can I create an interface that will allow me to import, during a running game, a 3D model that I have just created?

Second question: Can TGE be used as a windowed application with the ability to resize the window by dragging the edges of the windowed application to the desired area?

Thanks,
Punky

#1
08/11/2003 (12:29 pm)
1.) minor tweaking to allow for this.
(you would need to write a script that would preload your model and exe it at runtime)

2.) more minor tweaking.

so yea np.
#2
08/11/2003 (2:34 pm)
Minor tweaking I can handle. To confirm... A script could be written, that when executed from within an active game, so that a model is "pre?" loaded into the game. What I am attempting to create is a dynamic world where all models are injected during game play by database driven directives such as time of day, events, etc.

Another question about the engine... Can the scripts be compiled to protect a completed project? Or are they always stored as text based .cs files?

Thanks,
Punky
#3
08/11/2003 (2:46 pm)
Yea they get compiled to *.dso binary versions.

"pre" loaded cause you had me thinking you were "Creating" the model, if it is not in the resource tree at load time.
it will need to be preloaded.
I Could be wrong.. stuff has changed a bit.

either way this is trivial..
#4
08/12/2003 (1:16 am)
Objects need to be preloaded when the engine start up afaik. That means that the object shapes/codes need to be present at startup.

That does not mean that they are in the game world!! Once preloaded you can trivially add instances of the objects to the game world using scripts

So I dont think (I'm not an expert, so maybe someone else has a better answer) you can create totally new objects in 3d studio and inject while the game runs.

Makes sense?
#5
08/13/2003 (8:33 am)
I guess the confusion I am having is this... I hear that the objects have to be "preloaded" yet I also hear that the objects can be injected into a game while it is running, so... Does that mean there is a "preload" routine that would have to run on an object (model) so that it can be injected into a running game?

My goal is this: I want to create a persistent game world that runs constantly on a server, yet I want to modify the world with new objects during the game play so it is very important that the game engine I choose has the capability to inject new models without restarting the game.
#6
08/13/2003 (1:02 pm)
You got to distinguish by "loading the binary file" from "putting something into the gameworld"

Preloading simply means that the object data will be loaded into mem on binary file execution (starting the server).

You then got a pool of unused objects sitting somewhere in memory. When needed (e.g. you spawn a dragon), you make an instance of the preloaded dragon object and put it into the game world. When the dragon dies, you remove it again - but its still loaded outside the game world in the "object storage".

A bad metaphor:

You got a collection of 10 toy cars in a box. You bring the box to the table where you want to play with them. The table is the "game world", and the cars are "preloaded" in the box, ready for play.

You then "inject" 2 cars from the box to the table. One car crashes and you put it back in the box (remove it from the game world). It still exists off the table for later injection, but is not active in the game.

Did that clear it up?
#7
08/13/2003 (1:14 pm)
You tell im' ICE
#8
08/14/2003 (12:31 pm)
Okay it clears it up but unfortunately it points out that I may have a problem with this engine without modification.

I had a feeling it was this way but the first couple of responses were telling me "sure with minor modifications", which may still be true. But, the problem I have is that I do need to be able to inject models to a game where the models were not preloaded at the time of execution of the game server.

Bad metaphor:

collection of 10 toy cars in a box, put the box on the table to play with them. The table is the "game world", and the cars are "preloaded" in the box, ready to play... Mom goes out and buys a new toy and without my knowledge she tosses it into the box when I am not looking. Then when I look into the box I realize that I now have a dino to terrorize the car game.

This would allow me to leave a game running for a week without restarting the executable. Then on wednesday I decide I want to put in a new model, I design it in 3DS Max, prep it for this engine, load it in the proper directory structure, and with a command from within the game I could "spawn" the object into an existing game.

That is what I am looking to do. Now, if the engine is not already capable of doing that, does anyone know if it would be to much of a nightmare to modify the code to do such a task?

Could it be done with scripting or would it be actual modifications to the core code?

Thanks!
#9
08/14/2003 (12:37 pm)
Maybe I was to vague on my original question:

-------
My first question is this: Does TGE have the ability to inject models at runtime, more specifically can I create an interface that will allow me to import, during a running game, a 3D model that I have just created?
-------

Emphasise on "import, during a running game, a 3D model that I just created"... just created being just created while the game was already running.

Thanks
#10
08/14/2003 (2:07 pm)
Good question Derek. I see your need now, and I dont have the answer.

Everything is possible having sources available. But its a question of how complicated it is to hack the sources to allow for runtime loading of new models.

Any clue BadGuy?
#11
08/14/2003 (2:17 pm)
Roger ..
easy pie.
this is where the preload has to happen.
you must have a script that makes sure the preload pass's
trivial.
#12
08/14/2003 (4:24 pm)
Badguy... so what I am gathering is that if I write a script to handle the "preloading" of a model then this can happen:

10:30 am start game
11:00 am create model in 3ds max and prep it for use in game
11:15 am (while game is still running) execute script to preload model
11:30 am trigger something in the game that injects new model into game environment

Thomas,

So to your knowledge this can't be done with scripts?

I am sure it can be done by hacking the source, but what a headache to do that!

Although I may be prepared to hire someone to do that portion of the engine modification for me.
#13
08/15/2003 (1:22 am)
I'm out of my league even attempting to answer it, so I wont. Cant help any further, but its a good question that I would like the answer too also
#14
08/17/2003 (5:07 pm)
Anyone have an answer to this one?
#15
08/17/2003 (7:08 pm)
Derek - that should work out of box.

The problem comes when you want to reload the model in-game or dynamically create it from code (ie, a procedural model). Torque isn't set up to do those things at the moment. But what you want should be fine.