Desperate Gods modding tips, for Unity-newbs.

The place to discuss all things Desperate Gods.
Post Reply
Alorwin
Posts: 38
Joined: Sat Oct 25, 2008 6:43 pm

Desperate Gods modding tips, for Unity-newbs.

Post by Alorwin » Mon Feb 24, 2014 10:44 pm

Originally posted on Reddit, but this forum could benefit from it as well.

Important thing I forgot to mention before typing all the below: To save your changes of a prefab to the prefab and thus to make them apply when you compile/test your changes, look in the upper-right under the Inspector tab. If you are changing a prefab as it exists on the scene, it will have a second near the top that says "Prefab" and gives the options "Select Revert Apply" as buttons. Click apply to save your changes. A lot of things, like token or deck spawns can not be changed without dragging a prefab into the scene.

I don't actually know how to help with the particular error you are having, I am sorry to say. My suggestion would be to restore the base-unmodded source, then when you reload the project in Unity, the way I changed spawn positions was to drag the board-prefab into the game_scene.unity scene(game_scene.unity is the required scene for compiling/playing the game).
Edit 3: Under the Project-Tab in the middle-left side of the default Unity window, open up the Scenes folder and double click game_scene to get at the particular scene required.

When you drag the Board prefab into the scene you can fiddle with the spawn-positions. Just look to the left, under the Hierarchy-tab, and you'll see a > arrow with Board next to it. Click that to expand the menu and you'll see "DeckSpawns" and "DiceSpawns" and things like that. Expand their menus then click on the specific spawn and you can move them around. Above the Hierarchy tab you can see a hand-symbol, a four-pointed arrow(position) thing, a flip/rotate symbol, and a expand-symbol. Those will help with customizing the positioning. And another thing you can just outright delete, without it causing problems, is the DisplayTiles under the Board-prefabs hierarchy.
Under the board menu you can also delete things like the token/coin spawns. Since you're trying to make monopoly, I suggest going into the cards.txt file via either Unity's script-editor or notepad(I prefer the MonoDevelop/Unity script editor for it, though) and editting the name of deck-spawns(you have to change the deck-spawn names on the Board prefab as well).

Further, if you go into the BoardScript script, you can, and this is all I really know how to do, add prefabs for the game to look for and via that, you can modify/add to the non-deck things for it to load.

I did that by adding these lines;
public GameObject dice2_prefab;
public GameObject dice3_prefab;

Transform dice2_spawns = transform.Find("DiceSpawns2");
foreach(Transform child in dice2_spawns.transform){
GameObject dice_object = (GameObject)Network.Instantiate(dice2_prefab, child.position, Quaternion.identity, 0);
}
Transform dice3_spawns = transform.Find("DiceSpawns3");
foreach(Transform child in dice3_spawns.transform){
GameObject dice_object = (GameObject)Network.Instantiate(dice3_prefab, child.position, Quaternion.identity, 0);
}

I actually went up to seven because I needed a lot of varied dice, and I reskinning the dice separately required making(copy-pasting) a new material for each prefab.
But mostly, all I did was use what already existed and reskinned it. If you get to the cards and are having trouble, you can modify the final-cards by dragging CardPlayObject into your scene and fiddling with that. That only lets you modify the physical properties of the card, though. To change how the card is rendered, drag CardBakeObject into your scene and in the hierarchy you can change Coins/Flavour/Rules/Title/Type/VP to all have a scale of 0 on X/Y/Z. This makes the text invisible without removing them, because removing them without changing the code just breaks the spawning on the decks whereas making them 0-size makes them no show up and it doesn't break things. You also have to expand the Dice icon section and shrink the default there to 0/0/0. Then to fix the front-border, you can just replace the texture there with a 100% transparent image to make it invisible. Then expand the Contents for CardBakeObject and click default, then drag/move/scale the image until it covers the entire card, and you can use that image as the card-front instead(makes it easier if you have scanned cards to use.)

The next thing that needs to be done is clicking on the base CardBakeObject in the hierarchy and over on the right, under the inspector-tab, look for the "Card Bake Script (Script)" section and look just slightly under it for the expandable "Content_Textures" menu. That is where you can add/modify card images. You just have to match those images up with the cards.txt JSON card-list.

For example:
{
"Main Deck": [ // <--- This is the name of your deck and also what you need to spawn under DeckSpawns. The deck spawning code will match these together and load all the cards in the "Main Deck" section. {
"Title": "Certain Adventurer",
"Type": "Lizard Monster",
"Target": 4
"Gold": 4
"Points": 0
"Rules": "",
"Flavour": "\"There are also many
sentient races besides
humans\" (Beggars 12.1)"
"Duplicates": 1
"Image" : 1
"Back" : 0
}
{
"Title": "Certain Adventurer",
"Type": "Lizard Monster",
"Target": 4
"Gold": 4
"Points": 0
"Rules": "",
"Flavour": "\"There are also many
sentient races besides
humans\" (Beggars 12.1)"
"Duplicates": 1 // <--- This wasn't relevant to me but you can use this to create duplicates of a card within a deck. "Image" : 2 // <--- Relevant part. Element 0 from the Content_Textures = 0, Element 1 = 1 "Back" : 0 // <--- Also relevant, this is the card backing. I simply changed the texture-files in the folders rather than doing it proper, for this part. }
] // <-- You'll figure this out from looking at cards.txt, but the ] symbol determines the end of a deck. You CAN spawn multiple cards and card-backs into a single deck, however.
"Unused": [
{
"Title": "Deprived Succubus",
"Type": "Demonic Monster",
"Target": 6,
"Gold": 0,
"Points": 6,
"Rules": "On loss: take no damage, but
spend next turn fighting
Deprived Succubus again",
"Flavour": "\"I will call her Lust\"
(Lovers 2.10)"
"Duplicates": 1
"Image" : 56
"Back" : 2
}
]
} // <--- This whole "Unused" section is necessary. There is a bug in the code that makes the final card in the cards.txt list not have any front at all and/or not have any image(not sure which because I made the entire cardfrontborder transparent), so the Unused portion prevents it from messing up any of your real cards.

Beyond all that, I'm not sure there is anything else I can tell you. I pretty much distilled everything I did in the above. Until the very end of my work when I found the Content_Textures thing, I had been just replacing the textures in the folder with the texture I needed them to use, because I am that inexperienced. I even had to place my own play-area-boards into the Board prefab itself because I couldn't find out how to do it legitimately. Also, to remove the health-token spawns, just drag the PlayArea prefab into the scene, delete the spawns, then delete the PlayArea.

I don't know if this is very good advice or not and I don't know exactly how much it might help folks. But to the best of my ability I wrote out everything I had to do and every step I took in my own attempts to mod the game, and this should, maybe, be able to help someone with no experience in Unity or coding in general to be able to make their own mods. I hope.

And I forgot one thing. Go into the NetUIScript and near the top you'll see this;

const string DEFAULT_GAME_NAME = "Unnamed Game";
const string DEFAULT_PLAYER_NAME = "Unknown Player";
const string GAME_IDENTIFIER = "desperategodsv41";
const string GAME_DISPLAY_IDENTIFIER = "desperategodsv42";
const int DEFAULT_PORT = 25000;

Change the GAME_IDENTIFIER to have your multiplayer games not show up alongside Desperate Gods games and change the GAME_DISPLAY_IDENTIFIER to change that little bit of text that shows up when you start the game. And change the DEFAULT_PORT if you want to be able to run both games at the same time.

And compiling. The ability to compile is under the File menu and is called "Build Settings" or "Build & Run". When you first open that up, likely the only thing you need to do is click "add current" so that Scenes\game_scene.unity will be added to your compiled project, as this is the only scene required to play the game.

Edit 4: If it is relevant, board size can also be modified via expanding the Board-Hierarchy then expanding painted_board and fiddling with Box01. That is also where you replace the texture on the board.

Changing the PlayAreas is a bit harder because I don't know how to do it properly, but I just dragged new ones onto the Board prefab-hierarchy to make them a part of the Board prefab then positioned, sized, and changed the Texture Material(again via copy-paste) until I had what I need. Totally not the official/proper way, but as a half-measure to just "make it work", it was good enough. In my case, I added four PlayArea prefabs to the Board prefab the changed the Material, and the texture of the material, of objobjBox02, under the Base hierarchy menu of the PlayArea. Then after applying, this saved them into the Board prefab.

Note of quick-testing: In the top of the window right at the middle is a Play-arrow button and a pause, and third button. Clicking play with let you test the current scene to check how your changes are working out and if you're getting the effects you wanted.

I hope my edits haven't made this more confusing and good luck to anyone, other than Giossepi, who mods this game with my advice. I hope it is enough to get everyone to the results they want. When I started, I wasn't sure 30 days would be enough, but now I've finished my project and it is fine.

Edit 5: Changing the icon in the loaded game is done by expanding Title Holder under the hierarchy, and then expanding Blackness, and changing the texture of "default". I recommend a mostly-transparent image for this.

To change the icon of the compiled game, use the "Build Settings..." under the file menu then click Player Settings. In there, you can change the Company Name, Product Name, and the icon displayed for the executable. Open the Splash Image part to change the image shown in the menu that Unity asked about the resolution. You can also set options via the icon to the left of the Download-arrow(standalone options).

And if you want to build a webplayer version and host that on your own website, I also went through the trials of getting a Google App Engine app going despite being unable to use Java or Python to make it easy, so I can help with the Push-to-deploy git-repo method on that.

curieroy
Posts: 1
Joined: Sat Mar 07, 2015 4:32 am

Re: Desperate Gods modding tips, for Unity-newbs.

Post by curieroy » Sat Mar 07, 2015 4:42 am

Once you get into Vonkie's Mod you can add more cards into a pile, and adjust what their images and values are. I don't think you can actually add a new deck pile, but you could re-arrange things to look the way you want using the existing piles.

Aliraza35
Posts: 1
Joined: Mon Dec 21, 2015 3:12 am

Re: Desperate Gods modding tips, for Unity-newbs.

Post by Aliraza35 » Mon Dec 21, 2015 5:06 am

The card will be nerfed sometime in the future, also many rules about it will be changed?????

aaron1010
Posts: 5
Joined: Tue Oct 04, 2022 11:09 pm

Re: Desperate Gods modding tips, for Unity-newbs.

Post by aaron1010 » Sat Jan 14, 2023 2:16 am

Thank you so much for Desperate Gods modding tips for new Unity players like me. io games

Post Reply