Download Construct 2 release 36

Discussion and feedback on Construct 2

Post » Wed May 25, 2011 12:22 am

[size=200:2vewwiq0]Download Construct 2 public preview 36[/size:2vewwiq0]
[size=85:2vewwiq0]Link to release 35[/size:2vewwiq0]

As promised, this build brings global and local variables!

However, first of all, there's been an improvement to collisions: now rotated objects overlap when their rotated bounding boxes overlap, as opposed to using unrotated bounding boxes which are always much too big for rotated objects. This makes collisions much more useful now, even though there aren't fine collisions just yet.

Back to variables: the main change is both global and local variables appear, and are added and edited, in the event sheet itself!



Variables at the 'root scope' (at the top of an event sheet, or anywhere they aren't a subevent) become global variables. These work exactly like global variables in Classic: they keep their value between layouts, and you can use them from any event sheet, not just the one you created it in.

Variables which are subevents to another event become 'local variables'. You can see in the picture above they have a different icon too. These work slightly differently. They reset their value every tick back to their original value. Also, they can only be used in their 'scope'. This means any 'sibling' subevents. For example, in the above picture, 'MyLocal' can be accessed by any subevents of 'every tick', but not anywhere else. They're intended to be a temporary holding space for calculations, like you might have used a 'temp' global or instance variable for in Classic. Their scope is similar to how scope works in programming languages. This has the advantage that you can reuse names where scope does not overlap. You could have a 'sum' local variable in one subevent, and another 'sum' local variable somewhere else in that event sheet, used for another purpose.

As an added bonus the expressions panel lists all variables available in the current scope under the System object:



Local variables turned out to be a very complex feature to write - there may be bugs in this version. Let me know if you find any.

There are three more things to watch out for:
- You can drag local variables around like ordinary events. However, this changes their scope. This can mean events already using the variable can no longer access it. In this case, those events disappear, and a balloon tip appears at the mouse notifying you this happened. You can just undo this or drag it back and they'll reappear, though.
- Copying and pasting or dragging around events referencing local variables is tricky, because you can't paste them anywhere outside the scope of the local variables they reference. If you try to do this a message appears and you are prevented from doing it. This could be annoying for day to day use though. Let me know how you find it. Perhaps it could be worked around with a "do you want to add missing local variables?" type prompt.
- You can't yet put an expression in the initial value of either a global or local variable - this should be added in a future build.

Anyways, hope you enjoy, let me know if you have any thoughts or more ideas!

[size=150:2vewwiq0]Changelog[/size:2vewwiq0]
- [Feature] Global & local variables (see above)
- [Change] Previously collisions only tested axis-aligned bounding boxes. This doesn't work well for rotated objects, which often register collisions when close but not touching. Now collisions are tested with object-aligned bounding boxes (i.e. the box rotates with the object). This is much better for collisions between rotated objects until fine collisions come in future.
- [Fix] Browsers sometimes hang for a moment while they compile the javascript runtime. This could cause objects to teleport since the value of dt is very large for one tick. This has been fixed by capping dt to a maximum of 0.2 (equivalent to 5fps).
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Wed May 25, 2011 1:08 am

YEAH!!! FIRST!!!! WOOHOOOOOO!

heh jk I hate those twats that do that... local variables will definitely come in handy! Going to try this out now!
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Wed May 25, 2011 2:06 am

Great job ! C2 is just getting better and better ! C2 has brilliant future ahead of it :D
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Wed May 25, 2011 2:31 am

Marvelous, I just recently found construct 2, and I think it's coming out great *-*
Do you have an estimate for releasing the complete one? I have some projects and I want to know if I should wait for construct 2 to be finished ^^

Thank you very much for your hard work!
B
22
S
3
G
6
Posts: 59
Reputation: 4,450

Post » Wed May 25, 2011 3:32 am

[quote="kirby":8um10so8]Marvelous, I just recently found construct 2, and I think it's coming out great *-*
Do you have an estimate for releasing the complete one? I have some projects and I want to know if I should wait for construct 2 to be finished ^^

Thank you very much for your hard work![/quote:8um10so8]
C2 is definitely coming along faster than I anticipated, and it still has a long way to go.

If you have small projects you just want to get going on, I'd recommend Construct Classic, and it will have the added bonus of preparing you for using C2.


Anyhoo, this is a great addition (in fact, all of the recent builds have been really swell). You guys are really putting things together in a good way.
Check out my VGM on my soundcloud page!
Video-Game Music: E.C.2151
B
7
S
2
G
2
Posts: 193
Reputation: 1,561

Post » Wed May 25, 2011 3:37 am

[quote="Ashley":2n7wem44]now rotated objects overlap when their rotated bounding boxes overlap[/quote:2n7wem44]

AWESOME. Been wanting this feature for a while! Is it as fast as normal box collisions, or is it somewhat more computationally intensive than normal box, but still less than per pixel?

I sometimes get an error:

---------------------------
Construct 2 Check failure
---------------------------
Check failure! This is probably a bug:

No system expression found when evaluating identifier

Condition: system_expression != NULL
File: Projects\ExpTree.cpp
Line: 657
Function: void __thiscall ExpIdentifier::Evaluate(class ExpResult &)
Build: release 36 (32-bit) checked
Component: Construct 2 IDE
(Last Win32 error: 0)

I'm having difficulty reliably reproducing it, but it happens often. It seems to happen when setting a text object's text to a local variable. It also happens sometimes when dragging actions/events. I saved after getting the error here, the error shows on opening the file: http://www.amirai.net/forums/error.zip

Then after ignoring the above error and moving stuff around the event sheet, I got this error, which might not be important since it only shows up after ignoring the previous error, but I thought I should mention it anyway just in case:

---------------------------
Construct 2 Check failure
---------------------------
Check failure! This is probably a bug:

Creating deleted status undo point with no elements

Condition: !project_elements.empty()
File: Undo.cpp
Line: 75
Function: __thiscall ModifyDeletedStatus::ModifyDeletedStatus(const class std::vector<class ProjectElement *,class std::allocator<class ProjectElement *> > &,bool,const class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &)
Build: release 36 (32-bit) checked
Component: Construct 2 IDE
(Last Win32 error: 0)

Enjoying the rapid updates!
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Wed May 25, 2011 5:31 am



Me likey very much!
B
11
S
3
G
4
Posts: 622
Reputation: 3,186

Post » Wed May 25, 2011 7:05 am

[quote="Arima":n0yb6r0j][quote="Ashley":n0yb6r0j]now rotated objects overlap when their rotated bounding boxes overlap[/quote:n0yb6r0j]

AWESOME. Been wanting this feature for a while! Is it as fast as normal box collisions, or is it somewhat more computationally intensive than normal box, but still less than per pixel?[/quote:n0yb6r0j]
It always does an ordinary (axis-aligned) bounding box check first, which is trivial and 99% of the time determines the objects are not overlapping. The rotated-box check is only a bunch of arithmetic though so should be very fast as well, compared to per-pixel checking.

I think it's worth pointing out there won't be per-pixel collisions in the HTML5 runtime - Javascript isn't fast enough. The Classic runtime uses C++'s raw speed as well as special CPU features to make it practical. There'll have to be collision polygons instead.

Thanks for the check failure reports, I'll have a look soon!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Wed May 25, 2011 10:33 am

[quote="Ashley":25oy09uz]There'll have to be collision polygons instead.[/quote:25oy09uz]
Are we talking "manually created" polygons or automatically generated?
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Wed May 25, 2011 11:01 am

Both - I'm thinking C2 will try to guess the polygon, and you can manually tweak it if it's not good enough.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests