Jump to content

[Very much in Progress] SamacEditor


Recommended Posts


Most Stable Version: 0.013a

Recent Version (Test): ----


Hello guys! I keep asking questions about this project, so I decided to just make a central thread for this.


SamacEditor is the beginnings of a Terrain Editor for my projects. I hope to make it as open-ended as possible, to eventually allow other people to use this editor for their own projects.

The design of the editor is to remain as separate from game-code as possible. This is to allow you to make your game any way you want, and still use all the features.


Working Features:

  • Edit Terrain in a variety of (buggy) ways!
  • Save Terrain by Importing/Exporting
  • Exports terrain in chunks to allow optimising in game
  • Paint Terrain with textures

Upcoming Features:

  • Vertex Editor: Fix your terrain one vertex at a time
  • Object List: Add and Edit objects to add into your world
  • World Editor: Add/Interact with your objects!
  • Texture Paint Shapes: Choose from a variety of masks to edit your textures in

Nerd Talk:

This is done by having the editor create .json files contain information, including object location, terrain vertices, and much more. You'll soon be able to create objects, which while has a mesh in the terrain editor, it doesn't export a mesh for it. Instead, it exports a .json file containing the ID, scale, position, rotation, and custom variables. Your game-code can then interpret this json file as you wish, or use my engine I'll be trying to release someday in the next century.


Another important note: This editor uses php. Therefor you must use a more complex local server program, such as WAMP. :)

Well, thanks for reading! If you have any ideas or problems, post it here!

Old Post:


SamacEditor is the VERY Beginnings of a Terrain Editor for Babylon, built in Babylon.


So far I haven't achieved much, but what I have is located here: http://steinhauer.x10.mx/editor


Soon I'll be adding a json-importer/exporter. The world chunks then would be loaded with it's own format! :D


Eventually I wish to add a full-blown editor - add rocks, houses, any mesh. That will be in the future.



I do have a question on how I should design this guy. Where should it be located?


-Local: The editor is downloaded to the location of your game. From there you access all files and objects


         *The editor needs no downloading/uploading to server. So if the editor exports a million images, it'll all work out fine

         *Streamlined - files automatically get updated, no need to download


         *Requires a local server


-Server: The editor is located on the internet, and requires drag-and-drop of objects and images


         *Online, so accessible anywhere

         *No local server required


         *Requires a massive amount of downloading and uploading of files, all the time


While I don't think Local is the coolest way, (No demos! :o) I think I'll be forced to do it - you can't make a game where every time you edit textures they have to be downloaded to the correct place! Blehhh!



Another problem: I'm currently using a edited version of the python local simple server. However this little guy does not support POST and PHP! Does anyone have a lightweight program in python (or not) that supports these things!? Thanks!

Link to comment
Share on other sites

Good luck with your project. it took me almost 2 years to complete CastorEngine that has a full terrain editor, particle editor, script for the game and others.

With my editor, you can add 3D models by drag drop, add components to edit each objects on the scene (collision, rendu, action...)

CastorEngine also to its own file format for the ground and the content of the scene. I think you are creating an editor that already exists and in multilingual.  :)

Link to comment
Share on other sites

Woo! Here's a massive update!




This little guy has a basic texturing system, (click "Texture painter" to begin), and of course a better terrain editor.


I'm also trying to make a vertex editor, which makes it so you can manually fix each vertex in each plane. This feature doesn't work at all...


:) I'm also going to try to make image masks for the painter, but that will come later. Most of the controls work now, as well. :D

Link to comment
Share on other sites



A huge update is coming soon!


I've updated the interface, and the best part is... json saving/loading works!


I'm not sure how I should use saving json on the demo (security and such)... but loading will be a thing on demo!


I just need to add image saving/loading (quite easy!) and set up some stuff, and I'll upload the demo. :D


EDIT: Image saving is finished! It's so pretty!

Link to comment
Share on other sites





I've updated the interface (not quite finished), and added a huge feature: The importing/exporting of maps!


How it works:

First a json file is saved to the map folder. This first file is the map file. It contains general map data. (map width + height, textureResolution, etc)

A map consists of chunks. Each chunk also gets its own json file.

Each chunk gets its own image. These are saved as well.


When you want to import it, it simply loads the data. :D

Soon I'll be adding intelligent loading, so you need to only load chunks that your standing on. This would allow for big maps.


The exporter is a php file. Right now the demo only imports, because I dont want to have php that can delete anything it wants to. I'll add security at some point.

Soon I'll make it so you can download a .zip file containing your "export". :D


PS: Importing takes a bit! So be warned! :D


Post any bugs and ideas!


EDIT: There is something very strange. In chrome this works fine and dandy. In firefox, however, picking meshes is VERY broken! There is a strange shift or offset, always (1/3) of the size of the canvas to the right. Anyone seen this before?

Link to comment
Share on other sites

I'll try...


You know what would be awesome? 


Ima be adding a object adder first, and then eventually add a vertex editor/mesh creator. This would allow for the above. I'm hoping to make it SUPER easy to add custom code to do basically anything you want.


I'm leaning toward making a game with the style of delver, (I can't do complex meshes) and I would want to make samac do that and my original game style as well.

Link to comment
Share on other sites

Update: 0.01


Well an update has arrived!


  • Added HUGE Feature: GUI Generator
    • Loads GUI data from a javascript file here
    • Automates a LOT of code - Instead of several hundred lines of hard code, the GUI data does it all by itself.
    • Allows certain selections to hide mini panels (Example: Flatten Brush Type hides Direction minipanel)
    • Generates all of the panelling you see on the editor.
    • Generates modals (popups)
  • Did a lot of work on the loading system
  • Did a lot of work on SamacEngine to work with my game and this Editor
  • Began work on Object Editor (Not visible atm)
  • Did a bit more work on Vertex Editor
  • Added Flatten, Smooth, and Noise Terrain Types
  • Added the ability to switch texture in Texture Editor
  • Added auto-pixel scaling to texture if wanted
  • Added Several textures

Be sure to point out any problems or bugs you have! Thanks for reading!





Version Log:





Link to comment
Share on other sites

Update: 0.012


A Mini Update is here!

  • Changed hosting to a real site I have, instead of the crap free hosting. :)
  • Now you can export/import as much as you want!
  • Modals are generated now as well. Thats how the import/export modals have come to be.
  • Lots of bugses fixeded.

For the next major update I plan on building something like Babylon Editor, to make it so you can add meshes and stuff. Then these object's locations would be saved to the exporter. The importer then can do anything it wants to. I'm also going to add a editor.json, which is included in every map. This editor file contains important datas for the editor itself, not whatever the game your exporting for. The mesh locations and such would be paired with this file. :D


Be sure to point out any problems or bugs you have! Thanks for reading!




Link to comment
Share on other sites

I'm having a problem:

I've been trying to set up the object-movey thing. (Translate thingy)

I've been looking at the drag-n-drop example on the playground, and made it so you can only go in one direction. (This will allow different arrows to go different directions)



This is all fine and dandy... except one strange factor. The ground.

I'm slightly confused on how the returning ground location works...



Anyone wanna explain? :D


EDIT: OHHH It seems the ground is being used as finding a point in the world, making the ground a kinda global pointy-thingy! Couldn't there be a better way of doing this??? I mean, something like this: Run a function that has inputs: Mouse x, Mouse y, global x, global y, and it returns a global z. :S

Link to comment
Share on other sites

This is what I use:

var pickInfo = scene.pick(currPos.x, currPos.y);if (pickInfo.hit) {	if(pickInfo.pickedMesh.id == "worldTile") {		mgrid_pos.x = pickInfo.pickedPoint.x;		mgrid_pos.y = pickInfo.pickedPoint.y;		mgrid_pos.z = pickInfo.pickedPoint.z;	}}

Where currPos x/y are from the mouse event listener ( currPos.x = evt.clientX; currPos.y = evt.clientY;). This version is limited to only returning values when the cursor is above 'worldTile', but if you remove this if statement it will work for all meshes in your scene which have 'pickable' set to true.


I'm not sure if this helps you - it inputs mouse x/y and returns global x/y/z.


I can't quite get my head round how inputting mouse x/y & global x/y would work together?

Link to comment
Share on other sites

What I am needing is something quite different, I'm afraid. I need to do what the Babylon Editor uses, but cannot get my head wrapped around it. :(


Every frame you're dragging around a mesh, it needs to compute where the mesh will be now. Problem is that the mouse location is not touching anything, so you cant pick.


You do however, have the old location of mouse, and it's 3D counterpart. What I need to do is convert a 2D Vector (old -> new) to a 3D Vector (old -> new).


I know the entire 2D Vector, but I only know the starting point for the 3D one. :(


EDIT: After scouring the Babylon Editor's Code, I think I get it! It's working! Very buggy just due to how buggy the Original Editors is, but I'm working on that...

One problem seems to be sensitivity... if your zoomed in at *just* the right spot, everything is dandy. But if your zoomed in/out too much, the object moves too much or too little. So now I'm working on getting it to interact with camera distance. I've managed to make one improvement: in the Original Editor the manipulator automatically "scaled" to fit the screen's shape. Strangely enough, the coder didn't scale the manipulator... he/she changed the position. This causes a problem not visible in the OG editor due to not being able to see the manipulator while the camera moves. :) But thats fixed for me nows... I'm dumb. Nevar mind, I get why the coder did it! Scaling an object changes it's positioning crap, yes? And scaling would indeed break it :( There must be a way to fix!!!!!!!!!

Link to comment
Share on other sites

Okay so I made a sweet logo for the project, a favicon, and also added a Credits button:



On that test version above, you can click the "World Editor" Button. Out pops a lovely object, with its own manipulator. But then try zooming in the camera!

As you can see, everything bugs out! Does anyone know how this could be fixed?


EDIT: I also have another question - is it possible to change the name of this thread? :) I cant find a button anywheres!

Link to comment
Share on other sites

What was the name of the map?

What browser?

And what version did you use? 0.012 or 0.012t?


And be sure to test it on...



Mini Update: 0.013

  • Added more security for exporting
  • New logo + favicon, and a credits button. <3
  • Updated GUI system to allow for a soon-to-come update
  • Exporting shows with file is being exported

This update was mostly for demonixis to test exporting. :)


EDIT: I needed to fix a big bug, so here is:


Mini Update: 0.013a

  • Fixed a major bug in exporting
  • Added a back button to specific errors and the credits 
Link to comment
Share on other sites

ok so for whatever reason the hosting I'm using doesn't like my php. So...


Mini Update: 0.014

  • Switched back to old host, So exporting works.
  • Added masks: Select your mask to change the "shape" of your texture brush!
  • Added color: Choose to paint in a color instead of a texture

Next Update I'll make it so the texture/masks dropdown will contain a picture each. :)

Link to comment
Share on other sites

Hey guys!


I've run into a problem - not a technical problem per se, but a design problem.


I'm wanting my editor to be as open ended as possible - when editing a game one doesn't simply drag and drop meshes to be rendered, sometimes one may want these meshes to symbolize something, like a spawnpoint and such. And then maybe one wants to have a house, built from several meshes. (walls, etc)


In other words, there are several "thingies" you can add to the map, and they all work differently:

  • Meshes attached directly to the map. These would often be rocks and trees, and would simply be seen as meshes, maybe some collide and some don't, etc.
  • Symbols - these are seen as meshes in the map editor, but not in the game. Thus the mesh location would not be exported, only ID's and rotations and such.
  • Groups of meshes - parent meshes together, and you now have a fancy house or lightpost. Now why wouldn't you simply make a "house mesh"? Because that's a waste of meshes, and meshes = loading, and no one likes loading. :) These groups can be considered a "mesh" in the aspect of thingy 1 and 2 above.

So basically... does this make any sense? Should I change the names of anything, or redesign anything? Any ideas? :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...