Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
1 registered members (AndrewAMD), 599 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
attach one entity to another randomly at specific locations #416100
01/28/13 01:02
01/28/13 01:02
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline OP
Senior Member
xbox  Offline OP
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
I need to be able to attach one entity that has several possible attachment locations on it, to another entity with multiple attachment locations.

Example. I start off on the right square and pick one of the green locations, I then need the left square with red locations to randomly pick one of the red locations and attach its self to the green location.

How would I go about doing this? Any help would be appreciated.

Last edited by xbox; 01/28/13 01:03.
Re: attach one entity to another randomly at specific locations [Re: xbox] #416102
01/28/13 01:47
01/28/13 01:47
Joined: May 2009
Posts: 5,367
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,367
Caucasus
Do you need to check, if any of those locations are free or so? Maybe simple logic via random variables?
Code:
var randomPos = integer(random(3)); // one of 3 random positions
if(randomPos == 0){  // first position here  }
if(randomPos == 1){  // second position here }
if(randomPos == 2){  // third position here  }

From here on, you can insert the different positions, to be attached at.
This maybe not what you are asking for, sorry if this crapp didn't help..


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: attach one entity to another randomly at specific locations [Re: 3run] #416203
01/29/13 00:52
01/29/13 00:52
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline OP
Senior Member
xbox  Offline OP
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
No, those spots will never be pre-occupied. These boxes are rooms and the colored spots on each box are just doors. I want to be able to walk through a door, have another "room" created and it will be placed right out side the door i just selected with one of the new rooms doors lined up so i can walk into the room.

here is a video i made of a prototype showing what Im talking about. [video:youtube]http://www.youtube.com/watch?v=kpT8Q7XH_0E&feature=youtu.be[/video]
the three different colored rooms you see appear and disappear are actually the same room saved into three files with each individual door saved as the origin vector.

There has got to be another way to do this for all possible doors. I don't want to hard code every single one.

Here is the code for just those three rooms to appear at just that one opening on the blue room

Click to reveal..
#include <acknex.h>
#include <default.c>
#include <keys.c>

ENTITY* room1_d1;
ENTITY* room2_d1;
ENTITY* room2_d2;
ENTITY* room2_d3;

function space();

int main()
{
level_load(NULL);
camera.z = 768;
camera.tilt = -90;
camera.pan = 90;

room1_d1 = ent_create("room1.wmb", vector(0,0,0), NULL);
room1_d1.pan = 0;
while(1)
{
while(!key_hit(57)){wait(1);}
space();
while(!key_hit(28)){wait(1);}
ent_remove(room2_d1);
ent_remove(room2_d2);
ent_remove(room2_d3);
wait(1);
}
}

function space()
{
var door_sel = integer(random(3));
if(door_sel == 0)
{
room2_d1 = ent_create("room2_l.wmb", nullvector, NULL);

room2_d1.pan += room1_d1.pan + 90;
room2_d1.x += room1_d1.x + 0;
room2_d1.y += room1_d1.y + 128;
room2_d1.z += room1_d1.z + 0;
}
if(door_sel == 1)
{
room2_d2 = ent_create("room2_t.wmb", nullvector, NULL);
wait(1);
room2_d2.pan += room1_d1.pan + 180;
room2_d2.x += room1_d1.x + 0;
room2_d2.y += room1_d1.y + 128;
room2_d2.z += room1_d1.z + 0;
}
if(door_sel == 2)
{
room2_d3 = ent_create("room2_r.wmb", nullvector, NULL);

room2_d3.pan += room1_d1.pan + 270;

room2_d3.x += room1_d1.x + 0;
room2_d3.y += room1_d1.y + 128;
room2_d3.z += room1_d1.z + 0;
}
}


Re: attach one entity to another randomly at specific locations [Re: xbox] #416206
01/29/13 02:43
01/29/13 02:43
Joined: May 2009
Posts: 5,367
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,367
Caucasus
Ok, so you are trying to create a random level or something? I'm interested in this as well, I might give it a try, to write it from scratch in maybe next few days, as I'm busy at the moment.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: attach one entity to another randomly at specific locations [Re: 3run] #416210
01/29/13 05:35
01/29/13 05:35
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Ahh you are copying the film laugh
You should not use global entities, try to make them local, so you can spawn many of these rooms laugh

Re: attach one entity to another randomly at specific locations [Re: Ch40zzC0d3r] #416211
01/29/13 05:39
01/29/13 05:39
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline OP
Senior Member
xbox  Offline OP
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
what film? I need to see this film...

making them local is easy enough, its coming up with the algorithm to properly rotate and align each new room with the pre-existing room, without having to hard code each and every possibility.

Any thing is possible, the issue lies in the ability to figure out the solution. laugh

Re: attach one entity to another randomly at specific locations [Re: xbox] #416222
01/29/13 10:58
01/29/13 10:58
Joined: May 2009
Posts: 5,367
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,367
Caucasus
Why you need an algorithm for this? I have a small idea in my head, and it's going to be very simple. Idea is like this:
- 4 type of rooms (maybe more, but for now 4 - doors, left 3 - doors, right 3 - doors, no doors at all);
- each room (depending on it's type) has it's spawn positions for the next rooms;
- each room, spawn random rooms, depending on it's type.

But there is a problem, that I guess I'll face. Rooms will overlap each other, I'll need to avoid that.


Edit: about the movie, it's called CUBE.

Edit2: I have another idea in my head, how to do this, but I guess that will be slow, cause of the number of draw calls..
If we could only merge all entities into one big model at the end, that might be nice.. But I don't know how to do that.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: attach one entity to another randomly at specific locations [Re: xbox] #416681
02/03/13 14:51
02/03/13 14:51
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
hi there ... you could have a look at a contribution i
made in litec contributions ... the mazelike generator with
auto model fitting thread....
from that you could find ideas perhaps by using a cell
like algorithm with 4 walls representing your rooms
except you add some variables for doors per each wall
and use/design the lookup functions to find which room
has the needed doors you need to place ...

good luck buddy hope i helped you a bit


Compulsive compiler
Re: attach one entity to another randomly at specific locations [Re: Wjbender] #417319
02/11/13 15:28
02/11/13 15:28
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline OP
Senior Member
xbox  Offline OP
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
@Wjbender I downloaded your generator and am really happy that you've done all the hard work grin lol

I replaced the models with rooms, for ex:

plus intersection = room with 4 doors
t intersection = room with 3 doors
straight = room with 2 doors
corner = room with 2 doors

First issue is, sometimes the "maze" isn't "solvable" so the rooms don't always connect. Second issue is, at the end of a hallway, I need to be able to place a room with no doors, where as now, it places a "straight (room with two doors)" at the end.

Also, I'd like to be able to create only one room at a time, instead of just creating the entire maze all at once.

Re: attach one entity to another randomly at specific locations [Re: 3run] #417332
02/11/13 16:35
02/11/13 16:35
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
Originally Posted By: 3run
about the movie, it's called CUBE.


You might also want to take a look at the sequels "HyperCube" and "Cube Zero". They could be great insiparion for what you are making.
I always had the feeling that the creators of the game "Portal" were somewhat inspired by this movie.

Cube has a very steampunk/industrial inspired theme
Hypercube is the sequel, with a futuristic look.
And Cube Zero is a pre-quel explaining everything.

EDIT:
Some information that might make it easier to help you:
-Are your rooms all the same size/shape (cubes) like in the video? (not counting doors of course)
-If not, can they all be made using the iterations of the same shape, or integer scale/size of the same cube?

Last edited by Carlos3DGS; 02/11/13 17:06.

"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1