Comfortable work with large C2 projects

Discussion and feedback on Construct 2

Post » Wed Oct 28, 2015 2:05 pm

At the moment i'm working on a fairly large game with a lot of interfaces and with it's growth i see some quite primitive yet handy features to be implemented:

1. Folders for image points. 30+ imagepoints on one sprite for buiilding an interface element becomes a headache. If we have folders in animations why can't we have them in imagepoints?

2. Search results highlight. Search is a super feature but in it's current logic it shows the whole "branch" of subevents - much more then i want to see. This can be solved with adding a backlight of the searched phrase or at least showing only event\subevent itself.

3. Object names in subfolders. It's impossible to optimize the number of objects and, for example, sometimes i have to use similar sprite objects in different subfolders. This forces me to name them like "%subfldrname%_%objectname%" or "%subfldrname1%_%subfldrname2%_%objectname%" or even deeper. So, is it possible to make object`s unique name check only in it's subfolder and having objects with similar names in different subfolders?

4. Flexible variables. As for a large project (800+ events in prototype) there can be more productive way to work with objects that have a lot of variables. For example, you have an object that has 3 int variables that are "counters" like "enemy1Killed", "enemy2Killed", "enemy3Killed" and only 1 Enemy object (with animations "enemy1", "enemy2", "enemy3"). On Enemy destroyed you have to add 1 to the right variable. Yes, you can make a "branched" event with matching right animation names and right variables, but what if you could do things like Add 1 to variable "Enemy.AnimationName"&"Killed"? It looks a bit similar to "Go to layout" and "Go to layout by name" or the same thing in sounds picking.

Yes, this thread can become a thread for advices, not a suggestion thread. ;)
B
8
S
2
Posts: 56
Reputation: 1,021

Post » Wed Oct 28, 2015 2:19 pm

1. No idea what are you doing, but 30+ image points for interface elements seems kind of a lot
2. True, search could be more specific
3. Just like 1. Don't know what are you doing or trying to achieve but it looks strange from your description :)
4. Wouldn't be better to use array or dictionary for that?
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,599
Reputation: 34,825

Post » Wed Oct 28, 2015 2:42 pm

shinkan wrote:1. No idea what are you doing, but 30+ image points for interface elements seems kind of a lot

There is a sprite that is a background for an interface, imagepoints are used for placing UI elements on it. For example, this one:
Image

Image

shinkan wrote:3. Just like 1. Don't know what are you doing or trying to achieve but it looks strange from your description :)

3 subfolders for "rooms" that are used as to open special interfaces and represent upgrades. However, objects are quite different in behaviors and variables.
Image
Naming them without "hObj_blahblahblah_etc_etc" will be really handy, expecially while working on the notebooks. :)

shinkan wrote:4. Wouldn't be better to use array or dictionary for that?

It's not the universal way as it means i have to add an array/dictionary for every object of that kind.
B
8
S
2
Posts: 56
Reputation: 1,021

Post » Wed Oct 28, 2015 3:30 pm

1. Scenegraph design would be far better than image points. So I agree. If we can't have scene graph then IP sub folders would be helpful.

3. Is this for types of objects? or how objects are structured in a scene?
a) If it's for types of objects then it's already handled.
b) If it's scene structure. If the system was just already a scenegraph design this would also be handled. Since we don't have that. Then yeah I can see this be helpful.
c) from your sample image, your shooting your self in the foot in regards to C2 sprite management. You should pack your images in to related and/or layer elements of sprites. Then cycle through the animation and/or the index. Each individual Sprite Object becomes it's own texture. Each texture needs swapping in and out of the GPU texture memory. This can increase your drawcalls by massive amounts by making every image type it's own Sprite Object.

4. I don't understand your question? Flexible data type?
It's always better to use casted data types rather than mutable data types. numbers should always be numbers. However what I would LOVE would be to embed more complicated data objects onto a object. As an example
Current variables for objects
[Number, Text, Bool]
Wanted variables for objects
[Number, Text, Bool, Dictionary, Hash List, Array, Custom]

This would be far better than making a container of an objects and linking a Dictionary/Array into the Container.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Wed Oct 28, 2015 3:46 pm

jayderyu wrote:You should pack your images in to related and/or layer elements of sprites. Then cycle through the animation and/or the index.


I understand your part about C2 logic of memory usage but i'm not sure i got quoted text right.
On the screenshot there are, for example, lines under some texts. They all are one sprite object but with different animations (one for each situation). Same with small character cards - this is a single sprite object with animations for each character class.
From your suggestion (as i understand it :) ) i see 2 ways for optimization:
1. Spawn the whole UI on startup while loading other game objects and hide that UI on invisible layers - making layer visible is faster than spawning a bunch of sprites.
2. Make a sprite object and store all UI stuff in it so the whole UI will be downloaded as one single image atlas.

Which one is better? Is there any other optimization tricks in this case? :)
Current approx. download size is 320kb only, memory usage - 19.5 mb (with 5 csv tables).

jayderyu wrote:It's always better to use casted data types rather than mutable data types. numbers should always be numbers.


Yep. I'm talking about an ability to use variables in more flexible way than just picking needed one from a list.
B
8
S
2
Posts: 56
Reputation: 1,021

Post » Wed Oct 28, 2015 7:10 pm

For 1. Why not place your UI on a global layer? Unless you need to generate it in a complex/variable way according to other conditions. Then there's no need for painful spawning code - you can use the editor's strengths and just place the sprites directly....
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,211
Reputation: 43,844

Post » Thu Oct 29, 2015 1:05 am

Been working on a project that fits this description for the last couple months. Don't expect any of this in C2 at this point, but...

1. Translucent Inactive Layers is a godsend for working on a game with complex scenery, and also enables selective filtering when selecting objects/select all. However, there is no way I know of to select all of X type of objects on X layer. Selecting an object selects all of those objects in the layout, even when in TIL mode, instead of just those on the selected layer.

2. Wrapping objects (grouping an arbitrary selection to transform as a unit) is super useful. But...sometimes the rotation handle gets very wonky, ending up far away from the wrapped object, or even so far off the screen as to be unreachable.

3. In events, we can replace X object with Y object as long as both objects are the same object type, and share all the relevant vars/behaviors/effects for said events. There should be a similar option in the layout editor to replace objects with other objects, preserving size/position/frame/etc.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Thu Oct 29, 2015 9:02 am

Colludium wrote:For 1. Why not place your UI on a global layer? Unless you need to generate it in a complex/variable way according to other conditions. Then there's no need for painful spawning code - you can use the editor's strengths and just place the sprites directly....


Nope, unfortunately a single layer won't help. There are only 2 scenes in my game, currently i'm working on the first scene which is a player's house. Every room is a "link" to a logically matching interface, but you can switch between those interfaces while being in one of them (see the tabs on the left). I have a single background sprite with the set of image points on which i'm building all the interfaces:
Image

TiAm wrote:1. Translucent Inactive Layers is a godsend for working on a game with complex scenery, and also enables selective filtering when selecting objects/select all.


Interesting idea but i'm afraid having a few interfaces (see the screen above) will eat more memory than loading\destroying needed one.

TiAm wrote:There should be a similar option in the layout editor to replace objects with other objects, preserving size/position/frame/etc.


This improvement can be really handy! However this still means "destroy X, spawn Y" and the only difference is that you can set a single action instead of 2, eh?
B
8
S
2
Posts: 56
Reputation: 1,021

Post » Thu Oct 29, 2015 7:16 pm

I still don't see why a layer couldn't be used instead of the imagepoints. Creating/destroying the objects as you switch tabs won't really save you any memory, although I do see the value of destroying it instead of hiding it since you wouldn't have to check if the objects are on a visible layer before interacting with them.

They way I see it imagepoints could be useful perhaps if those widows are moved around. Still I'd probably opt for using the pin behavior or storing the xy offsets in a variable. Also it's much quicker to just position stuff in the editor than to tweak imagepoints. If I wanted to create/destroy the windows i'd use a array to store the object types,sizes,frame,text,and position at the start of the layout, then just loop through that when I wanted to recreate it.

For organizing object types I'd actually opt to use less object types and instead use variables and animation frames to distinguish them. Of course this largely depends on what I'm doing.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Tue Nov 03, 2015 10:56 am

Aaand one more thing about imagepoints. When i change any variable's name it chenges everywhere it is used, but when i change any point's name i have to find every place it's used and replace the old name manually.

Imagepoints need more love. :)
B
8
S
2
Posts: 56
Reputation: 1,021

Next

Return to Construct 2 General

Who is online

Users browsing this forum: BackendFreak, rayolaser, rbailey83, zenox98 and 27 guests