Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Switching ROOMS!; Here's the solution that works
Topic Started: Nov 30 2007, 01:04 AM (2,424 Views)
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
Well, probably Ultimate 3D writes data behind the ends of some buffer, when loading some of your models or creating some other type of objects. This would lead to an unhandled exception at the destruction of this object, so as you end the game it crashes. Make sure that you are using the fixed version of Ultimate 3D 2.1 final. If you do so you can send me your complete project or a reduced version of it, which causes the same problem. Then I could find the cause of the problem and fix it.
Offline Profile Quote Post Goto Top
 
Gandalf20000
Member Avatar
Enormous DirectX Newbie
[ *  *  *  *  *  * ]
Here is the file. Thank you in advance.
Online Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
You have to be more precise, when explaining problems. You said the game crashes with the code you posted, but (at least on my PC) it did not. It just did not give any new visual output. To fix this you have to use the following code instead of your code.
Code:
 
back=show_question("Would you like to return to the main menu?")
if back=true
{
with(all){
if(u3d_type!=0){
Destroy();
}
}
SwitchView();
global.u3d_initialized=false;
instance_destroy();
}
Offline Profile Quote Post Goto Top
 
Gandalf20000
Member Avatar
Enormous DirectX Newbie
[ *  *  *  *  *  * ]
THANK YOU! It finally works! :mad:
Online Profile Quote Post Goto Top
 
metroid prime
Member Avatar
game over man, game over
[ *  *  *  *  *  * ]
Gandalf20000
Jul 5 2008, 08:49 PM
I can't get this code to work:
Code:
 

back=show_question("Would you like to return to the main menu?")
if back=true
{
with(all){
if(u3d_type!=0){
Destroy();
}
}
global.u3d_initialized=false;
instance_destroy();
}

I have uninitialized variables equal 0, so that's not the problem. When I try this, the game just crashes.
Make sure you inititialize ta variables!! :mad:
Posted Image
Formerly known as Eanbro.
Offline Profile Quote Post Goto Top
 
Synexn-Prime
Member Avatar
Sierra Prime GF32 : Unit 7
[ *  *  *  *  *  * ]
I just thought I'd give out what I do in my game.

First of all, I have a *totally tricked out* control object for U3d set to persistent. I also set all of my PSS's to persistent, as guessable from the u3d_type line. After all that, and all my "system" objects are set to persistent (e.g. fmod, 39dll, physx) I can just call the following function.

If you have Destroy() being called in the destroy event for an object, it won't cause any problems since Destroy() only destroys when a valid U3D object is available.

Code:
 
// Just have somebody call this, and first we'll
// destroy all U3D objects. Then we'll destroy
// all GM objects. Finally, we'll go to the specified
// room. It's just like room_goto(index);
//
// U3DMasterRoomGoto(room_index)
// argument0 - Room index to go to
//

with (all)
{
if (variable_local_exists("u3d_index"))
{
if (u3d_type == 14) {
continue;
}
Destroy();
instance_destroy();
}
}

room_goto_next();


I use this when going from one U3D room to another U3D room. (e.g. A 3d Menu to Game Level)
Edited by Synexn-Prime, Nov 17 2008, 06:36 AM.
Synexn-Prime, the Bigger Sister. Prepare to watch her fly.
Watch that tear shatter the steel. 2012.
Posted ImagePosted Image
Current Stone: Water : Prepare to help her survive. June 2010.
formerly known as skarik
Offline Profile Quote Post Goto Top
 
blackhawk
Member Avatar
Elite Member
[ *  *  *  * ]
Okay, this works fine. I just need help with the following:

I have got my 2D Menu. It has a "Shop" button and a "Play" button.
When i switch to the shop, it opens a 2D room, and initializes U3D with the following code:
Code:
 

external_call(global.u3d_init,window_handle(),20,20,global.viewwidth/4,global.viewheight/4,global.u3d_z_buffer_format,global.u3d_multi_sample_type,global.u3d_use_right_handed_coordinate_system,global.u3d_device_type,global.u3d_few_message_output);


With all the other stuff on top of it ofcourse.
This works just fine. Now i have a 2D room with a small 3D view, to view the models in. (of e.g. selected weapons).
I can switch the room and stuff, using SwitchView(), all works fine.
But now when i play the game, it needs to be initialized with other x/y and width/heights.
Like this:
Code:
 
external_call(global.u3d_init,window_handle(),0,0,global.viewwidth,global.viewheight,global.u3d_z_buffer_format,global.u3d_multi_sample_type,global.u3d_use_right_handed_coordinate_system,global.u3d_device_type,global.u3d_few_message_output);


ofcourse this script does not get executed when i visited the shop, because of the global.u3d_initialized variable.

So, when i then press play, it starts the rendering frame in the shop-frame, if you know what i mean.

Is there a way to change the rendering frame's width/height and x/y? Or is there a way to re-execute the
Code:
 

external_call(global.u3d_init,window_handle(),0,0,global.viewwidth,global.viewheight,global.u3d_z_buffer_format,global.u3d_multi_sample_type,global.u3d_use_right_handed_coordinate_system,global.u3d_device_type,global.u3d_few_message_output);
script?
Because when i re-run this script the whole U3D thing just freaks out, wich isn't wierd afterall..

So, does anybody know how to fix this?
Omg you guys this is SO AWESOME
Check this shit out. How the hell is THAT possible?
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
Try adding global.u3d_initialized=false; to the destroy event of the control object. Then destroy and recreate it. That should work, even though you will lose all loaded models, textures, etc. and it will take a while. If losing all these things is not tolerable just do all the drawing with Ultimate 3D.

P.S.: So does the forum work permanently for you now?
Offline Profile Quote Post Goto Top
 
blackhawk
Member Avatar
Elite Member
[ *  *  *  * ]
Ill try it out. Thanks!

BTW: No it does not work. I currently using a proxy.. I think something is wrong in your database, something with my IP.. i dont know.
Omg you guys this is SO AWESOME
Check this shit out. How the hell is THAT possible?
Offline Profile Quote Post Goto Top
 
blackhawk
Member Avatar
Elite Member
[ *  *  *  * ]
Hmm. Im now going to try it out, but, dont i need to free the DLL from the memory to prevent memoryleaks?
Omg you guys this is SO AWESOME
Check this shit out. How the hell is THAT possible?
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
Well, yeah, it is probably better to do this using external_free("Ultimate3D.dll");. Not much of a problem anyway, is it ^_^ ?

P.S.: I will try to get you some help with the domain problem. Apparently something is wrong in the data of your DNS server. Nazle has the same problem and she appears to have the same ISP in a similar region.
Offline Profile Quote Post Goto Top
 
blackhawk
Member Avatar
Elite Member
[ *  *  *  * ]
yeah.. but when i call external_free the game crashes.
Omg you guys this is SO AWESOME
Check this shit out. How the hell is THAT possible?
Offline Profile Quote Post Goto Top
 
blackhawk
Member Avatar
Elite Member
[ *  *  *  * ]
BTW: Your way doesn't work either..
i still use SwitchView() and the whole if u3d_type==0 then {destroy() } stuff, i just added the global.u3d_initialized=false under the SwitchView. That should work shouldn't it?
Omg you guys this is SO AWESOME
Check this shit out. How the hell is THAT possible?
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
Nope, because then you are not calling global.u3d_cleanup. You should destroy the control object, that would be most logical.
Offline Profile Quote Post Goto Top
 
blackhawk
Member Avatar
Elite Member
[ *  *  *  * ]
Ok, ill try again with calling the cleanup function :P
Omg you guys this is SO AWESOME
Check this shit out. How the hell is THAT possible?
Offline Profile Quote Post Goto Top
 
Go to Next Page
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply