Feature Addition: "Room Object"

Discussion and feedback on Construct 2

Post » Thu Nov 20, 2014 9:38 am

Ashley wrote:
TiAm wrote:Could the existing collision cells opt be commandeered to set objects more than X cells away from the edges of the window invisible?

Maybe - I wanted to when it was first implemented, but it's difficult enough that I couldn't figure out a good way to do it. The main complication is Z order. Collision cells don't care about ordering instances - they are simply either in it or not. Objects can belong to multiple collision cells at once, and multiple collision cells can be on-screen. So then how do obtain just the on-screen objects and then render them in their correct Z order? It's difficult to see how this wouldn't involve something like "gather everything on-screen then sort by Z order", but running a sort on all on-screen instances every tick could cause very poor performance for games with a small layout and a very large number of on-screen objects (e.g. bullet hell). There are possible solutions which don't require continual sorting, but they are pretty complicated. I'll think about it some more, it would be nice if it could be solved...


I'm afraid I don't understand. For draw calls, you are already looping thru all the objects on visible layers every tick, right? How would that be handled any differently? Why does Z order affect this? I'm probably missing something here...

BTW, if I understand what I'm seeing in the c2runtime.js, the collision cells are set to the original width/height of the game window, is that correct? Just curious.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Thu Nov 20, 2014 1:48 pm

@R0J0hound

I downloaded your chunk_load_unload2.capx but when I put the events into my own game, only one of the two sprites would spawn, the rest just get deleted. Any fix for this? I set it up exactly like in the original chunk_load_unload2.capx but it doesn't seem to work?
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Nov 20, 2014 2:21 pm

To draw the screen correctly, you have to draw every object on-screen in order of their Z order (since it's a back-to-front renderer). Collision cells just store an unsorted list of objects. That doesn't matter for collisions: the order you check for collisions is totally unimportant, whereas ordering is crucial for correct rendering.

Even if collision cells stored objects in their Z order, you could have 4 or more collision cells in the viewport at once. Since objects can cross multiple collision cells, you need to take all of these cells and merge them in to a single Z order list for correct rendering. It's hard to see how that doesn't come down to "collect all instances from on-screen cells, and then sort them". If lots of things are on-screen, the sort is a new extra step that wasn't needed before, and will have a performance impact. So it could just make it slower.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Thu Nov 20, 2014 2:32 pm

@Nesteris I'm assuming you have multiple objects in single family, but your 'create object' event uses the family, not the individual objects. If that's the case then, well, this is the tediousness R0j0hound was talking about lol. You have to create them individually. If that's not the case then you'll have to post a .capx or something...or just wait until the next beta when the 'reload layout zone' or w/e it's called is added, which will more or less make that this existing method obsolete.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Thu Nov 20, 2014 2:41 pm

or just wait until the next beta when the 'reload layout zone' or w/e it's called is added, which will more or less make that this existing method obsolete.


Wait, it's coming out? Are you sure? Oh wow. That's super!

As for my .capx, could this be a suffice as a replacement?
Chunks.png


On start of the layout, the "spire"s in the chunk the player is in are present, but the ones out side the chunk are not. Are expected.
However when I kill off the spires in the chunk I'm in and move to another chunk, the ones supposed to be there aren't.
Then when I go back to the first chunk, the spires I killed don't respawn. But the Missile Ammo pick up does, regardless of how many times I pick it up and go out of and then return to the chunk. The best I got it working was having all the spires spawn regardless of which chunk they're in, but that's completely unhelpful.

Also @Tokinsom can you occasionally help me learn how to better use Construct 2 events? Not everything, just the really complicated things. You have my email right?
You do not have the required permissions to view the files attached to this post.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Nov 20, 2014 4:17 pm

@Nesteris Sounds like it. We narrowed it down to one action (Reload layout zone (x1,y1,x2,y2)) so yeah, we'll see. As for your problem with that .capx...Nothing is really standing out at the moment. Will have to look at it more.

@Ashley So it looks like, with this new action, it'll work like this:

-Load entire layout as usual
-Destroy objects outside of first zone with events
-Reload layout zones and destroy outside objects as needed

My only concern is that the whole layout is still created at the very start. Would this cause the game to hang for a bit? Even if you dedicate each layout to a single area, they could still be fairly large.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Thu Nov 20, 2014 4:40 pm

@Tokinsom
That's what I thought as well, lately all the events I've been pulling from other .capxs I have and putting them into others don't work. No idea why, I've been quadruple checking that I did everything right and it doesn't work. Really strange...
Can I send you my .capx via email or something so you can take a look at it?
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Nov 20, 2014 5:35 pm

@Nesteris
The events look the same and it appears you have the family set up the same. The only other difference is that the "room" sprite and the "roomObjs" array are in a container with each other, which could have been overlooked.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Thu Feb 19, 2015 1:46 am

I'm supposing that this idea was pretty much discontinued? It sounds like a great idea, especially when adding Multiplayer into the mix. I added a reply in this thread (viewtopic.php?f=147&t=123846&p=888606) and after looking around a bit more, found this one!
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,826

Post » Thu Feb 19, 2015 2:02 pm

@DatapawWolf

It actually got solved, Ashley added in two new features to the engine.

"System action: 'recreate initial objects'. Recreate the initially placed objects in the layout for a specific object type or family within a rectangular area. (Note this does not destroy anything, it only creates new instances.)"

"System action: 'Reset persisted objects'. Revert all objects with the Persist behavior in their project to their initial state."

Added in r191 and r192 beta releases. They're located in system actions.

Edit: We also made Ashley test the engine further and he made performance improvements to the engine to make destroying objects significantly less taxing on the system.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests