Jump to content

Hal's Prefab Editor


HAL9000

Recommended Posts

  • 4 weeks later...
[QUOTE=HAL9000;597346]It comes down to a couple of things, ease of conversion and motivation. I'll be honest if the block code needs a complete rewrite I don't think I've got it in me to do it. It's such an integral part of the code there could be dozens of hours that are needed to move everything over to the new system then at least a couple of releases to get all the bugs out. I've had zero modding time over the past few months and although I'm hoping to get some back over the next few there's a lot of other projects that have my interest and I don't have the time to do all of them. The editor was a lot of fun but it was mainly just maintaining these days which didn't take long and while I wouldn't leave you builders hanging there's at least 2 other tools that can import/export prefabs and I don't think the Pimp's tools aren't that far away. [/QUOTE] I knew this day could come and now I am seriously concerned about the future of my prefabs. Can you give a rough estimation how much time you've spent on the code? I am thinking about writing my own editor ... want to be prepared for the worst case^^. Btw. not sure which tools you are talking about. Afaik there are no tools that work with the current 7dtd version (maybe except the hidden ingame editor but we don't know if this thing is still included in A16). All tutorials about prefabs refer to your program.
Link to comment
Share on other sites

[QUOTE=Pille;619000]I knew this day could come and now I am seriously concerned about the future of my prefabs. Can you give a rough estimation how much time you've spent on the code? I am thinking about writing my own editor ... want to be prepared for the worst case^^. Btw. not sure which tools you are talking about. Afaik there are no tools that work with the current 7dtd version (maybe except the hidden ingame editor but we don't know if this thing is still included in A16). All tutorials about prefabs refer to your program.[/QUOTE] Hey Pille, I've probably spent more time in the code than I have playing and I've logged about 1500 hours playing. That's over everything though including SDX and the world editor. It also comes from back in the day where I was rewriting MSIL by hand to patch the original DLLS and combing through tens of thousands of lines of code to actually find out what was going on (ahh heady days....). I'm more than happy to collaborate and advise if you or anyone else wants to make an editor so that kind of time investment wouldn't be needed again. There's the DLL unlock from Herrpohl (and that'll definitely be in A16 cause it's what the Pimps use) and Coppi does one that's built on Allocs fixes too over in the modding section. Then there's whatever the Pimps will release for when modding support kicks in and workshops are available. The future of prefabbing looks in good shape with or without my editor so I wouldn't worry too much [QUOTE=Guppycur;619028]...so any new thoughts on the future, hal?[/QUOTE] Nah, the plan is the same for now. I'll decide the fate of the editor once I've seen the code changes and worked out how much time it'd take to get up and running again. Then I want to focus on the SDX Fire mod and finally get it running in MP. That will mean developing a way of adding custom NetPackages in through SDX and if we can get that then SDX will get another whole bunch of cool possibilities cause we'll be able to properly sync states and drive completely new events across every client that's in the game. Getting something like that into the hands of the prolific Starvation team will definitely be worth it!
Link to comment
Share on other sites

I was thinking about this quite a bit last night and although there are mods that allow import and export, without a tool to remove top and bottom layers, and something to trim the rows and columns, exporting is absolutely useless. Something to think about. Also, coppis doesn't reimport something correctly, densities? SI? Can't recall.
Link to comment
Share on other sites

[QUOTE=Guppycur;619089]I was thinking about this quite a bit last night and although there are mods that allow import and export, without a tool to remove top and bottom layers, and something to trim the rows and columns, exporting is absolutely useless. Something to think about. Also, coppis doesn't reimport something correctly, densities? SI? Can't recall.[/QUOTE] From what I've seen in the code that Herrpohl unlocks you should be able to define a width, depth and height for the export so you wouldn't need to trim the export.
Link to comment
Share on other sites

I don't recall that functionality but it might be there. Anyway, my point is, is that you can trim YOUR editor so that it /just/ deals with just the prefab portion so that you would never need to update it again. Delete all of the import and export stuff, and all of the fat out of your current editor, leaving something that just allowed for the 2D representation and something that reads from the blocks file, like it already does. I don't have your foresight but I would think that it would never again need to be edited again, unless they actually changed how the prefabs were stored. Thoughts?
Link to comment
Share on other sites

[QUOTE=Guppycur;619101]I don't recall that functionality but it might be there. Anyway, my point is, is that you can trim YOUR editor so that it /just/ deals with just the prefab portion so that you would never need to update it again. Delete all of the import and export stuff, and all of the fat out of your current editor, leaving something that just allowed for the 2D representation and something that reads from the blocks file, like it already does. I don't have your foresight but I would think that it would never again need to be edited again, unless they actually changed how the prefabs were stored. Thoughts?[/QUOTE] I'm pretty sure it will be able to. I know you can specify an area to fill and it's basically the same process. Yeah that could be one of the ways it happens where I disable all the broken stuff and just release as is. It all depends on how much work is in that first bit. [QUOTE=n2n1;619203]For the practical implementation of prefab - your Editor is more convenient than a built-in editor from game.[/QUOTE] Convenient for you, less so for me ^^
Link to comment
Share on other sites

[QUOTE=HAL9000;619083] I'm more than happy to collaborate and advise if you or anyone else wants to make an editor so that kind of time investment wouldn't be needed again. [/QUOTE] Thanks Hal, I'll take you up on that offer sooner or later (more precisely now :) )... The prefab file format looks quite simple to me. However, I am not sure about the meaning of the "meta2" value. It's not stored in the files and I cannot change it in the editor.
Link to comment
Share on other sites

[QUOTE=Guppycur;619250]Open source. Maybe to a selected person to take over. Prefabbing dies with your retirement. Great burden, I know, but a truth I believe in nevertheless.[/QUOTE] I don't think open sourcing is really the solution. If the conversion is easy I'll be doing it anyway and if it's not then someone trying to pick through my code and trying to rewrite it would struggle more than just starting from scratch and building their own vision. I don't obfuscate so the code is already there for people to see and use but I wouldn't want a constant stream of questions on how things used to work in code that would be already broken in A16. I also genuinely believe that the best improvement that could come would be having the editor tools inside the game. I did a demo video a few weeks ago and was able to render every block in every loaded chunk in a 2D grid in realtime (absolutely no optimisations on the rendering which I thought would be a killer). You'd also save a ton of time and maintenance by being able to use TFP's own code for prefab loading etc I doubt it dies but you're right it'll probably get a bit harder to do for a while till the next thing comes around. [QUOTE=Pille;619266]Thanks Hal, I'll take you up on that offer sooner or later (more precisely now :) )... The prefab file format looks quite simple to me. However, I am not sure about the meaning of the "meta2" value. It's not stored in the files and I cannot change it in the editor.[/QUOTE] meta2 is a property of the BlockValue struct. The Prefab file contains a list of BlockValues to store what blocks the prefab contains. Each BlockValue stores data about itself inside an unsigned integer and it uses bit masking to split that uint up into different "sections" to store data like the block ID, meta, rotation etc. If you grab a good decompiler (dotPeek, Reflector, ILSpy etc) and have a look at the Prefab class and BlockValue struct you'll see how it's used
Link to comment
Share on other sites

Well you know where I stand; but if it's over, it's over, and I thank you deeply for the work you put in... ...and if it's not over, I'm sure I will once again flood you with suggestions. :) Looking forward to the fire mod, I know myself and my guys are willing to test it on a passworded server should you need.
Link to comment
Share on other sites

Hey Hal, Just wanted to thank you for all the time you have put into this. I'd also like to offer assistance with the code if you need it. I've had a few looks through your code in ILSpy for the in game stuff. I think just a basic editor app that can do simple prefab resizing and painting of blocks is all thats really needed, all the rest is just bonus material :) I could probably come up with something for that with a bit of time. I've got some prefab stuff in my api mod, including a prefab insert command that has more options than coppis, and just needs the undo feature added to complete it.
Link to comment
Share on other sites

[QUOTE=HAL9000;619310] meta2 is a property of the BlockValue struct. The Prefab file contains a list of BlockValues to store what blocks the prefab contains. Each BlockValue stores data about itself inside an unsigned integer and it uses bit masking to split that uint up into different "sections" to store data like the block ID, meta, rotation etc. If you grab a good decompiler (dotPeek, Reflector, ILSpy etc) and have a look at the Prefab class and BlockValue struct you'll see how it's used[/QUOTE] Thank you Hal. I guess I can no longer avoid the dll files.^^
Link to comment
Share on other sites

[QUOTE=Guppycur;619330]Well you know where I stand; but if it's over, it's over, and I thank you deeply for the work you put in... ...and if it's not over, I'm sure I will once again flood you with suggestions. :) Looking forward to the fire mod, I know myself and my guys are willing to test it on a passworded server should you need.[/QUOTE] Yep no worries. It's all just speculation at this point. A few more weeks and we'll know. Yeah once the time is right I'll be doing a public test of the fire so I'll let you know. [QUOTE=StompyNZ;619345]Hey Hal, Just wanted to thank you for all the time you have put into this. I'd also like to offer assistance with the code if you need it. I've had a few looks through your code in ILSpy for the in game stuff. I think just a basic editor app that can do simple prefab resizing and painting of blocks is all thats really needed, all the rest is just bonus material :) I could probably come up with something for that with a bit of time. I've got some prefab stuff in my api mod, including a prefab insert command that has more options than coppis, and just needs the undo feature added to complete it.[/QUOTE] Hey Stompy, I'm good with the code, it's time that I need - too many projects on the go! But sure, if you want to do an editor and need anything just shout. Which in game stuff were you looking for? Did you find it? If it's the chat menu stuff look in the BackupManager.cs class for 99% of what I do in the DLL. The undo function I did was really just an extension of what's already there with the export function. Before inserting at a specific x,y,z (and known w,d,h) I do an export on the same area and save it to a system location for later use. Name the file with the tick value of creation so I can order them in time and that's about it. [QUOTE=Pille;619350]Thank you Hal. I guess I can no longer avoid the dll files.^^[/QUOTE] Just don't forget to choose a good totem ^^
Link to comment
Share on other sites

[QUOTE=HAL9000;619924]Just don't forget to choose a good totem ^^[/QUOTE] Lol. I am pretty much done with a first, very simple editor gui. All I have add to make it usable is a method for saving and loading the prefab data. Hope you can help me if I get stuck there (probably not necessary^^).
Link to comment
Share on other sites

[QUOTE=HAL9000;619924] I'm good with the code, it's time that I need - too many projects on the go! But sure, if you want to do an editor and need anything just shout. Which in game stuff were you looking for? Did you find it? If it's the chat menu stuff look in the BackupManager.cs class for 99% of what I do in the DLL. The undo function I did was really just an extension of what's already there with the export function. Before inserting at a specific x,y,z (and known w,d,h) I do an export on the same area and save it to a system location for later use. Name the file with the tick value of creation so I can order them in time and that's about it. [/QUOTE] I know what you mean with time, has been a struggle to find much to work on my mods. For the undo I was going to try and use chunk data directly rather than export a prefab with the hopes of retaining more info such as tile entity ownership and contents, sign settings etc.
Link to comment
Share on other sites

[QUOTE=Pille;619954]Lol. I am pretty much done with a first, very simple editor gui. All I have add to make it usable is a method for saving and loading the prefab data. Hope you can help me if I get stuck there (probably not necessary^^).[/QUOTE] Excellent, I and I'm sure others wouldn't mind seeing screenshots if you're up for it. Sure, just shout if you need anything (Prefab.cs is a good place to start just FYI) [QUOTE=StompyNZ;619956]I know what you mean with time, has been a struggle to find much to work on my mods. For the undo I was going to try and use chunk data directly rather than export a prefab with the hopes of retaining more info such as tile entity ownership and contents, sign settings etc.[/QUOTE] Ah yeah that's something I've been thinking about too but I went the other way and wanted to inherit from the Prefab class to extend the save/load methods to save extra data in the tts file. I think it's a real missed trick that the pimps haven't built on the prefabbing system to allow chests with pre-chosen loot or "faction X owns this". The downside was that it would require SDX or a modded DLL to read and write the files so yeah I agree that saving the chunks would be a good way of keeping compatibility with vanilla.
Link to comment
Share on other sites

[QUOTE=HAL9000;620384]Excellent, I and I'm sure others wouldn't mind seeing screenshots if you're up for it.[/QUOTE] Sure ... [url]http://imgur.com/F5iKt8R[/url] Technically, it is useable but needs bugfixing and some comfort functions are missing.
Link to comment
Share on other sites

[QUOTE=Pille;620405]Sure ... [url]http://imgur.com/F5iKt8R[/url] Technically, it is useable but needs bugfixing and some comfort functions are missing.[/QUOTE] Looking good Pille. Are you rendering that with OpenGL? It doesn't look like it but those buttons in the top right have me intrigued!
Link to comment
Share on other sites

[QUOTE=n2n1;620661]Hal, in early versions of your Editor was the 3D-view (isometric) ?[/QUOTE] Hi n2n1, No, the editor has never been 3D or isometric. I did some messing about with 3D many moons ago and loading prefab files into it but that's about it.
Link to comment
Share on other sites

[QUOTE=HAL9000;620598]Looking good Pille. Are you rendering that with OpenGL? It doesn't look like it but those buttons in the top right have me intrigued![/QUOTE] Those two buttons were already present in the '40000 chips example' which I used as basis to speed up the development process and because I was too lazy to develop from scratch ^^: [url]http://doc.qt.io/qt-5/qtwidgets-graphicsview-chip-example.html[/url] So yes, the graphics can be rendered using OpenGL (more precisely, Qt's (outdated) OpenGL paint engine).
Link to comment
Share on other sites

[QUOTE=Pille;620775]Those two buttons were already present in the '40000 chips example' which I used as basis to speed up the development process and because I was too lazy to develop from scratch ^^: [url]http://doc.qt.io/qt-5/qtwidgets-graphicsview-chip-example.html[/url] So yes, the graphics can be rendered using OpenGL (more precisely, Qt's (outdated) OpenGL paint engine).[/QUOTE] Laziness is in the heart of every good programmer... at least that's what I tell myself anyway ^^ Ah that'd be nice. Would Qt mean that Mac and Linux support is easy to add?
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...