Isometric multiple floors

Get help using Construct 2

Post » Mon Jan 05, 2015 11:08 pm

Use instance variables for filtering. With it you can disable collisions of other layers and such. The stairs by far will be the trickiest to do. Well, other than implementing path finding and line of sight, you'll have to get creative for those.

Here's an attempt at stairs you can go up and down. There's likely an easier and cleaner way but it escapes me at the moment.
You do not have the required permissions to view the files attached to this post.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Mon Jan 12, 2015 7:05 pm

@R0J0hound

Use instance variables for filtering. With it you can disable collisions of other layers and such.


Filtering - got that - works
Disable collisions of specific objects - works

But i can't find a way to filter "Enable/Disable collisions" or "Solid Enabled/Disabled" for other specific objects (players in multiplayer and enemies)

I've tested it multiple hours today with all different kind of events but never managed to find something that could help me in this case.

What am i doing wrong?
Is it even possible or are those missing event checks not possible to be self-coded?
My guess is that i'm simply missing something very specific that would explain everything by itself.
Or it is really complicated
Or it's simply impossible due MP feature being that young

Update: just saw that i've added the "Wait" under calling function" but still, it also doesn't work if i move the function call to the bottom...

collisioncheck.png



By the way, thanks a lot for your support!
You do not have the required permissions to view the files attached to this post.
B
40
S
8
G
3
Posts: 159
Reputation: 3,019

Post » Mon Jan 12, 2015 8:26 pm

You can't disable a solid behavior partially, at a given time, it's either on and off, so all object collide or go through. You probably should not rely on the solid behavior if you plan to do "floor filtering" for collisions.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Mon Jan 12, 2015 9:56 pm

I was fearing that already.

But i'm wondering how else it would be able to properly code a collision check so that you can't walk through which i would be able to seperate by instance variables.

And so that Enemy AI using Pathfinding does not brake....
I'm getting lost in this.

I'm not a coder, so there's no way for me to write such a complicated plugin.
B
40
S
8
G
3
Posts: 159
Reputation: 3,019

Post » Tue Jan 13, 2015 11:20 am

Everade, what you want is exactly what Ultima Online used to do.

You need to create a variable for all objects that are physically in the game to represent the Z (Height) Axis like @newt said.

You would always need to adjust the object's Y thru custom movement according to the Z axis that you created. Construct does'nt have this built in. Z-Ordering would still be in effect, considering that an object with a higher Y is always drawing on top of the things below it, avoiding the issue you would have with disabling everything below.

Stairs are more tricky, not sure how you could accomplish that in construct, you would need to gradually increase the player's Z coordinate as he moves up in it, unless you "teleport him" to the top room when he uses a stair object, then your Z could be based on what floor he is,

Z = 1 -> Y = Y + Z * (offset).

I might be talking out of my ass, but I think that might do it... Someone correct me if i'm wrong..

EDIT: I had'nt seen the second page of the post.

You could add an additional condition checking for the Z coordinate when doing collision checks avoiding issues of colliding with things under or above the player...
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 27
Reputation: 479

Post » Tue Jan 13, 2015 12:41 pm

@smassa

I'm sorry but i still don't understand the need for setting a Z offset. (maybe i don't understand offset at all...)
However i appreciate your help!

I have already a stairs event, so i simply set a player and zombie variable to check the floor.
With that i'm able to determine wheter the zombie can see me or not, and if i can shoot them or not.
That works all just great.

The issue is that construct 2 is missing that i can IGNORE COLLISION OF SPECIFIC OBJECTS WITH SPECIFIC SOLIDS.
So no matter which way i choose, it's simply impossible unless i code my very own collision system.

Currently i've go everything to work.
- I can walk upsairs, the second floor will be displayed
- I do not collide with objects on the ground anymore ( and opposite )
- I do collide with objects placed on first floor ( and opposite )
- Zombie and Player floor check works for line of sight and shooting like a charm

So yes, i got it all working

But not for multiplayer and not for AI
Solids are simply lacking features. It's either solid or not, GLOBAL
That's it, and i can't find a way around that.
B
40
S
8
G
3
Posts: 159
Reputation: 3,019

Post » Thu Jan 22, 2015 3:05 pm

some "thoughts"

player variable:

z
iex player.y - 100 offset indicating first level
either use the 100, or a dedicated variable to determine level

z=0 set active level 0
z =100, set activelevel 1
z=200, set activelevel 2
etc

cupboards, doors, walls, spiders enemies, players etc etc, all belong the family allobjects, and have instance var, activelevel, and set them during development.

events:
allobjects on collision with player
player.activelevel = allobjects.activelevel
action:
do some bumpage


Level appearance and interaction mechanic, perform on peer and host

event
player.peerid = multiplayermyid
for each allobjects
sub
player.activelevel = allobjects.activelevel
action
allobjects opactiy 100%
allobjects collisions enabled
else
allobjects opacity 50%
allobjects collisions disabled


just sync peer's activelevel instance variable determined by the peer going up/down stairs :)

The peer will appear on other peers and host set by activelevel.
It can deduce the Z from the given active level, requiring less synching overhead :)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Fri Jan 23, 2015 5:24 pm

@lennaert

Thanks for your "thoughts", that was actually quite interesting!
I've mainly done what you've listed down already.
Peer, Objects and Enemies do have a .floor variable to determine on which floor they're currently at.

But i've not determined the allobjects family.
I may give it a try.

And about your:
Code: Select all
allobjects opactiy 100%
allobjects collisions enabled
else
allobjects opacity 50%
allobjects collisions disabled


If i'm not mistaken then "collisions enabled/disabled" is still GLOBAL, so according to your code that would mean that all objects would activate and deactivate collision each time something walks into an object.
But you forgot one thing.
Your idea says "allobjects on collision with player"
well... collision does not happen anymore if it has been deactivated. Which means it would never trigger.
The only way i could actually do this is to check sprite overlap. But activating collision on overlap does NOT work. You will be able to walk through the first object you're overlapping.

I'm also still not using any Z as offset at all.
I've simply set a variable "peer.floor" to 1,2,3,4 etc... so that's already the minimum of data to be synced.
(I still don't understand why everyone gets this offset stuff started. Is there anything special about it? I just don't get it)
B
40
S
8
G
3
Posts: 159
Reputation: 3,019

Post » Fri Jan 23, 2015 6:18 pm

>@Everade
can't compare x and y positions.
Because x and y can be exactly the same on both floors.
The 1st floor isn't that much higher that i could compare these values.


Just put them on separate Layers for each floor, and add the condition "if xy position and on Layer (Floor) X". You can have many layers without performance issues, as long, as you don't have effects on them, obviously...

You can then also just check, if Layer/Floor is identical, or which is above/below, so on... does this solve the problem?

You can also just disable Solids and even collisions for every other Layer/Floor, saving a tons of problems and performance issues... Only, if the enemy has to check collisions on his own floor, can be a problem, but that can be solved different, e.g. path-finding behavior. Once set, no need for solids. Also you can register not solid objects to be obstacles.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Fri Jan 23, 2015 7:53 pm

Everade wrote:lennaert

Thanks for your "thoughts", that was actually quite interesting!
I've mainly done what you've listed down already.
Peer, Objects and Enemies do have a .floor variable to determine on which floor they're currently at.

But i've not determined the allobjects family.
I may give it a try.

And about your:
Code: Select all
allobjects opactiy 100%
allobjects collisions enabled
else
allobjects opacity 50%
allobjects collisions disabled


If i'm not mistaken then "collisions enabled/disabled" is still GLOBAL, so according to your code that would mean that all objects would activate and deactivate collision each time something walks into an object.
But you forgot one thing.
Your idea says "allobjects on collision with player"
well... collision does not happen anymore if it has been deactivated. Which means it would never trigger.
The only way i could actually do this is to check sprite overlap. But activating collision on overlap does NOT work. You will be able to walk through the first object you're overlapping.

I'm also still not using any Z as offset at all.
I've simply set a variable "peer.floor" to 1,2,3,4 etc... so that's already the minimum of data to be synced.
(I still don't understand why everyone gets this offset stuff started. Is there anything special about it? I just don't get it)



The collisions would be activated per activelevel. IE it would activate all collisions on where the player would reside.
Looping the objects while filtering player.activelevel = allobjects.activelevel, sets each collision individually continuously.


Ofc the above code is just some basics, more would be required to keep things in check en pretty.

The not triggering collision would assist in players wanting to walk underneath something above them, for the view of the other party (other peer or host)


I never use the offset too really :lol:
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 52 guests