GithubHelp home page GithubHelp logo

pairofdocs / unity-d2r-scene-editor Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 4.0 7 MB

Use unity to edit position, rotation and scale of D2R models in a level preset

License: GNU Affero General Public License v3.0

C# 100.00%
diablo2 diablo-ii unity3d d2r diablo2resurrected

unity-d2r-scene-editor's Introduction

Unity-D2R-Scene-Editor

Edit D2R preset environments in Unity. A purchased copy of D2R is required to access the data files.

(Recommended: intro video about Unity's layout, panels and terminology https://youtu.be/pwZpJzpE2lQ?t=71)

  1. Create a new 3D project in Unity (this example project is named "D2R-docktown")
  2. Download this repository, unzip and place its contents into your unity project Assets folder (e.g. ...Unity Projects/D2R-docktown/Assets/Scripts , Resources, libs, ...)
  3. Open the project in Unity and select the Main Camera object in the Hierarchy. Then in the Inspector window on the right hand side add a component script Scripts/SaveJson.cs. (This is done only once per project)
  4. Save your Unity Scene with ctrl+s. Set your D2R data paths in SaveJson.cs and save the script see below
  5. Click the blue "Play" button above the Scene window to load a json preset in the project folder (e.g. docktown3.json). Click "Pause" and move/rotate/scale objects in the Scene
  6. To add objects to the Scene click "Pause" to unpause and then click the "Add" button on the left of the Scene and specify the path of the model to add. Once objects have been added click "Pause" to go back to Scene editing
  7. When finished editing click "Pause" once again to unpause and then click "Save" on the left of the Scene to save your changes to the preset json file
  8. Place your edited preset json into your D2R/Data/hd/env/preset location and launch D2R with -direct -txt

A video showing act1 edits: https://streamable.com/xbxe7i

Troubleshooting

If you see errors like

Assets\Scripts\SaveJson.cs(9,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Assets\Scripts\SaveJson.cs(10,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

Then the Newtonsoft package needs to be installed in Unity. Install through Unity's Package Manager: in Unity’s top menu: Window > Package Manager > Search for package Newtonsoft. https://docs.unity3d.com/Packages/[email protected]/manual/index.html

Thanks to MilesTeg from d2mods.info for pointing this out.

Config Data Paths

Lines 16 and 17 in SaveJson.cs should be configured for your preset path and D2R data path

    public string preset = "docktown3.json";              // Change this to be the json preset that is edited
    public static string d2rDataPath = "D:/D2R/";         // Change this to where your D2R data is extracted (casc storage)

Unity

Freely available here https://store.unity.com/download-nuo

Screenshots

Unity act3 scene

Act3 docktown in-game

Unity act1 south scene

Act1 south in-game

Credits and Tools

Copyrights

Diablo II and Diablo II: Resurrected are copyrighted by Blizzard Entertainment, Inc. All rights reserved. Diablo II, Diablo II: Resurrected and Blizzard Entertainment are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.
All trademarks referenced here are the properties of their respective owners.

This project and its maintainers are not associated with or endorsed by Blizzard Entertainment, Inc.

unity-d2r-scene-editor's People

Contributors

pairofdocs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

unity-d2r-scene-editor's Issues

Interesting stuff!

Hey man,

That is some interesting d2r stuff you are working on!
Havent had much time to fool around lately but a little D2R playing around,
the modding potential seems legit though, right? Wonder about content creation though,
I see some ambitious mods popping up.

I've been busy with IRL stuff, but got my feet wet with some interesting unity 2D beginnings stuff
and now learning C# OO fundamentals for both business and back to unity, ultimately.

Your unity d2r editor certainly peeked my interest though while I'm slowly
putting some time in unity again, gonna check that out, great stuff indeed!

cheers!

deegeeooh

Terrain.model errors abundant

Changing docktown to wstone01.json (have not tested others yet) results in a partial success, but there is many missing objects (half of baals bridge ramp etc), as well as numerous repeated errors, all pointing to a single line SaveJson.cs. Docktown worked great on startup and load, however. Im not even sure its about the terrain.model, but many just an exception in general in the catch block. But either way,

if (!strArr[strArr.Length-1].Contains("terrain.model")) }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.