What if you could replace variables like objects in events?

Discussion and feedback on Construct 2

Post » Tue Dec 29, 2015 10:55 pm

@Solomon -

"Regarding the objects and instance variables, do you use empty sprites or just rectangles? Do the additional sprites not weigh more than global varaibles in the event sheets?"

What do you mean by weigh more? Are we talking performance or just in terms of finding them in the expressions list? In many cases I actually waste the time to make nice graphics for my variable objects. The player never sees them, but a meaningful image helps me see whats going on when I look at the event sheet. Like I have a little world icon for my global variables object and a picture of a generic level for my level object, a controler for my input object and so on. The pictures next to the object in the event sheet are one of the biggest reason I love using construct lol.

CMV stands for comma exasperated values. I think it was Colludiom, or R0j0hound that got me using those. They can be quite useful if you have a very data heavy game. You have to use ajax and read in the files but you can use it to change the game parameters in an excel spread sheet and can be handier than working with constructs variables. You still have to have the variables but when you create an enemy "troll" you could just set the common enemy variblels to teh trollLv 1 cmv and presto, less work on your end for the same effect as setting it all up manually in construct. If that makes sense.

---

As for slopes in my game, did I mention that? Or is that from a different post lol. Slopes are a royal pain lol.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,163

Post » Wed Dec 30, 2015 11:00 am

@ruskul

Wow, thank you for your post, it is much appreciated! Very informative.

Regarding behaviours and Javascript Ill have to pass on that one, at least for the time being. Altough from what you write it shows the power behind learning Javascript and using it in combination with C2, I want to stick to visual programming, at least for the moment, until I get a solid grasp on logic, at least in the form that is present in C2.
On a side note Ive looked into various other programs and procrastinated some time in trying to pick the right software, but in the end you got to pick something and C2 seemed just more intuitive. In Unity Ive read for example, that making 2D games is hardcore, a few pages of code are needed just for some basic structure implementation. I would rather focus on the nicer side of gaming so to speak, since I am mainly into graphics and less into programing.

It is good to know the downside of functions, and that will be the first place I look I have a performance bottleneck.

As for 100 baddies, a the moment I have 50-something instances on the screen at once, and NWjs seems to cope quite fine, and that is baddies along with HUD elements. I am constantly using the debugger to check performance and hopefully I wont get nowhere near to a situation where I have to decide on performance vs content, at least not too soon anyway, because it is meant to happen sooner or later (this is regarding a PC/Mac game).

By saying that sprites weigh more, I meant as they are sprites they are additional objects that have to be taken into consideration by the processing power. Do you use this method for mobile games as well, or mainly desktop content?

I have to admit, your workflow is interesting at least to the extent to which my current level of understanding reaches.

As for CMV I will need to look into those, especially if that is to speed up my work.

Regarding slopes, I had a look at your profile and your entry on your web page, where you mentioned solving slopes being easy (as well as the other thread here on C2). 8-)

Oh one more thing. Have you done or do you know someone that has created a game in C2 that weighed more than 600mb? Do you know how C2 handles such big files when exporting to NWjs? I created a thread earlier and recieved no response, just thought I take this opportunity and ask you as you sound quite proficient in what you do, and perphaps your experience might venture into this matter :)

Once again thank you for your time!
Brick by brick, stone by stone.
B
56
S
25
G
18
Posts: 273
Reputation: 13,363

Post » Wed Dec 30, 2015 6:45 pm

@Solomon - I'm sending you a pm, I didn't want to hijack the thread too much!
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,163

Post » Wed Dec 30, 2015 8:10 pm

powerwaffle wrote:I think it would speed up workflow if you could select a group of events and replace all references to a variable to another variable.

I'm not sure I understand why you would want to do this. If you want to change the name, you can rename it and all references update. If you want to change the type, you can't, because it would make events invalid. So then all there is left to do is to replace references to variable with references to another existing variable. Why would you want to do that? Presumably if you made two variables, it's for two different purposes, so I'm having a hard time imagining a useful example of wanting that.

Solomon wrote:That and an option to filter variables by event sheet while picking them, sort of a folder category.
So if you have 3 event sheets with variables, and they are to run together, when picking variables you can toggle tick which to view.

That would help with searching through the gazillon variables.

That is what local variables were specifically designed to do. Make them static and they work like global variables. Put them in a group or subevent and they are scoped to that level only.
Scirra Founder
B
399
S
236
G
89
Posts: 24,540
Reputation: 195,424

Post » Thu Dec 31, 2015 5:22 pm

Solomon wrote:That and an option to filter variables by event sheet while picking them, sort of a folder category.
So if you have 3 event sheets with variables, and they are to run together, when picking variables you can toggle tick which to view.

That would help with searching through the gazillon variables.

That is what local variables were specifically designed to do. Make them static and they work like global variables. Put them in a group or subevent and they are scoped to that level only.

@Ashley
Yes, but that does not help in picking them out from a list of hundreds of variables. If only local variables could be chosen from a list where only local variables are present, that would be so much simpler.
What I mean by this is the comfort of choosing from smaller lists. As of now it is starting to become a chore for me to add more variables and keep searching for the ones I want in a long list.

To sum it up, local variables in a subfolder with only local variables, and global with only global. Additionally as I suggested, each event sheet with its own variables to form visually easier and quicker selection lists.
Brick by brick, stone by stone.
B
56
S
25
G
18
Posts: 273
Reputation: 13,363

Post » Mon Jan 18, 2016 5:12 pm

Well.. I've been working on a weapon "upgrade" system. So I have a ton of variables... Pistol_Capacity, Pistol_Damage, Pistol_Speed, Pistol_RealoadTime... Then I have Shotgun_Capacity, etc... SMG_Capacity, etc, Rifle, Grenade Launcher, blah blah blah. I create an event sheet for upgrading all of the pistol attributes. Six jillion lines of code later Im done. Now I copy it. I have to go through each line - selecting each variable - and scrolling through the hundreds of variables to replace pistol_[...] with shotgun_[...]. Now if I could highlight the events, right click and select something like "replace variable" - Have one input box to select the variables present in the highlighted events - select the one I want to replace (say... pistol_damage) - and a second input box i can put in "shotgun_damage" - and presto. Do it for each variable and BAM saved myself an hour.

It's just like replacing sprite. You make a set of events for "enemy1". You duplicate it, replace enemy1 with enemy2. Change a few things - health, movement, etc. It's a lot quicker then manually replacing each reference to enemy1 through out the events. Same as what I'm getting at with variables. Maybe there is a better method (for me at the moment) - using functions and parameters - and referencing parameters to variables? I don't know. Even then, when a single entity is making use of a bunch of variables (and when those variables are only used by this single entity/sprite) and you duplicate that entity and want it to make use of duplicates of the first entities variables I gotta go through and manually change every single variable for entity 2.
Last edited by zenox98 on Mon Jan 18, 2016 5:23 pm, edited 1 time in total.
Reason: No need for 2 separate consecutive posts - just use edit.
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Thu Jan 21, 2016 9:15 am

powerwaffle wrote:Well.. I've been working on a weapon "upgrade" system. So I have a ton of variables... Pistol_Capacity, Pistol_Damage, Pistol_Speed, Pistol_RealoadTime... Then I have Shotgun_Capacity, etc... SMG_Capacity, etc, Rifle, Grenade Launcher, blah blah blah. I create an event sheet for upgrading all of the pistol attributes. Six jillion lines of code later Im done. Now I copy it. I have to go through each line - selecting each variable - and scrolling through the hundreds of variables to replace pistol_[...] with shotgun_[...]. Now if I could highlight the events, right click and select something like "replace variable" - Have one input box to select the variables present in the highlighted events - select the one I want to replace (say... pistol_damage) - and a second input box i can put in "shotgun_damage" - and presto. Do it for each variable and BAM saved myself an hour.


look, if you have Pistol_damage and Shotgun_damage, you have to edit 2 variables, make just weapon_damage..

When I was making a weapons system where it was possible to select different bullet and upgrade the weapons, I made like 25 variables for one sprite with 20 different animation, where all weapons are.

for example, in your weapon: Pistol_Capacity, Pistol_Damage, Pistol_Speed, Pistol_RealoadTime...etc you made also variables for shotgun? or bazooka? etc... that will be crazy if you make all variable for all different weapons...you have to make a system like a "class"

would be easier if you make all variable for all weapons, like: Capacity_weapon, damage_weapon, extra_damace , speed_rate, BullePerShot,reload_time, frame_velocity, reload_frame, type_of_bullet...bla bla

and with this, I remember I made 4 different weapons in 4 minutes, like an uzi, shotgun, rifle shotgun and rocket rifle, just changing the same variable of the weapons.

you can also saved the variables into an array, or where you want... and if I miss something, like if I want to add another strange weapon, just add another variable or a boolean for that kind of weapon.
B
21
S
9
Posts: 298
Reputation: 2,967

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests