Recreate location as player moves

Get help using Construct 2

Post » Tue Jun 02, 2015 4:53 pm

@Magistross It's working even better than i hoped!

Now i can go forward in my project, thanks to you :D
I'm a Magician, not a Developer.
B
21
S
8
G
25
Posts: 105
Reputation: 14,252

Post » Thu Jul 02, 2015 10:11 pm

Magistross wrote:The "Recreate initial objects" has no way of determining if the recreated object already exists, so you won't be able to use it unless you systematically destroy objects that are about to be recreated.

If the blocks were perfectly aligned on a grid, I'd say using a tilemap would be best, or an array solution could work too.

@Magistross Awesome work! However, I wonder now why would tilemap be best? Isn't this partially similar to how render cells work? So wouldn't destroying parts of tilemap and recreating them ultimately hinder performance, since it could make C2's "render cells" optimization inefficient as your solution would duplicate it partially? Or am I missing something here?
B
14
S
3
G
1
Posts: 77
Reputation: 1,035

Post » Sat Jul 04, 2015 12:02 am

@striimix

The screenshot i showed - not from the game. Just for example .

His method is more universal. Can be used in many ways as long as objects lies on the grid.

He used spawn, but i change it back to recreatiation which did work perfectly for me.
I'm a Magician, not a Developer.
B
21
S
8
G
25
Posts: 105
Reputation: 14,252

Post » Mon Jul 06, 2015 3:27 pm

@striimix I believe that the tilemap would still be best especially if all tiles are the same, fewer draw calls would be issued. We should probably do a comparative test just to see if any difference would be noticeable.

edit: Just did it, I can't profile on my current computer since I'm at work and don't have a license there... :oops: but it does seem to run with a steadier and higher FPS. If anything, it's far less convoluted event-wise and much more easier to edit the level design with a tilemap !

https://dl.dropboxusercontent.com/u/700 ... lemap.capx
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Wed Sep 21, 2016 9:21 am

@Magistross
or anyone else who can help.

Tilemap and even array doesn't seems to work in my project as I need it.
I have to address my issue once again, but I will explain it again so everyone could better understand it.

*Please read first post in the topic

What I need is many different objects. Different by the size, variables and everything else.
Is there any way of storing this data into some document and then load it? I mean you can see in other games files for different locations.
They often use those to load location by parts. If you would play GTA V for example on old computer you could see how your old computer hangs
when you move fast on the location that's because it loads it and the faster you move - more it hangs as it can't catch up with you.
I need exactly the same system they've developed for their game. I know it's possible only don't khow how this should be done in Construct 2.

I'm thinking of creating the level-design engine inside Construct 2 so I could create locations for my game, store them into some file and then load it as player moves close to it.
As my world is pretty much titanesque (There's no better word for it). I'm talking about millions of pixels and so of course I cannot design it all inside Construct 2. It's unpossible.
I can create a location in my level-design engine, save it and load it inside the game when needed.

This feature is what on my whole game lies upon. I've resolved most of the root features, but this one is pretty hard for me.
I have to do it and pretty important to do it without damage to perfomance.

Please do not hesitate to ask questions.

Thanks everyone for attention!
I'm a Magician, not a Developer.
B
21
S
8
G
25
Posts: 105
Reputation: 14,252

Post » Wed Sep 21, 2016 11:14 pm

If you're still interested in my level streaming system, I will make the tutorial tonight.

Basically, I made a family for Loadable Sprites and a Loadable tilemap, a MapSection object which was a tiled background with the same size as the screen, and used local storage to load and save information.

The MapSection object is given a PID instance variable which stands for Positional based Identifier.

I assigned LoadableSprites and LoadableTilemaps the same variable, but the value is given from the MapSection that these objects are created on top of.

I then made a global variable called MapName, for the name of the map the player is playing or editing on.

You must know how to use the TokenAt function within Construct 2. I use this to save within the local storage MapName_Sprites_MapsectionX_MapSectionY and MapName_Tilemaps_MapsectionX_MapSectionY

I then would say, every tick, if player is not Overlapping a MapSection with the PID of round(PlayerOrCameraPosition/screensize)*screensize [this will check the current screensize grid section the players viewport is within]
Load from the LocalStorage the keys of the corresponding position and the positions up, down, left, right and diagonally from the player.

The keys themselves will hold the information for what Sprites and tiles to load when a MapSection is created. This is done by the player adding them.
The values themselves will simply be the JSON value of the families at that point in time.

After all that is done, just delete objects when the player is far enough away from them. Remember that they need to be saved with localstorage first though, or they will be completely gone.
ImageImage
B
44
S
13
G
2
Posts: 252
Reputation: 6,246

Post » Thu Sep 22, 2016 12:12 am

By the way, you can export the save info as an Array in JSON format. I'll make a tutorial for it all if you need.
ImageImage
B
44
S
13
G
2
Posts: 252
Reputation: 6,246

Post » Thu Sep 22, 2016 7:35 am

@KTML5 So I'd be able to save objects only once and then use them as I want? Seems good enough for me.

I intend to work by creating in my level-editor and deleting them once saved.

I will look forward for your tutorial.
I'm a Magician, not a Developer.
B
21
S
8
G
25
Posts: 105
Reputation: 14,252

Post » Thu Sep 22, 2016 3:11 pm

XpMonster wrote:@KTML5 So I'd be able to save objects only once and then use them as I want? Seems good enough for me.

I intend to work by creating in my level-editor and deleting them once saved.


Yup! Sorry that I didn't upload last night, my girlfriend and I have to share a computer right now and she's in school. I'll let you know when I get the tutorial finished. :)
ImageImage
B
44
S
13
G
2
Posts: 252
Reputation: 6,246

Post » Thu Sep 22, 2016 4:47 pm

@KTML5 Not a problem. I have a lot of work to do aside from it anyway :)
I'm a Magician, not a Developer.
B
21
S
8
G
25
Posts: 105
Reputation: 14,252

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests