# Sonic Studio

Discussion in 'Fangaming Discussion' started by Lapper, May 19, 2018.

1. ### Lapper

Lappering Member
1,702
630
93
England
Sonic Studio, Sonic Physics Guide, Kyle & Lucy, Freedom Planet 2
Hmm, if I'm missing some kind of secret sauce by all means enlighten me in PMs!

When I talked about it above, it's less the collisions themselves but the unlimited stuff you can do with them and the uncontrollable layouts you could create. I feel like with the 6 sensors all working together and unlimited terrain potential it's inevitable it'd happen.

2. ### BlueFrenzy

Member
30
19
8
I cannot send you PMs, for some reason.

I wanted to know a bit how you calculate the collisions to see if this helps. Maybe you already apply it or use a totally different system and I am talking nonsense.

The magic sauce is casting colliders before you move the entity. Basically, if you have a sphere as main collider, you cast it from the old position to the new one, so you will end up with a capsule like shape that covers the movement of the entity. It can also be a point if you wish so, but a sphere helps with small gaps. Then, you check the collision of this collider and find the intersection point for all the colliders and the normal of the collision. With the intersection point you can already cut the movement to ensure the movement ends before touching the collider. In a simple platformer you divide the X and Y axis when cutting it, so if you cut the x axis you don't have to cut the Y and then the character slides. In an arbitrary angle you will probably have to make the transformation.

And, having the normal of the collision you can already know the slope and make the proper rearrangements. In this case, you keep the normal of the closest intersection points.
If you have several layers, you can even know if you changed layer before or after colliding with another collider just by checking if the casted collision overlaps the layer change triggers and just order the collision points by distance to the entity. If you do so, you could move 10.000 meters in one frame, crossing several layer changing triggers and still be able to calculate where the entity will stop.

Not sure if this is helpful. Don't hesitate to ask for details.

Last edited: May 19, 2020
3. ### Lapper

Lappering Member
1,702
630
93
England
Sonic Studio, Sonic Physics Guide, Kyle & Lucy, Freedom Planet 2
Ahh ok. You can contact me on twitter.com/LapperDev

Oh yeah I'm all over that sort of thing I've got enough collision experience, and sounds easy enough in such an example though it's slightly less effective when you are using multiple axis-aligned "sensors".

They are axis aligned only for the closer accuracy but even if they werent and they rotated smoothly with you, you'd still be able to move at angles the collision lines aren't facing.
So, in that case, the only way to test the entire area a sensor would have moved is with a 4 sided parallelogram area which already sounds a lot more heavy than just testing lines (which in turn is already way more heavy than the simplicity of tiles). Sure there would be slightly cheaper ways like 1 line from the old sensor innerpoint to the new sensor endpoint etc but I feel methods like that would change a lot of things. I need to employ tricks like that but at the same time keep things cheap so that we can have multiple stuff going on onscreen in any kind of user created stage.

I don't want to have a massive collision process breakdown here though haha.

4. ### BlueFrenzy

Member
30
19
8
Yes, by using a parallelogram you should be able to cover the whole area. One of the things you could do, maybe, is precalculate the collisions using the parallelogram and then go into the detail using the other sensors. It see a lot of potential in your tool. A real lot of potential. But it's up to you to decide if you want to have more objects in screen at once or having finer collision detection. I can understand your choice.

In any case, it's still an awesome job. I really want to see more and maybe try it.

5. ### Lapper

Lappering Member
1,702
630
93
England
Sonic Studio, Sonic Physics Guide, Kyle & Lucy, Freedom Planet 2
Longer video showing the entire process of making a loop!

I do mention it, but you won't need to do all this to make basic basic loops, but its a good demo to start with.

• Like x 2
• Informative x 1
• List
6. ### BlueFrenzy

Member
30
19
8
Pretty intuitive for the people who used the sonic worlds Engine.
There's a but, though. 10 minutes of video for a loop. Does Sonic Studio have a "prefab" feature or is it planned? A game like sonic requires huge quantities of terrain to be covered, and some complex structures like the loops will be used several times through the levels. The most optimal way of working in any type of level would be to create a set of pieces, specially those that will be reusable, and then, add them all around. I think that being able to select a shape (or several), save it as a "prefab" and being able to drag and drop it, is almost mandatory to be able to make levels of the size required for a Sonic game in a reasonable time.

7. ### Lapper

Lappering Member
1,702
630
93
England
Sonic Studio, Sonic Physics Guide, Kyle & Lucy, Freedom Planet 2
All you need to do to answer that is look at the bottom left menu, second item from the right!

Though, I do point at it subtly at one point where I mention this is only an example, not how you'd actually need to create these loops. Most are missing it though so I'll have to be more clear in future!

So to do just that: no you don't need to do layering for normal every day loops, even slightly different loops of different sizes and entry positions, but you will for say, a figure 8 loop or something crazy, or any other setup you want to make.

8. ### BlueFrenzy

Member
30
19
8
Awesome, dude. This looks spectacular.

9. ### Lapper

Lappering Member
1,702
630
93
England
Sonic Studio, Sonic Physics Guide, Kyle & Lucy, Freedom Planet 2

New animation!

10. ### Slow the Snail

Member
16
30
13
Interesting. When I first saw your videos, I thought you were using a completely different method, not the collision lines, because of how flexible the geometry is and the fact it didn't use tiles. My approach in Sonic 2.5 was to just fill the entire gap between the green and teal collision lines (in the image above) with more collision lines, 1 per pixel. Not a perfect or elegant solution, but it gets the job done for the more obvious blind spots of the classic engine. My game is tile-based though so the collision detection is very inexpensive, maybe not ideal for your engine.

Another simpler solution could be to detect bad geometry (like extremely sharp angles and thin platforms) and tint it red-ish in the editor, just to let the user know that it might be buggy. It's their call to keep it that way or not.

I think that leaving the responsibility to the level designer is absolutely the right call though. If you become too obsessed with making the engine perfect, the project doesn't move forward, and in the end, some people will always find a way to break it on purpose anyway.

Really impressive project by the way. Sprites, backgrounds, new mechanics (pushing blocks with the spin dash is super smart), level editor, engine... It's hard to find something that could be labeled any less than fantastic. Good job!

11. ### High Fidelity

Member
Ah man, you used my track 'Pulse'. next time let me know and I can promote it!

12. ### Lilly

Member
2,335
138
43
United States
Shang Mu Architect
Y'all bringing up the physics has me wondering, Lapper: How was the transition to Gamer Maker Studio 2.0 for you?

They completely refactored the tile functions, for performance sake, and the additional complexity of it is still knocking me off my feet. I was going to revisit my own tile-based Sonic collisions in Studio 2.0 anyway, because my current model is, well- it's a functioning attempt at Sonic 3's physics, but it could be more robust and simplified. And I might be able to go off-grid with tile placements if I can build my own tilemaps, but it's such an overwhelming change!

If your collisions are also tile-based, has Studio 2.0's changes proven to work more in Sonic Studio's favor, than slowed you down?

Last edited: Jun 10, 2020
13. ### Hez

Oldbie
Lapper I hate you and how good this looks. Stop it.

Jokes aside -- looks fantastic my man!

• Like x 1
• Agree x 1
• List
14. ### Lapper

Lappering Member
1,702
630
93
England
Sonic Studio, Sonic Physics Guide, Kyle & Lucy, Freedom Planet 2
Thanks, Hez!

I don't even remember if I started studio in GMS 1 or 2. I got 2 upon release I think and started studio Sep 17 or so... but I remember very early on GMS2 made the project unusable (messed up "view" files) and I had to reconstruct it file by file in a new project lol.

Specifically regarding tiles, I found them fine in other projects, I like that they became more like legit tiles and not weird faux objects that you can overlap, didn't make much sense. And now when editing you can floodfill and all that great stuff. And room layers are great to work with.
Studio however doesn't touch tiles at all, it's all rendered with shaders and vertex buffers & collisions are line intersections/vector. Which all has its benefits and drawbacks.

15. ### Lapper

Lappering Member
1,702
630
93
England
Sonic Studio, Sonic Physics Guide, Kyle & Lucy, Freedom Planet 2

Some more editor footage! Just a basic video showing a couple new things.

16. ### Lilly

Member
2,335
138
43
United States
Shang Mu Architect
It's like black magic watching this video! How you create shapes reminds me so much of selection tools from more advanced art software, like Photoshop, so I can see a lot of people feeling right at home with these tools from the get-go.

Oh, I know that suffering from GMS 1. :specialed: Maybe an update broke things? Unity users have to deal with this constantly if you're not on an LTS release version.

I'm really late to the Studio 2 party, but it's clearly a lot more mature now.

Yeah, I also like how much more formalized and efficient the tile system is now, as well as the addition of animated tiles. I just have no idea how I'm supposed to make things collide with tilemaps, but given what you said, maybe I don't have to go that route? I only went with tile collisions in Studio 1.4 for performance benefits- then the gains turned out to be more marginal than I realized it would be at Sonic's scope. (With Sonic's complexity, any way of colliding with things is fair game, honestly.)

So, it's interesting to me that you chose vectors for collisions instead, which makes a lot of practical sense for how Sonic Studio functions. That's appreciably different from most Sonic Game Maker engines!

17. ### Lapper

Lappering Member
1,702
630
93
England
Sonic Studio, Sonic Physics Guide, Kyle & Lucy, Freedom Planet 2

New music (and zone theme reveal). Thanks to Jahn Davis for another masterpiece.

Last edited: Aug 2, 2020
18. ### Overlord

Now playable in Smash Bros Ultimate Moderator
18,930
777
93
Long-term happiness
Getting a very Mania vibe from this, which I guess was the feeling you were going for? Very nice work =P

19. ### rata

Member
647
39
28
Argentina
Trying to be useful somehow.
You know, I'm running out of Likes thanks to you.

20. ### Lilly

Member
2,335
138
43
United States
Shang Mu Architect
This excites me, because I have more nostalgia for Emerald Hills than Green Hills. (Grew up with Sonic 2 first; didn't get my hands on Sonic 1 until I was 13 ) It will be so nice to produce stages with Emerald Hill's theme!

(Also, are those palm trees on the hills in the distance, or are we seeing a golf course? I like how you always find more room for detail in your backgrounds.)