I am looking at a beautified version of codeNw.js and I can understand more or less what is going on. What I don’t know is how to take code in there that’s not already supported by the API and create a mod for it.
I read the advanced modding info on the wiki but I didn’t understand it well. (I am new to this)
Example: I want to create a new genre. This is not currently supported by the API. I can find all instances of genre implementation in codeNw.js, but I do not know what I need to do in my own mod so I can add to them.
How would I do that?
Thanks!!
EDIT: Signing up to get complete source in case that gives me more insight, but I have a feeling there’s something more basic I just don’t know.
Hello @Scoresby,
Adding new genres will make your mod imcompatible with other mods, since you have to add another value to every genreWeigthings on every topic and platform.
That would already be alot of work just for the vanilla topcics and platforms, but mods that add topics/platforms won’t be able to use your new genre. They have no extra value for your new genre so they won’t know how to “react” to it.
Hope this helped you ^^
~~~ DzjengisKhan ~~~
Yes, I’ve been thinking about that problem.
My first stage would be a mod that explicitly states it’s not compatible with others (essentially making it for myself, and sharing in case anyone is interested).
Then I wonder if for a second stage I could write something that would look for the extra value, and if it’s not there put in some default. I realize that would also be a big challenge, but I’ve seen a LOT of interest in new genres on the forums (especially Puzzle and FPS), so I think it may be worth it. Or course I’ve only just started delving into the code so I don’t know if that kind of generate-default-value-if-none-present idea is even possible.
It would probably possible, you just have to check the length of the array. And if it’s one short, you add a new one (I would suggest 0.8 since that’s the most neutral modifier).
1 Like
@Scoresby
Like @DzjengisKhan said adding genres isn’t that easy.
A lot of functions have hardcoded uses of the genres like GameGenre.getGoldenRatio for example.
You would have to hook every function that uses a genre because you can’t just add your own Genres to an array and be done with it!
I would suggest you try something else first!
Kristof
Can’t someone create a mod with all the mods combined? Would it work then?
Haha, the more I think about it the more I agree. I have worked with arrays before so I think I could do it but maybe something a little simpler first. Also I’ll have help later this week, so that will be nice.
I’ve written things from scratch with js but never done a mod so this revere-engineering and then overriding thing is new.
@thegamingchann1, Yes it would work but it would be a huge undertaking.