Cross project felexability !

Discussion and feedback on Construct 2

Post » Fri Aug 15, 2014 2:17 am

TwinTails wrote:"Instead of the event editor telling you, you have made a bad call, you spend precious time trying to figure out a logic error that doesn't even exist."

Amen. I wish to rid myself of hours of debugging due to my own fail typos >.<


Have a global constant text for each function name. Rid yourself of hours of debugging from typos. The names will appear in the completion list. Yea it's a workaround.

Also check the browser debug window as it tells you of these errors. Sorry if you already knew.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Aug 15, 2014 6:13 am

codah wrote:
TwinTails wrote:"Instead of the event editor telling you, you have made a bad call, you spend precious time trying to figure out a logic error that doesn't even exist."

Amen. I wish to rid myself of hours of debugging due to my own fail typos >.<


Have a global constant text for each function name. Rid yourself of hours of debugging from typos. The names will appear in the completion list. Yea it's a workaround.

Also check the browser debug window as it tells you of these errors. Sorry if you already knew.


Exactly right. Global constant (constant being the word) is the way to go. I make global constants for everything from character names to dimensions. It is easier to change 1 variable than change 1000's of actions.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Fri Aug 15, 2014 11:10 am

@codah @DUTOIT

That's a great idea, thanks! I have been using constants but the "On function" event doesn't accept any variables so I was a little confused.
B
25
S
6
G
3
Posts: 197
Reputation: 3,355

Post » Fri Aug 15, 2014 11:20 am

"On Function" doesn't support variables. But I still use constants
var FunctionNameF

Create function and start typing out Funct... and it will list the variable, just delete the F and put in ""
Its a work-around, but at least no typo's.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Fri Aug 15, 2014 1:05 pm

@TwinTails
DUTOIT wrote:"On Function" doesn't support variables. But I still use constants
var FunctionNameF

Create function and start typing out Funct... and it will list the variable, just delete the F and put in ""
Its a work-around, but at least no typo's.


That's true but at least you can do it at the point of calling.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Aug 15, 2014 8:23 pm

@SilverForce - Layers do affect performance. They affect it a lot.

Create a new project and run in debug mode. Don't add anything to the scene: no events, sprites, or anything. Note FPS and general CPU usage.

Now add 15 layers with no effects or anything: 15 simple default layers. Now run the debugger. For a real performance "Kick in the groin" try adding an event to rotate the layout every tick.

TLDR - Blank layers, without any FX, special blend modes, or objects, decrease performance markedly. Start doing things with those layers and the performance decline is sharp. The tests are easily created and I have made many of them.

Regardless of what you do with a layer, there is a performance overhead. I don't know why the engine works like this, but something is being done to those layers or calculated every tick that slows things down.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Fri Aug 15, 2014 8:37 pm

@codah - that is a good workaround! ... I general I have tried to stray away from global constants as they can quickly bloat the editor with a lot of stuff. To keeps things organized I create holder objects for variables. I would probably create an object called Function strorage or something. I have alot of objects whose sole purpose is to aid in organization.

example:

Player_Physics (is the actual collision object with the physics behavior)
Player_State (tracks the players states such as in air, on ground, etc)
Player_Abilities (tracks the players upgrades and potential upgrades, like fireflower or star power in mario)
Player_Constants (a storage for unchanging variables such as walk speed, run speed, etc
Player_CurrentStats (a storage container for tracking variables such as current max speed, jump pwer etc)
Player_IsSwimming_collider
Player_inventory
Player_expandedMath (such as old position, vector maths, and so on - provides a way of knowing projection vectors and velocities in a direction other than x,y)

Global_PhysicsConstants
Global_currentPhysics
Global_GameManager
Level_State

...and on and on the list goes. Storing all those things as an event variable would be cumbersome to deal with. Keeping them all in one object, like all the player stuff in player would be a hassle too. Plus the player as well as many other in game objects are much more than one collision box.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Fri Aug 15, 2014 8:49 pm

ruskul wrote:@SilverForce - Layers do affect performance. They affect it a lot.
Create a new project and run in debug mode. Don't add anything to the scene: no events, sprites, or anything. Note FPS and general CPU usage.
Now add 15 layers with no effects or anything: 15 simple default layers. Now run the debugger. For a real performance "Kick in the groin" try adding an event to rotate the layout every tick.


I made 30 layer and a For loop to add +1 degree constantly, and I see no difference in fps or cpu

Bare in mind that debugger itself is taking a lot of your power because it need to display all available informations of your entire project in real time.
Instead of debugging in "Inspect" tab try using "Watch" or "Profile" tab.
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,599
Reputation: 34,835

Post » Fri Aug 15, 2014 9:26 pm

@shinkan - HOLY FLIPPING Barbequed PANCAKES!!! YOU ARE right! I have been lamenting over that and struggling in the debugger for a while. Thanks for pointing that out.

do you know if you can control max fps? Most of the time my laptop caps at 40fps but for a while it was 60 off and on?
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Fri Aug 15, 2014 9:32 pm

ruskul wrote:@codah - that is a good workaround! ... I general I have tried to stray away from global constants as they can quickly bloat the editor with a lot of stuff. To keeps things organized I create holder objects for variables. I would probably create an object called Function strorage or something. I have alot of objects whose sole purpose is to aid in organization.

example:

Player_Physics (is the actual collision object with the physics behavior)
Player_State (tracks the players states such as in air, on ground, etc)
Player_Abilities (tracks the players upgrades and potential upgrades, like fireflower or star power in mario)
Player_Constants (a storage for unchanging variables such as walk speed, run speed, etc
Player_CurrentStats (a storage container for tracking variables such as current max speed, jump pwer etc)
Player_IsSwimming_collider
Player_inventory
Player_expandedMath (such as old position, vector maths, and so on - provides a way of knowing projection vectors and velocities in a direction other than x,y)

Global_PhysicsConstants
Global_currentPhysics
Global_GameManager
Level_State

...and on and on the list goes. Storing all those things as an event variable would be cumbersome to deal with. Keeping them all in one object, like all the player stuff in player would be a hassle too. Plus the player as well as many other in game objects are much more than one collision box.


You can have local constants and variables in groups for some particular use that will not be listed outside of their scope, that can help a lot in bigger projects.

I also prefer to have my global variables inside their own event sheet(s), you do not even have to include the event sheet where your variables are declared for it to work, so you have a list of variable and constant you can simply read and edit.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: delgado and 11 guests