New models for map creation

Everything about mods can be found here.

Moderator: Morax

Re: New models for map creation

Postby Jip » 01 Feb 2018, 12:02

Lionhardt wrote:Thing is, atm resources that are not standard are not supported though the client, right? If I put custom resources in my map, they won't be displayed for somebody that just downloaded the map but not the custom resource.


I apologise for inviting myself into this conversation, but I think this is incorrect. See also the following post from in 2013:
viewtopic.php?f=53&t=4651

And, when I look at how Supreme Commander 'hooks' the files into the game:
Code: Select all
path = {}

local function mount_dir(dir, mountpoint)
    table.insert(path, { dir = dir, mountpoint = mountpoint } )
end

local function mount_contents(dir, mountpoint)
    LOG('checking ' .. dir)
    for _,entry in io.dir(dir .. '\\*') do
        if entry != '.' and entry != '..' then
            local mp = string.lower(entry)
            mp = string.gsub(mp, '[.]scd$', '')
            mp = string.gsub(mp, '[.]zip$', '')
            mount_dir(dir .. '\\' .. entry, mountpoint .. '/' .. mp)
        end
    end
end

mount_contents(SHGetFolderPath('PERSONAL') .. 'My Games\\Gas Powered Games\\Supreme Commander Forged Alliance\\mods', '/mods')
mount_contents(SHGetFolderPath('PERSONAL') .. 'My Games\\Gas Powered Games\\Supreme Commander Forged Alliance\\maps', '/maps')
mount_dir(InitFileDir .. '\\..\\gamedata\\*.scd', '/')
mount_dir(InitFileDir .. '\\..', '/')

It appears to be inrelevant of whether the files are inside a .scd (located in gamedata), or whether it is properly placed inside a maps folder. I have not yet tested it, but I will soon. I am currently figuring out how props are made.

Meaning: if I am right, the custom props can be downloaded to the client, along with the map. It doesn't leave the fact that:

Franck83 wrote:What do you mean by non standard ? It means that it needs to be added to FAF (.scd gamefolder file) ?

This is way better, seeing that two maps that share the same custom props requires them both to be downloaded and stored seperately, otherwise. On top of that, creating a 'library' of valid props could never be a bad thing too.
Jip
Avatar-of-War
 
Posts: 51
Joined: 12 Jul 2015, 22:25
Has liked: 3 times
Been liked: 11 times
FAF User Name: Jip

Re: New models for map creation

Postby ozonex » 01 Feb 2018, 12:06

In incoming release of map editor I added support for searching for custom stratum/decals/props from map folder. I'm almost sure it will all works fine, but didn't have time to test it well yet.

But there are few maps that has custom assets and it just need to be in map folder and path to them should start with:
Code: Select all
Maps/[mapFilderName]/


It works fine with textures and decals, so it should also with props blueprints
FAF Map Editor Alpha v0.605 > Get it now!
User avatar
ozonex
Priest
 
Posts: 358
Joined: 16 Feb 2012, 20:11
Location: Poland
Has liked: 197 times
Been liked: 263 times
FAF User Name: ozonex

Re: New models for map creation

Postby Franck83 » 01 Feb 2018, 12:29

Jip wrote:Meaning: if I am right, the custom props can be downloaded to the client, along with the map.


That would be crazy amazing ! Can anyone test and check it ?
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: New models for map creation

Postby Franck83 » 01 Feb 2018, 12:30

ozonex wrote:In incoming release of map editor I added support for searching for custom stratum/decals/props from map folder. I'm almost sure it will all works fine, but didn't have time to test it well yet.

But there are few maps that has custom assets and it just need to be in map folder and path to them should start with:
Code: Select all
Maps/[mapFilderName]/


It works fine with textures and decals, so it should also with props blueprints


So fun !
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: New models for map creation

Postby Jip » 01 Feb 2018, 12:59

Franck83 wrote:
Jip wrote:Meaning: if I am right, the custom props can be downloaded to the client, along with the map.


That would be crazy amazing ! Can anyone test and check it ?


I'll look into it today.

Edit: So, I've looked into it. At first glance, it appears that any .bp files within the map folder are not being looked at. When the blueprints are being loaded (this happens before the 'loading screen'), the following code is executed:

Code: Select all
   
-- blueprints.lua

    LOG('Loading blueprints...')
    InitOriginalBlueprints()

-- (!) looks into regular folders to find files inside the .scd (gamedata folder) files
    for i,dir in {'/effects', '/env', '/meshes', '/projectiles', '/props', '/units'} do
        for k,file in DiskFindFiles(dir, '*.bp') do
            BlueprintLoaderUpdateProgress()
            safecall("loading blueprint "..file, doscript, file)
        end
    end

-- (!) finds any .bp's that are part of a mod.
    for i,m in __active_mods do
        for k,file in DiskFindFiles(m.location, '*.bp') do
            BlueprintLoaderUpdateProgress()
            LOG("applying blueprint mod "..file)
            safecall("loading mod blueprint "..file, doscript, file)
        end
    end

    BlueprintLoaderUpdateProgress()
    LOG('Extracting mesh blueprints.')
    ExtractAllMeshBlueprints()

-- (!) allows direct manipulation of existing .bp files for mods. Balancing mods can make use of this, I suppose.
    BlueprintLoaderUpdateProgress()
    LOG('Modding blueprints.')
    ModBlueprints(original_blueprints)

    BlueprintLoaderUpdateProgress()
    LOG('Registering blueprints...')
    RegisterAllBlueprints(original_blueprints)
    original_blueprints = nil

    LOG('Blueprints loaded')

I've marked some lines with '-- (!)' to explain what is going on. Long story short: the engine doesn't look for .bp files within a map folder, and hence, props will never be loaded from where a map is.

However, it currently appears that props can be loaded in through a mod, and then used on the map! The same way units are, but then, of course, different. I myself have minor experience on modding. I can figure this out too, but it will take longer. Perhaps there is someone else who can look into this?

EDIT2: I looked into the mod idea. It won't work directly - it does load the prop, as the log shows:
Code: Select all
INFO: applying blueprint mod /mods/advanced shields v4/env/common/props/customstone01_prop.bp

However, the path is wrong. So, I tried changing the path within the (official) editor, but then the following happens:
Code: Select all
invalid blueprint '/mods/advanced shields v4/env/common/props/customstone01_prop.bp'

meaning, that this idea does not appear to work with the official editor - adding a path to path of the mods is impossible, because all paths to props through .scd files will start with env/ (instead of mods/)

That being said, I found one map that used custom textures: Canyon SC2.v0001. However, these do not appear to be loaded in my supreme commander:
Image

Does anyone know what happened here? And if it ever did work?

On the original topic: a new .scd containing lots of new props that would be installed along with FaF would, for all good reasons, be amazing.
Jip
Avatar-of-War
 
Posts: 51
Joined: 12 Jul 2015, 22:25
Has liked: 3 times
Been liked: 11 times
FAF User Name: Jip

Re: New models for map creation

Postby Franck83 » 01 Feb 2018, 19:16

Yes easy to do by a mod : YourModName/Props

What would be cool is when we download the map from client, it downloads and installs the mod (same name than the map).

And we choose the map in the lobby, it activates le mod.


Another way is creating a custom map rep where all maps add their ressources (/mods/CustomMapRessources)

And then modding blueprints.lua to look for props, textures or so on... at game launch.
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: New models for map creation

Postby ozonex » 01 Feb 2018, 22:02

Canyon SC2 is broken because path to files is
maps/Canyon SC2/sc2_mp_102_rock03x2048_albedo.dds

where map folder name is:
Canyon SC2.v0001

Changing that path to proper one fixed textures.

I also know we can have custom decals. They are for example in map Adaptive Theta Passage.

I'm now fighting with props, but they are not displayed and there are no errors loading map :( Should there be any errors/warnings when game cant find prop? Maybe you are right and its not possible to make custom props for maps, but making them as a mod is still a bad idea. Nobody will remember to play this map only with a mod. And what you will display them if they will play map without that mod?
FAF Map Editor Alpha v0.605 > Get it now!
User avatar
ozonex
Priest
 
Posts: 358
Joined: 16 Feb 2012, 20:11
Location: Poland
Has liked: 197 times
Been liked: 263 times
FAF User Name: ozonex

Re: New models for map creation

Postby Franck83 » 01 Feb 2018, 22:07

Nobody will remember to play this map only with a mod. And what you will display them if they will play map without that mod?


There is a solution. Making a unique custom map props rep for all custom maps. Then we mod blueprints.lua to load any props here.

We just need to install theses props in the rep at map download.

Unless there is still the solution to add at FAF ressources (need to wait to next FAF patch).
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: New models for map creation

Postby Jip » 01 Feb 2018, 22:52

ozonex wrote:Canyon SC2 is broken because path to files is
maps/Canyon SC2/sc2_mp_102_rock03x2048_albedo.dds

where map folder name is:
Canyon SC2.v0001

Changing that path to proper one fixed textures.

I also know we can have custom decals. They are for example in map Adaptive Theta Passage.

I'm now fighting with props, but they are not displayed and there are no errors loading map :( Should there be any errors/warnings when game cant find prop?

They are simply not being loaded. As you mentioned in another post (which I cannot find right now), decals and textures work different. They do not have any blueprint data. If you look at the code taken from blueprint.lua in my post - this is the function that loads in the blueprints. No blueprints are loaded in from any map - only from the .scd files that are known and given before the game starts, or from mods.

ozonex wrote:Maybe you are right and its not possible to make custom props for maps, but making them as a mod is still a bad idea. Nobody will remember to play this map only with a mod.

It is indeed a very bad idea to do it through mods. Not neccesarily because people will forget to turn them on, but because it's quite tricky to do with the paths. As I mentioned in my post, the path will always start with either (exclusive either) mods/ or env/. Which means you can either not see the mods in the editor, or not in game. On top of that, the official editor does not allow to load in props that have an invalid (read: non existent) blueprint file.

ozonex wrote: And what you will display them if they will play map without that mod?

It displays nothing and is not functional - the blueprints do not exist and hence, there's nothing there.

One solution would be to make a FaF environment package that would add in tons of new props - just anything remotely useful we can find / create. Then, you can let everyone download that .scd through the FaF client, as some kind of update or patch. This is the safest approach.

Or, an update of the LoadBlueprint function that accepts another argument (and is fed this argument too, when selecting a map): the path to the map folder. Then add in the part where it searches through those folders too. That would work too and make it local - allowing any props in.
Jip
Avatar-of-War
 
Posts: 51
Joined: 12 Jul 2015, 22:25
Has liked: 3 times
Been liked: 11 times
FAF User Name: Jip

Re: New models for map creation

Postby ozonex » 01 Feb 2018, 23:05

Jip wrote:Or, an update of the LoadBlueprint function that accepts another argument (and is fed this argument too, when selecting a map): the path to the map folder. Then add in the part where it searches through those folders too. That would work too and make it local - allowing any props in.


We just tested that with Speed2 and it worked. But as Speed2 mentioned: "it would allow to sneak in any bp, including unit bp and that could be abused"
FAF Map Editor Alpha v0.605 > Get it now!
User avatar
ozonex
Priest
 
Posts: 358
Joined: 16 Feb 2012, 20:11
Location: Poland
Has liked: 197 times
Been liked: 263 times
FAF User Name: ozonex

PreviousNext

Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest