[Tool/Web/Other] [In Development] A New Powerful Scene Editor
#1

SceneEditor
By
Introduction
Hello there, I hope you are doing fine. Good news for SA-MP mappers: In my spare time I am working on a new Scene Editor for SA-MP.
It's been a while since Jernej L. left SA-MP, and unfortunately his awesome map editor that I used a lot, now has become outdated: it does not support some features that were added in SA-MP relatively recently. That is why I think a new editor is needed.

I am posting this thread only because I need help with the development.

What Has Already Been Done

At this stage, the software app is not useable for the purpose.

As of 12/11/2018, the following things have been done:
  • A main window with a 3D Viewport and a menu
  • The camera mouse/keyboard/touch gestures with Helix Toolkit
  • A settings window in which you can configure the path to GTA SA
  • An IMG Archive reader (translated from an existent C++ code)
  • Parser for RenderWare .DFF models (certain models are not being loaded correctly)
  • Parser for RenderWare .TXD texture dictionaries (some types of decompression are missing)
I want to say thanks to JernejL, kcow, steve-m and the other authors of free/open source software found on the gta forums regarding the RW formats.

Planned Features
1. Not Only Objects!
One of the main differences between this Scene Editor and JernejL's is that, while the latter only allowed to create objects and vehicles (and to remove buildings), this one will support much more:
  • Objects
  • Building Removal
  • Vehicles
  • Pickups
  • Actors / FC-NPCs
  • Checkpoints
  • Race Checkpoints
  • 3D Text Labels
  • Custom Entities (e.g. gates, elevators, barriers)
  • Maybe more...
2. Import / Export
The app will export all the scene data to a .JSON file. This JSON file can be loaded again into the app to resume the previous work, but the point is that this JSON file can also be loaded by the SA-MP scripts using an include that contains a function which parses that kind of file and creates the objects accordingly. The include will use dynamic objects/actors/pickups/text3ds if Incognito's streamer is included. The checkpoints/race checkpoints will be created only if the Streamer is included. The editor will allow you to apply IDs to any object/vehicle/... in order to retreive them later in the code; an example are gates, which often need to be opened and closed.

An example of how it could be used:
pawn Code:
#include <streamer>
#include <Scene>
#include <zcmd>

new Scene: islandScene;
new objGate1;

public OnGameModeInit()
{
    // Scenes/Island.json is inside scriptfiles
    islandScene = Scene.Load("Scenes/Island.json"); // this single line creates all the objects, pickups, vehicles, actors (etc...) found in this file, and stores references to those who have an ID
    objGate1 = Scene.FindById(islandScene, "Gate1");
    return 1;
}

CMD:opengate1(playerid, params[])
{
    MoveDynamicObject(objGate1, 1242.47, 4214.55, 16.5, 1.0);
    return 1;
}
The app will also be able to import a normal .pwn file and interpret all the CreateObject(/CreateDynamicObject/CreateActor/CreateVehicle, etc...) found in it, and save them into the JSON format. This is for backwards compatibility with JernejL's map editor. There will also be an option to export a plain .pwn file, but in that case the advantages of code/resource separation will be lost.

3. Scene Editor
The main scene editor will be pretty much the same as JernejL's. It will feature an object browser window in which you will be able to search through all the objects using their name, id, and maybe category and description.
It will probably support multiple tabs each of which contains a viewport, enabling you to quickly switch between two or more views.
You will move around the scene in almost the same way as with JernejL's editor, but since the Helix 3D Viewport also handles touch gestures, it will be a lot easier to use this editor with a tablet (a Windows tablet, of course).
The right click (or long touch) on an object will open the context menu that offers the ability to delete the object, edit the materials or add attachments (in case of vehicles/FC-NPCs). Of course keyboard shortcuts will be also provided.

4. Material Editor
You will be able to use the material editor to change the materials and material text of any object. This editor will also feature a texture browser in which you will be able to search all textures.
The material editor can be used both while editing a scene to make a specific object in the scene have a specific set of materials, or alone, allowing you to export only the fragment of JSON data needed for that particular material configuration.

5. Attached Offsets Editor
The editor will feature an editor for Player/Vehicle attachments of objects. If used together with the Scene Editor (for example by right-clicking a vehicle or an FC-NPC), then the changes will reflect in the scene, but in a similar way to the Material Editor, the data can be exported separately.

6. SA-MP DL Support
It will allow the users of the DL editions of SA-MP to also use their custom models in the Scene Editor. They will simply have to add one or more model folders in the settings, and the app will load them.

7. Properties
You will be able to attach properties to scene objects. For example, you could add a weight property to doors, so that you can access that value from code and make the door open after the player presses a certain button a number of times.

8. Add-ons / plugins
There will be support for add-ons that add custom entities. For example, one could create a house filterscript, and then create an add-on for the Scene Editor, so that you can add houses in it.

9. Team
This will be an exciting feature: two or more people can work together on the same scene at the same time in order to enhance productivity. The file on which the team works will only be accessible to the host of the team session; the clients can only work on the scene without the possibility of saving the file on their machines.

10. Themes
The application will support default white and dark themes as well as custom themes.

11. Additional Tools
A few tools that could be useful which don't directly relate to map editing:
  • Animation Browser
  • Sound Browser
Technical Information
  • The programming language is C#
  • The app platform is WPF (> .NET Framework 4.6.1)
  • 3D rendering is done by WPF 3D (which in turn uses Direct3D)
  • Uses the Helix Toolkit ( link ) for some advanced 3D controls, like their enhanced 3D Viewport
  • Uses a managed wrapper for Libsquish for texture decompression (DXT)
  • The Version Control System is Mercurial and not Git, because it's better
Contribute To Development
Everyone is welcomed to contribute to the development of this awesome scene editor! Just send me an email (address at the bottom of my signature) and I will give you permissions to commit in the repository.

Repository
Follow this link to see the source code:

Bitbucket

Building

Visual Studio 2017 and the .NET desktop development workload are required to build the project. During the first build, an internet connection is required to download the NuGet packages.

License
Mozilla Public License
Reply
#2

Ah damn exactly my Map Editor just in C# xD

No seriously, looks good. I like the direct loading instead of having to paste around code.
Apart from an Item name ("Gate1" in your example) could there be custom properties for Items?
So that I could for example add a "Health" attribute to any Item and access that value from the script? That would allow for completely setting up gamemodes/maps in the Editor. That's what I do with my Editor and it's damn useful!
Reply
#3

Good
Reply
#4

Quote:
Originally Posted by NaS
View Post
Apart from an Item name ("Gate1" in your example) could there be custom properties for Items?
So that I could for example add a "Health" attribute to any Item and access that value from the script? That would allow for completely setting up gamemodes/maps in the Editor. That's what I do with my Editor and it's damn useful!
That is a cool thing. I thought about it, and it could be done like the following:
pawn Code:
CMD:something(playerid, params[])
{
    Scene.SetProperty(scene, objGate1, "Health", 50);
    new health = Scene.GetProperty(scene, objGate1, "Health");
    return 1;
}
But I have to think about the actual implementation. GVars could be an option. As for now, I am focusing on the editor itself.

The same thing however can be done without the need of properties:

pawn Code:
new objHealths[MAX_DYNAMIC_OBJECTS];

CMD:something(playerid, params[])
{
    objHealths[objGate1] = 50;
    new health = objHealths[objGate1];
    return 1;
}
(unless you want to be able to specify predefined values for each object)
Reply
#5

I'm impressed with this amazing creation of yours.

Good luck with the further development.

4 x
Reply
#6

Quote:
Originally Posted by Sasino97
View Post
That is a cool thing. I thought about it, and it could be done like the following:
pawn Code:
CMD:something(playerid, params[])
{
    Scene.SetProperty(scene, objGate1, "Health", 50);
    new health = Scene.GetProperty(scene, objGate1, "Health");
    return 1;
}
But I have to think about the actual implementation. GVars could be an option. As for now, I am focusing on the editor itself.

The same thing however can be done without the need of properties:

pawn Code:
new objHealths[MAX_DYNAMIC_OBJECTS];

CMD:something(playerid, params[])
{
    objHealths[objGate1] = 50;
    new health = objHealths[objGate1];
    return 1;
}
(unless you want to be able to specify predefined values for each object)
I'll tell you how I did it with my editor for an example, I added "Extra IDs" (could call it properties as well) which I can add/remove from any Item inside the Editor.
So if I want to give an Item health or whatever you can imagine, I add a "Health" Property, set its tag to Float and assign it a value.
When loading the items in the script, I have a function to search for a property and get its value, then do something with it depending on the Script I load it with.

So i don't define them in the script at all, but solely in the editor.
There should be enough "slots" to assign even complex properties. For example, I use the Extra IDs for Doors, Gates and moving Platforms which have a set of properties, eg. move Target Position and rotation (x,y,z and rx,ry,rz), move speed, whether or not a dynamic area is created to "trigger" them, the area's size and some other values to describe the type of movement.
With that I don't even need to touch the script when adding new doors, gates, etc and they can be configured in multiple ways so it looks like it was coded seperately.
It's probably a feature you don't want to implement early, but it's extremely useful in my opinion. When utilizing them properly you can truly build map resources for your gamemode with complex features without hardcoding them in the script.

You could also think about adding the attributes of existing SAMP Items as properties to the list, for example Picku Type or whether an Actor is invulnerable.
Or even go as far as adding any and all values you use for an Item into a dynamic property list. With that I mean the Items Position, Rotation and Model. Similar to how the Streamer Plugin has all the data available through Streamer_GetIntData etc. Hope you know what I mean

So far all the Editors had good features or were convenient to use, but implementing the maps was always either copy and paste or converting around map files.
With a good integration and being able to directly load stuff from the Map would be a huge selling point for me as that takes away a lot of unneccessary work AND allows for dynamic configuration of Items etc.

Also please consider allowing attached objects to objects as well. Even if you don't use YSF (which adds AttachPlayerObjectToObject) you can use these in the editor to create something similar to prefabs. You can calculate their real world position in the script based on the offsets quite easily, so they don't actually need to be attached ingame.

Anyway you'll probably focus on other more important things first, just wanted to give you some ideas.
Reply
#7

Quote:
Originally Posted by Sasino97
View Post
Scene Editor
Other things that Map Construction doesn't have:

- Animated objects support.
- Particle objects support (smoke, fire.. etc.).
- 2DFX effects support (coronas).
- Render object pictures without background (.png or .tga with AA if possible)
Reply
#8

Amazing, I'll keep an eye on the project.
Reply
#9

Perfect man, keep it up
Reply
#10

Quote:
Originally Posted by NaS
View Post
I'll tell you how I did it with my editor for an example, I added "Extra IDs" (could call it properties as well) which I can add/remove from any Item inside the Editor.
So if I want to give an Item health or whatever you can imagine, I add a "Health" Property, set its tag to Float and assign it a value.
When loading the items in the script, I have a function to search for a property and get its value, then do something with it depending on the Script I load it with.

So i don't define them in the script at all, but solely in the editor.
There should be enough "slots" to assign even complex properties. For example, I use the Extra IDs for Doors, Gates and moving Platforms which have a set of properties, eg. move Target Position and rotation (x,y,z and rx,ry,rz), move speed, whether or not a dynamic area is created to "trigger" them, the area's size and some other values to describe the type of movement.
With that I don't even need to touch the script when adding new doors, gates, etc and they can be configured in multiple ways so it looks like it was coded seperately.
It's probably a feature you don't want to implement early, but it's extremely useful in my opinion. When utilizing them properly you can truly build map resources for your gamemode with complex features without hardcoding them in the script.

You could also think about adding the attributes of existing SAMP Items as properties to the list, for example Picku Type or whether an Actor is invulnerable.
Or even go as far as adding any and all values you use for an Item into a dynamic property list. With that I mean the Items Position, Rotation and Model. Similar to how the Streamer Plugin has all the data available through Streamer_GetIntData etc. Hope you know what I mean

So far all the Editors had good features or were convenient to use, but implementing the maps was always either copy and paste or converting around map files.
With a good integration and being able to directly load stuff from the Map would be a huge selling point for me as that takes away a lot of unneccessary work AND allows for dynamic configuration of Items etc.

Also please consider allowing attached objects to objects as well. Even if you don't use YSF (which adds AttachPlayerObjectToObject) you can use these in the editor to create something similar to prefabs. You can calculate their real world position in the script based on the offsets quite easily, so they don't actually need to be attached ingame.

Anyway you'll probably focus on other more important things first, just wanted to give you some ideas.
Quote:
Originally Posted by Jking
View Post
Other things that Map Construction doesn't have:

- Animated objects support.
- Particle objects support (smoke, fire.. etc.).
- 2DFX effects support (coronas).
- Render object pictures without background (.png or .tga with AA if possible)
Thanks, your ideas are highly appreciated.

Quote:
Originally Posted by Eoussama
View Post
Amazing, I'll keep an eye on the project.
Quote:
Originally Posted by JohnRastion
View Post
Perfect man, keep it up
Thanks for the support. Although, I hope someone can join me in the development since I have small time to continue it.
Reply
#11

I compiled this to test, and is cool the design.
Reply
#12

Good work! I hope the scene viewer will be faster than JernejL\'s map editor. JernejL\'s runs like poop on my PC and I have an i7-7700k D:.
Reply
#13

So whats up for 2019? Great work btw
Reply
#14

this is very nice post fantastic.
Reply
#15

So, whats news?
Reply
#16

Regarding NaS\'s idea, you could simply assign 10 "Extra IDs" and export in streamer format. Streamer already includes an Extra ID suite as well as a lot more information storing.
Reply
#17

Great job, and maybe possible testing for public?
Reply
#18

Any news??
Reply
#19

good idea! I cant wait for this
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)