Author Topic: JSON, misadventures in Modding and tears. [please help...]  (Read 1127 times)

Offline Wulfle

  • Zombie Food
  • *
  • Posts: 74
    • View Profile
JSON, misadventures in Modding and tears. [please help...]
« on: March 27, 2017, 09:16:19 PM »
I am at the point of tears. I have done everything I can think of, I've combed though every line of code ten times but, whatever the problem is, I can't find it.


Background: I like this game and have been playing it for some years. I've watched it from the humble beginnings all the way to now. I also like Warhammer 40,000. So, naturally, I decided to put the two together.


Now, I'm not saying that I'll be making a mod that encompasses the 40K universe. Right now I just want to make a proof of concept and to see if I like doing this (I probably will because code is a puzzle and i really like puzzles.).

Problem: The console loads fine and every mod loads just great. The compile is fine. When I select my mod and load a world it goes though the DDA files and then stalls when attempting to load the mod. The debugger will not display, however, compounding the problems and exponentially expanding my frustration.

Anyway, I put my code in spoilers so as not to nom the the page. If there's something I've missed, let me know. If there's a step involved that I'm not getting, refer to the previous line.


gun.json
(click to show/hide)


ammo.json
(click to show/hide)

magazine.json
(click to show/hide)

ammo_types.json
(click to show/hide)
« Last Edit: March 27, 2017, 10:13:34 PM by Wulfle »

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3729
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #1 on: March 27, 2017, 09:51:53 PM »
What is the problem here?
I mean, some error that prevents loading, items not working or what?

Offline Wulfle

  • Zombie Food
  • *
  • Posts: 74
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #2 on: March 27, 2017, 10:15:24 PM »
What is the problem here?
I mean, some error that prevents loading, items not working or what?
(Coolthulu replied to my post! Alright, don't freak out.)
"Hi." (Crap...)

Sorry. Fixed it in the main description.

Anyway, the main problem is that I don't know. The debugger isn't displaying anything at all.

There's clearly an error, however because I push "I" when it's stalled at my mod when loading the world and boots me to the main menu.
« Last Edit: March 27, 2017, 10:22:31 PM by Wulfle »

Offline StopSignal

  • Survivor
  • ***
  • Posts: 3422
  • Never stop drawing!
    • View Profile
    • You can see my drawings here!
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #3 on: March 27, 2017, 10:21:40 PM »
Have you turned off debug mode?

Offline Wulfle

  • Zombie Food
  • *
  • Posts: 74
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #4 on: March 27, 2017, 10:22:56 PM »
Have you turned off debug mode?

It's a fresh compile. Should I turn it on?

That was a stupid question. I'll turn it on and report back on what it says.

Offline Wulfle

  • Zombie Food
  • *
  • Posts: 74
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #5 on: March 27, 2017, 10:30:04 PM »
Right well, no debug messages show in console or in Code::Blocks. All it does is stall and refuse to load when it gets to "Please wait while the world data loads... Loading content (40K)"

Edit: Just ran it though the CB debugger again and it threw this error.

In __cxa_throw () ()
#1  0x007adc38 in JsonIn::error (this=this@entry=0x13f6886c, message=..., offset=1) at C:\Users\REDACTED\Downloads\CataDDAGit\src\json.cpp:1513
C:\Users\REDACTED\Downloads\CataDDAGit\src\json.cpp:1513:33711:beg:0x7adc38
At C:\Users\REDACTED\Downloads\CataDDAGit\src\json.cpp:1513
« Last Edit: March 27, 2017, 10:34:27 PM by Wulfle »

Offline Zhilkin

  • NPC
  • **
  • Posts: 134
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #6 on: March 27, 2017, 10:39:59 PM »
You have invalid content in gun.json:

 "magazines":[ [ "bolt", [ "BolterSickleMag_30", [ BolterSickleMag_25, [ BolterSickleMag_20, ] ] ] ]

Should be probably like this:

 "magazines":[ [ "bolt", [ "BolterSickleMag_30", "BolterSickleMag_25", "BolterSickleMag_20" ] ] ]

***

Also multiple commas are missing which makes json syntax bad.
« Last Edit: March 27, 2017, 10:49:49 PM by Zhilkin »

Offline Wulfle

  • Zombie Food
  • *
  • Posts: 74
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #7 on: March 27, 2017, 10:45:25 PM »
You have invalid content in gun.json:

 "magazines":[ [ "bolt", [ "BolterSickleMag_30", [ BolterSickleMag_25, [ BolterSickleMag_20, ] ] ] ]

Should be probably like this:

 "magazines":[ [ "bolt", [ "BolterSickleMag_30", "BolterSickleMag_25", "BolterSickleMag_20" ] ] ]

This has taught me a valuable lesson; Always read the code one more time.

I'm compiling now and then we'll see if that fixes it. Honestly, thank you so much. I never expected this much help or support! I'll be back when CB is done munching and let you know.

Offline Zhilkin

  • NPC
  • **
  • Posts: 134
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #8 on: March 27, 2017, 10:50:34 PM »
You don't need to recompile, just put updated json to game folder.

Offline Wulfle

  • Zombie Food
  • *
  • Posts: 74
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #9 on: March 27, 2017, 10:56:37 PM »
You don't need to recompile, just put updated json to game folder.

It threw this error in the debugger.

http://imgur.com/a/AcBN2
« Last Edit: March 27, 2017, 11:02:24 PM by Wulfle »

Offline Zhilkin

  • NPC
  • **
  • Posts: 134
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #10 on: March 27, 2017, 11:03:02 PM »
No, you don't need to recompile - JSON is not compiled. It is read and interpreted by the game. Restarting/reloading the game is usually enough to apply changes to JSON. Here are updated files packed into mod: https://www.dropbox.com/s/0cvisdci7m3wm7c/WH40KGuns.zip?dl=0. Just unzip it into mod folder and add mod to world settings.

The gun works, but it only can be spawned via debug menu, so you will need to add or update some item groups to have gun, magazines and ammo spawn somewhere.

The explosion is rather big, though it could be okay for WH40K.

Offline Wulfle

  • Zombie Food
  • *
  • Posts: 74
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #11 on: March 27, 2017, 11:09:40 PM »
No, you don't need to recompile - JSON is not compiled. It is read and interpreted by the game. Restarting/reloading the game is usually enough to apply changes to JSON. Here are updated files packed into mod: https://www.dropbox.com/s/0cvisdci7m3wm7c/WH40KGuns.zip?dl=0. Just unzip it into mod folder and add mod to world settings.

The gun works, but it only can be spawned via debug menu, so you will need to add or update some item groups to have gun, magazines and ammo spawn somewhere.

The explosion is rather big, though it could be okay for WH40K.


How the hell did you get that to work? I must learn from the strange codeamancy that you practice.

Seriously, what was I missing?
« Last Edit: March 27, 2017, 11:17:21 PM by Wulfle »

Offline Zhilkin

  • NPC
  • **
  • Posts: 134
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #12 on: March 27, 2017, 11:42:24 PM »
Json syntax was incorrect: missing commas, missing parenthesis, missing quotation marks.

You can compare files in some text compare tool to see what was changed.

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3729
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #13 on: March 27, 2017, 11:52:55 PM »
Anyway, the main problem is that I don't know. The debugger isn't displaying anything at all.

If you're only changing jsons (and not sources), test it on a downloaded tiles build.
The windows curses build has some known problems, such as not displaying the errors and not going fast (less than half the FPS).

Offline Wulfle

  • Zombie Food
  • *
  • Posts: 74
    • View Profile
Re: JSON, misadventures in Modding and tears. [please help...]
« Reply #14 on: March 27, 2017, 11:56:34 PM »
Json syntax was incorrect: missing commas, missing parenthesis, missing quotation marks.

You can compare files in some text compare tool to see what was changed.

Thank you, thank you, thank you! you've made me so much more confident in doing JSON now!
Anyway, the main problem is that I don't know. The debugger isn't displaying anything at all.

If you're only changing jsons (and not sources), test it on a downloaded tiles build.
The windows curses build has some known problems, such as not displaying the errors and not going fast (less than half the FPS).

Thank you both so much! This has made me so much more eager to do this now! I can't wait to start on other weapons, rounds and factions. I'm very exited now. The support and help that I've received here has only made me love this game even more.