Sign in to follow this  

Level editing for 3D platformer

Recommended Posts

Posted (edited)

I'm currently creating a level editor for myself. My game has a lot in common with 3D jump'n'run plaftomer games.
Basically I imagine my level being structured very similarly to this : https://www.youtube.com/watch?v=xCk0T-0Z3cU&t=21m30s 


1st approach - a way to do this, is with some parameter based shapes : boxes, cylinders, slopes, stairs, ect. that are "skinnable" eg. I can specify a theme that will be used to texture them. Examples could be: forest, city, snow, cloud, ect.

I actually did some prototyping(see the screenshot) of that and it works just fine, especially well for the physics, since the collision shapes are well defined (a convex hull for the slope, 3 boxes for 3 stairs ect.). The thing that concerns me is the texturing. I'm not exactly sure how to do it. Basically I want my objects to be scalable, while textures maintain their size relatively constant in world space, and (if possible) make the texturing seamless across primitives, basically if I snap one primitive to another I want them to feel like 1 shape.

2nd approach - to have a set of predefined tiles, that are already textured and create shapes out of these tiles. This sounds good, But I really do not know how to approach this. Additionally if every tile has it's own collision shape for the physics the physics simulation will get pretty slow (I'm using bullet physics). Do you have any tips how should I approach this? 

3rd approach - Well your experience here ^_^ All suggestions are wellcome


 

primitives.png

Edited by ongamex92

Share this post


Link to post
Share on other sites

I'm currently working on some type of level editor myself, but I've opted to forgo abstract shapes and just use existing meshes for editing.  Just consider grid aligned/snapped placement of existing meshes, and use those as building blocks for a larger level.  If you want to support flood fill, you can still do that using meshes.  Select a start/end of a box, then fill that in with as many meshes as it takes.  It's not one single cube that you're creating, it's a set of X by Y instances of a single block.  This is similar to how TES/Fallout levels are made, they have a set of models for the different parts of a level (corners, walls, halls, etc), then they place those on a grid to create the entire level.  After that you can support non aligned/snapped placement to add clutter (furniture, debris, etc), or even rotate the walls to create curved halls, sloped floors, etc.

The advantage of all this is that you're likely to reuse the same models for different cells, which means you can use instancing to draw a single mesh X times.  You also can use a separate model editor for better control of the individual meshes and texturing, instead of trying to support things like texturing and random shapes in the level editor.

For the physics, I'm not sure about how bullet does things, but in Newton you can create a single collision object, then use that object for any number of bodies.  This is basically the same as instancing with rendering, you have a single set of source data (authored separately, depending on how you store/load data), and each body has it's own orientation that uses that single source collision data.

Share this post


Link to post
Share on other sites
On 8/25/2017 at 2:53 PM, ongamex92 said:

The thing that concerns me is the texturing. I'm not exactly sure how to do it. Basically I want my objects to be scalable, while textures maintain their size relatively constant in world space

This is just normal scaling.

First you make the models at max texture size, so say when the prop is at it's largest it uses that texture. Then if you scale it to half size you also scale the texture to half size. That way texel density is the same no matter what. Odd scaling can be done by filling the scaled texture with black pixels where it isn't mapped.

 

If what you meant is that you would like the details to remain the same size, that is even easier. Just use tiled textures map to the world coordinates and use tiled textures.

 

There are many games that have done this kind of things before, just look around and you will find examples.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this