Discuss Scratch

DCPU-16
Scratcher
100+ posts

Making Custom Levels for O

This is a guide to importing and uploading custom levels in my 3D Maze Platformer O.
Quick link to OBJ NewLine Converter

When you first start the Level Editor, you'll see this screen:

Here's a quick description of what everything is:
  • Import Model - Lets you import a 3d .obj model to use for the level. It must be converted using the OBJ NewLine Converter here.

    Input Colours - Cycles through all the polygons, letting you set the colour for each individually. Triggers automatically on import.

    Back - Discards the level and returns to the Level Share.

    3D View - A 3d display showing the level, starting position and bumpers under the UI. You can rotate this by clicking and dragging.

    Start Direction - The direction the camera faces at the start of the level. You can see where it points with the white arrow coming from the start position.

    Test & Upload - Plays the level. When you complete it, you are asked if you would like to upload or return to the editor.

Since the game is 3D, the levels need to be created in a 3D modelling tool. Here we will be using Blender, however you can use any 3D modelling software you want as long as it can export to .obj and you remember to triangulate all the faces!

First, you should probably start with a flat plane (though you could really start with anything, it would just surprise the player). Remove the default cube and create a plane using Add > Mesh > Plane. You'll want to move this down at least 1 unit, anything less and the ball will be embedded in the plane at the start and not able to move anywhere! (as it starts at the zero position)

You can use a default sphere to represent the ball for now, but remember to remove this before exporting - if you don't the course will have too many faces and you'll be stuck. You can do this using Add > Mesh > Sphere. The sphere will spawn with the correct size and position.



Your main tool for designing levels will probably be Edit Mode + the Extrude Tool (E key). You should switch to edge mode, select the edge you want to extend outwards and press E. This will create a new edge with a face joined to the previous edge, which you can move around, scale and rotate. You can also do this with multiple edges to get interesting effects, (eg select all sides of the plane, extrude, press s and drag outward to enlarge and move it up, you now have a hole!).



Using this you can create long winding tracks, but you can also use other tricks like deleting the faces and making new ones (select edges/vertices, press f key) to join certain pieces of geometry you normally can't with extrusion. You could also use the other primitives in interesting ways, eg circles, however you need to be really careful not to use more than 60 triangulated faces. This is a hard limit I have put in as the game will run way too slow past this point and many people will not be able to run the level without the game freezing.

After you make your level, or any time you feel you need triangles (eg to check the face counter), switch to face mode, press A to select all faces and then press Ctrl-T. This will triangulate all faces, if ANY face is not triangulated the level will not import correctly, as neither the rendering engine or collision engine support quads, and the importer is so simple that it does not even recognize quads and cannot convert them. Faces should look like this after triangulation:



To check your face count, you'll want to delete the reference sphere then check the indicator in the top bar. Remember, anything under 60 is allowed, but under 35 would be preferred to keep the level performing well. The level shown above has a measly 4 faces.



So after you've done all this, you should have your level! Here's one I created for example:



Note: Don't ever do this - this level has EXACTLY 60 FACES, doesn't have any challenge and is perfectly flat! I just picked it because it looks nice.
Anyways, you'll want to use the .obj exporter tool which you can find here:



Untick “Objects as OBJ objects”, then export to somewhere you'll be able to access it easily. Load the file into http://jsfiddle.net/99LsL/, and copy the output. Now you want to click import level, and paste it into the box that appears. When you accept, the model should appear completely black and the colouring mode should be initiated:



To colour the level you click a colour for each triangle. Any triangle that is either of the Goal colours will end the level when hit. You can enter custom colours by clicking the “Custom” button, these should be input as 24bit hexadecimal values, eg #FFFFFF for white and #FF0000 for red. You can still rotate the view by clicking and dragging if you cannot see the highlighted triangle.

Once you cycle through all of the colours, you can test and upload the level! If you want to make changes, just repeat the process above.



Tools for adding red bumpers to levels are coming soon.

Last edited by DCPU-16 (Jan. 9, 2014 01:53:55)

gravtest
Scratcher
100+ posts

Making Custom Levels for O

Awesome game, awesome guide! This may be a better fit for Project Ideas, though.

nathanprocks
Scratcher
1000+ posts

Making Custom Levels for O

gravtest wrote:

Awesome game, awesome guide! This may be a better fit for Project Ideas, though.
I think it fits here. It isn't really a project idea and Blender is pretty advanced.

Last edited by nathanprocks (Jan. 10, 2014 10:46:56)



My browser / operating system: Macrosoft Winding XO, Internet Exploder 6.0, Angel Player ver.:1.2.5
;
DCPU-16
Scratcher
100+ posts

Making Custom Levels for O

nathanprocks wrote:

gravtest wrote:

Awesome game, awesome guide! This may be a better fit for Project Ideas, though.
I think it fits here. It isn't really a project idea and Blender is pretty advanced.
I wouldn't say Blender is advanced, but there isn't really a forum for this kind of thing so Advanced Topics seems like the best fit.
Magnie
Scratcher
100+ posts

Making Custom Levels for O

In a sense of “Scratch Advanced” this is definitely advanced for most Scratchers. So it's location is completely fine. This look really cool, nice job!

▴ ▾ ▴ Macbook Pro 13" 2015 i5-5257U 8GB RAM - MacOS Sierra - Vivaldi v1.7 ▴ ▾ ▴
There are 10 types of people in this world, those who understand binary, those who don't, and those who know ternary.
OrcaCat
Scratcher
1000+ posts

Making Custom Levels for O

Amazing job!


davidkt
Scratcher
1000+ posts

Making Custom Levels for O

Great game!

Remember when I looked like this? I still do.


Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
MCAnimator3D
Scratcher
500+ posts

Making Custom Levels for O

I HAVE to keep the link to this somewhere!


scratch
davidkt
Scratcher
1000+ posts

Making Custom Levels for O

MCAnimator3D wrote:

I HAVE to keep the link to this somewhere!
Favourite it, and look in my signature.

Remember when I looked like this? I still do.


Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
DCPU-16
Scratcher
100+ posts

Making Custom Levels for O

Cool, MCAnimator3D made a level! I was making one of my own, but it made clear a pretty crucial collision bug. If the ball collides with 2 perpendicular/acute walls, it can potentially get embedded in the wall. I'll be working this out for the future engine release, which will come out alongside Triengine and a multiplayer first person shooter demo.
bobbybee
Scratcher
1000+ posts

Making Custom Levels for O

DCPU-16 wrote:

embedded in the wall.

Ooo! Fun!

“Ooo, can I call you Señorita Bee?” ~Chibi-Matoran
DCPU-16
Scratcher
100+ posts

Making Custom Levels for O

bobbybee wrote:

DCPU-16 wrote:

embedded in the wall.

Ooo! Fun!
It's not really, there's no way to break free apart from restarting the level…

Last edited by DCPU-16 (Jan. 19, 2014 20:19:45)

bobbybee
Scratcher
1000+ posts

Making Custom Levels for O

DCPU-16 wrote:

bobbybee wrote:

DCPU-16 wrote:

embedded in the wall.

Ooo! Fun!
It's not really, there's no way to break free apart from restarting the level…

I know, sarcasm. Perhaps you could could hack a solution together which will test for specific conditions and remove the collision detection to avoid being trapped. More of a band-aid fix, but it may work (I'm not completely sure what algorithm you're using so yeah..)

“Ooo, can I call you Señorita Bee?” ~Chibi-Matoran
DCPU-16
Scratcher
100+ posts

Making Custom Levels for O

bobbybee wrote:

DCPU-16 wrote:

bobbybee wrote:

DCPU-16 wrote:

embedded in the wall.

Ooo! Fun!
It's not really, there's no way to break free apart from restarting the level…

I know, sarcasm. Perhaps you could could hack a solution together which will test for specific conditions and remove the collision detection to avoid being trapped. More of a band-aid fix, but it may work (I'm not completely sure what algorithm you're using so yeah..)
Right now it always moves to the point of collision, then moves back a tiny set amount along the velocity vector no matter what so the sphere is not infinitely close to the wall.

It should not do this if the velocity is smaller than that set amount. In that case, it shouldn't move at all and only adjust the velocity vector, not the position.

Last time I tried this though the collision kept randomly stopping on the spot. That was before I corrected an error though, so it may work this time.

EDIT: Looks like the fix worked! putting in O now…

Last edited by DCPU-16 (Jan. 19, 2014 20:59:05)

Spunky_Sam
Scratcher
44 posts

Making Custom Levels for O

Oh no. Not blender again. (I not good at using blender.)

define eat [food] (times) times
point towards (food)
repeat until <touching (food)?>
move (5) steps
end
repeat (times)
play sound [nom v] until done
end
broadcast (join (food) [ Eaten])
DCPU-16
Scratcher
100+ posts

Making Custom Levels for O

Spunky_Sam wrote:

Oh no. Not blender again. (I not good at using blender.)
Don't worry, making level models involves few pieces and the model doesn't need to be an artistic masterpiece, just fun to play!

I managed to fix the collision bug I mentioned. There are still remnants of it present though - on the “Fortress” level I uploaded you'll notice getting stuck in the stairs for a second or two. This could probably be fixed by adjusting the “very near distance”, or some extra checks. So indoor levels/levels with hard walls should work fine now.

Last edited by DCPU-16 (Jan. 20, 2014 00:39:05)

sevis
Scratcher
4 posts

Making Custom Levels for O

ask [why does this have to be so... complicated?] and wait
DCPU-16
Scratcher
100+ posts

Making Custom Levels for O

It's kind of a hacky solution right now… though the alternative would be for me to make a functional 3d modelling tool in scratch, which I definitely don't have the time for!

On another note, it looks like @SplashHero has made some really imaginative levels!
weatherman115
Scratcher
500+ posts

Making Custom Levels for O

I use Sketchup and it isn't working.(I don't have Blender.)

h
HansieScheepers
Scratcher
100+ posts

Making Custom Levels for O

Blender is AWESOME!!!!!!

I'm becoming very inactive! I might even leave!!!

Powered by DjangoBB