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
Invisible floors with NOFLAG1 in split-screen #389622
12/16/11 13:14
12/16/11 13:14
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
I am kinda stuck on a concept for multiple floors I have and could use some ideas to push me in the right direction. I already got something similar working for one camera, but I can't figure out how to get it working for 2 views.

The basic concept:
I use a third person camera above the player (kind of like old school diablo angle). The problem was when entering buildings, you could not see the player through the roof/walls. And I did not want the camera to zoom in closer to fix this. What I wanted to achieve was to make the roof go invisible to see through it whenever the player enters the building.
(this is already working, the explanation is just so you guys get a general idea of what I am doing).

Adding support for multiple floors:
Then I decided to complicate things a little more and added multiple floors to my buildings. What I did was use the skill1 and a trace upwards from the player. Everything on the first floor (walls & objects) had skill1=1, everything on the second floor had skill1=2, etc...
What I did was trace upwards from the player and if an ent was hit it looked at its skill1 value and set the invisible flag for every ent that had skill1>=hitentity.skill1
(also pretty straightforward, just so you guys get the idea)

Adding support for multiple views (split-screen):
Here is where I am stuck, and would like some ideas so I can re-work my system.
EXAMPLE-1: Player1 (using view1 camera) walks into the building, he is at the ground level so the trace upwards hits an entity on floor1 (with skill1=1), and sets everything with skill1>=1 INVISIBLE. Player2 (using view2 camera) is still outside the building but can now also see into the building! (I would like to fix this but it is not that big of an issue. I could live with this since it is not really a problem)
EXAMPLE-2: Player1 now walks up to the first floor of the building, his trace upwards hits floor2 (skill1=2), he resets INVISIBLE for floor1 (skill1<2), and sets INVISIBLE for the the floors above him (skill1>=2). Player2 now enters the building at ground floor and his trace upwards hits floor1 (skill1=1), and sets invisible for all floors above him (skill1>=1). (Now this is a huge problem and has to be fixed since player1 has the floor he is on as invisible and seems to be floating in mid air above player2!)

Possible solution I cannot get to work:
So it is obvious to me now that I cannot use the invisible flag on entities since it will affect both player's views simultaneously. I have been searching the manuall for something that could help me, thinking the flags should be set for the views individually and not for the entities. I found a wonderfull little view flag that could be the first step to a solution "NOFLAG1". The only problem with this is that it only works for one floor (ground floor + ceilling), since there is not an equvialent NOFLAG2, NOFLAG3, NOFLAG4, etc... that I could use for the other floors.

Any ideas you guys can offer for me to start working on are welcome. I seem to be stuck at this point and cannot come up with a better concept. Mabe I'm just stuck thinking on ideas similar to my first system. So I'm putting this out there for anyone else that has not been working on this to see, hopefully you will not be conditioned to think in that direction like I seem to be.


"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
Re: Invisible floors with NOFLAG1 in split-screen [Re: Carlos3DGS] #389643
12/16/11 14:16
12/16/11 14:16
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
have a look at render_view, material_event and ENABLE_RENDER. They'll allow you to set different materials depending on the view you need to set the transparency or disable certain object rendering altogether.

Re: Invisible floors with NOFLAG1 in split-screen [Re: Carlos3DGS] #389646
12/16/11 14:24
12/16/11 14:24
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
What I would do is probably use regions (fake them if you use A7) to get the player elevation level:

region_find(str_tmp,player1.x);
if(str_cmpni(str_tmp,"level"))
{
str_clip(str_tmp,5);
player1_level = str_to_num(str_tmp);
}
else player1_level = 0;

Same for player 2.
Now, set up a material for those floor/ building entities that makes them invisible depending on the current view, player level and skill1:

// return 1 skips rendering
var mat_level_event()
{
if(render_view == view_player1 && my.skill1 > player1_level) return 1;
if(render_view == view_player2 && my.skill1 > player2_level) return 1;
return 0;
}

MATERIAL* mat_level =
{
event = mat_level_event;
flags = ENABLE_RENDER;
}


EDIT: MrGuest was faster.

Last edited by Superku; 12/16/11 14:24.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Invisible floors with NOFLAG1 in split-screen [Re: Superku] #389722
12/17/11 14:40
12/17/11 14:40
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
Thankyou very much! Thanks to you guys I was able to get this working perfectly!
I only made a couple slight modifications:
instead of using regions I use a trace upwards and set playerX_level to hit.z
and I also modified the material event condition slightly
if(render_view == view_playerX && my.z > playerX_level) return 1;

That way it works with specific heights instead of regions.
Thankyou very much for pointing me in the right direction!!!



"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

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