We need a "make default instance" button and label!

Discussion and feedback on Construct 2

Post » Sun Mar 29, 2015 4:00 am

+1
Good suggestion.

I suppose you could use sprite.AsJson and the "load from json" action to copy all the properties of one object to another. Just pick the object you want to use as the default and save the .asJson to a global.
B
89
S
30
G
95
Posts: 5,157
Reputation: 63,450

Post » Sun Mar 29, 2015 2:25 pm

+1 as it is bothering that Inside the editor, when you drag an instance, it can be a waste of time to resize it as it should (first exemple:tiled backgrounds, you need a big one first, congratz, all of the next ones will be that big, even if you needed a smaller one...) or change the instances variable one by one just because the first one you created inside C2 was not the "default type" one you wanted to use afterwards to gain some time.

Goes for other objects of course.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
48
S
21
G
18
Posts: 2,113
Reputation: 16,875

Post » Sun Mar 29, 2015 7:57 pm

Tokinsom is talking the object 0. When you use SpawnObject or Create object. C2 creates the object based off of a template version of the object. However as I understand(this could be off) the creation process. Is that the first object defined in the first Layout of that object becomes the template object.

The first solution is that anything you use create on. Should only be on some form of Assets Layout. However there is a problem.

Let's give an example.
1. I have a Assets layout where I create the first ever version of the object. We call this Object[0].
2. However I end up using Object[1] in the main menu, but I end up doing some customizations
3. I create Object[.....] during game play

from a development point of view. Object[0] is my template Object that set's the standard for the create and forget. However there is a problem. Because Object[1] is custom and is the first create one through used alyouts. My game layouts will use Object[1] even though I want Object[0] as my default.

Tokinsom is suggesting that there be a toggle field as part of the info where they can be just set as a Default. So that the confusion of Create precedence is not an issue.

My suggestion is to copy Unit's Prefab system. Where Objects are popped into a Prefab dedicated folder. This way Prefabs are always default. Another suggestion would be to create instead a Prefab Layout. So that Any objects on this Layout take precedence of creation settings.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Sun Mar 29, 2015 9:27 pm

@Jayderyu Yep that's about it. The 'template objects' or 'default instances' (pretty sure that's what Ashley referred to them as) are very oddly handled, and behind-the-scenes no less. I fully support a prefab system similar to Unity's, but I don't expect to see that until C3. However, we can work around these faults right now in C2 by introducing the features I brought up here.
Image
B
238
S
28
G
13
Posts: 1,787
Reputation: 18,485

Post » Sun Mar 29, 2015 10:28 pm

Hate to say it but:
Image
Image ImageImage
B
166
S
49
G
154
Posts: 8,105
Reputation: 100,231

Post » Sun Mar 29, 2015 11:25 pm

I like this idea. I'd definitely like to see it. That way I don't have to resize previously resized objects just because of whatever the previous instance/copy was prior to making a new instance in the layout.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
132
S
22
G
8
Posts: 770
Reputation: 14,584

Post » Tue Mar 31, 2015 3:15 am

ROFL

I'm with newt. I feel C2 would benefit with everything being a Behaviour. With each Behaviour being individually attached to any WorldObject :D.

Then use some kind of CreateCopy( UID ) as the method for creating new ones.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Fri May 08, 2015 5:36 pm

Bump.
Image
B
238
S
28
G
13
Posts: 1,787
Reputation: 18,485

Post » Sun May 10, 2015 12:13 am

I know exactly what @Tokinsom is talking about. I've brought it up in the past.

Here's an article I wrote a while back about default (or "prototype" objects) in the Construct 2 wiki.
http://construct2.wikispaces.com/Default+Instances

I've pasted the relevant parts of it here:
Construct requires a minimum of one instance of every object type in a project to exist in a layout, with noted exceptions such as Input plugins, Function, Arrays, Dictionary, etc. Each first instance of an object type in Construct determines the default properties for new instances subsequently created either *through the editor* or *through the "Create Object / Spawn Object" action* at runtime.

Since there are many situations where an object might not exist until later in the game (created "on demand" through event code), most developers create a blank "Asset Layout" where each prototype object can be placed. When a project is first opened by Construct, it stores a "prototype instance" of each Object Type in memory. Unless a developer is familiar with the internal operation of how these prototype instances are stored, confusion can result.

From extensive testing, the prototype instance of some object (A) is simply the first XML element of the instance on the first layer (bottom-most layer in the Layout editor) of the first layout (ordered from top to bottom in the Project Window Layout List -- this matches the layout order in the CAPROJ xml file) encountered that contains an instance of the object parsed by Construct.

Until a project is reloaded, the prototype instance assignment will not change. Even if you delete the prototype instance, Construct will continue to base new *EDITOR* instances on its properties/values. However, Construct on preview will always reparse layouts for the first prototype instances of all object types, which affects creation/spawn at run-time.
B
31
S
7
G
8
Posts: 232
Reputation: 6,244

Post » Sun May 10, 2015 12:36 am

Yes...so now that we (finally) have that established, is there any way this can be added, @Ashley?
Image
B
238
S
28
G
13
Posts: 1,787
Reputation: 18,485

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: zenox98 and 9 guests