Author Topic: NWNCX - texture swapping  (Read 786 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
NWNCX - texture swapping
« on: August 13, 2015, 09:19:05 pm »


               

I was looking at the seasonal variations that people make for tilesets and irritated by how many resources it requires when I wondered if NWNCX could just handle this kind of texture swapping.


 


Would it be possible to enable an artist to generate seasonal variations of textures for a tileset, follow a simple naming convention, and through NWNCX swap the seasonal variants in play?


 


Basically what I am asking for is the ability to tell the client to use texture B in place of A, and then at some other time tell the client to switch back from B to A. The server would need to communicate this to the client, and I suspect that the setting of local variables on the module is the way this is directed. Given that a tileset has lots of textures, I think we would need matching pairs of data in lists: column A of the list containing the names of the original textures, and column B containing the names of the replacing textures.


 


Anyway, its a rough thought and we might already have the ability to do this, but I am ignorant of it.


 


I was looking at the thread about NWNCX VFX stuff, and became hopeful for the feature of texture swapping to be more broadly applied.



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #1 on: August 13, 2015, 10:19:19 pm »


               

Can NWNCX access the override folder? If so maybe you could setup multiple override folders and have NWNCX swap them in and out as needed. If this were possible then all the variant textures could be removed from the hak and placed into override folders.



               
               

               
            

Legacy_niv

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #2 on: August 24, 2015, 05:25:30 pm »


               


Would it be possible to enable an artist to generate seasonal variations of textures for a tileset, follow a simple naming convention, and through NWNCX swap the seasonal variants in play?


 


Anyway, its a rough thought and we might already have the ability to do this, but I am ignorant of it.


 




 


I was looking into this in the past, and it shouldn't be too complicated, especially if all you want is replace textures on a global basis (ttf01_grass -> something else). You could do this before entering a new area, for example.


I've been meaning to try and swap textures on a individual tile basis, but that is a tiny bit more work in figuring out.


 


To send the actual mapping table to clients I have some work laid down as well (specifically, addons to nwn©x_connect to send arbitary commands/messages from either end). This isn't upstream yet though.


               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #3 on: August 24, 2015, 10:17:49 pm »


               

That sounds promising, Niv.


 


It would be great if this gets worked out, and then we could get some artists on board to work on conventions with texture names for seasonal variants.



               
               

               
            

Legacy_niv

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #4 on: August 24, 2015, 11:34:37 pm »


               


That sounds promising, Niv.


 


It would be great if this gets worked out, and then we could get some artists on board to work on conventions with texture names for seasonal variants.




 


I'll look into it one of these days. '<img'> You might want to pokeremind on IRC though sometime, lest I'll forget.


 


Not sure if a naming scheme is even neccessary, but after further thought it makes a lot of sense to have this automated in addition to server-specified overrides.



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #5 on: August 25, 2015, 04:15:30 am »


               

Automated? This is something that I'd like to be able to do with scripting. If an area goes from fall to winter I'd like the textures to change. I'd handle this in onEnter and OnExit scripts.


 


Would also be handy just to change one texture here and there in response to a player action, and make a list for the area so that it is also included in onEnter and onExit.


 


 


Basically I see that you'd have a list of replacement textures within an area. These would be setup for the client on enter, and reverted back to normal onexit.



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #6 on: August 25, 2015, 09:14:59 pm »


               

Since the textures would be global is on area enter really the right place? That seems like it could have odd effects. I suppose if there is only one area that uses those textures it would be fine (or one temperature zone etc). Or single player module...


 


But that said, it could be a good way to do seasons. I gave up trying to make areas that were the same with the different seasons. I have a hard enough time getting the area to look good once '<img'>


               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #7 on: August 26, 2015, 04:02:41 am »


               

thats why it should be areaenter and exit. you don't want a global change to carry over to areas that you didn't want that look in.


 


this limits the seasonal changes to the areas that you want a particular seasonal variant active in. the textures jump back to default on exit.



               
               

               
            

Legacy_niv

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #8 on: August 26, 2015, 12:01:15 pm »


               


Automated? This is something that I'd like to be able to do with scripting. If an area goes from fall to winter I'd like the textures to change. I'd handle this in onEnter and OnExit scripts.




 


This I thought would be for singleplayer mods. I was thinking of having tileset creators provide a extra mapping file that NWNCX reads, and then simply switches out textures depending on the ingame calendar. Optionally overridable with NWNCX calls (or simply localvars on areas).


 


 



Since the textures would be global is on area enter really the right place? That seems like it could have odd effects. I suppose if there is only one area that uses those textures it would be fine (or one temperature zone etc). Or single player module...




 


Textures are global, yeah, but they are requested by resman each time they are loaded into memory. I haven't had a look at the clientside parts of it yet, only server, but naively thinking that should be enough to simply provide a different backing res each time a area loads.


 


Swapping textures based on player actions however is more work, since that involves purging the res and then reloading the model(s).


               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #9 on: August 26, 2015, 02:33:43 pm »


               

Yeah, fair enough.  To the client, where it matters for this, it is essentially single player.  Do we know that it unloads all the textures for an are on exit (or on load of the next area or whatever).  I haven't wrapped my head around nwncx yet since there is no linux version for me to use on my normal system.


 


It could still lead to trouble. Consider the following:


 


player 1 enters area on Sept 22 - server pushes nice summer textures (or list that specifies such)


player 1 camps overnight


player 2 enters same area on Sept 23 - server pushes fall textures


player 2 says to player 1 "look at this lovely fall foliage!"


player 1 says "huh? You're crazy!" (and PVP ensues...)


               
               

               
            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #10 on: August 26, 2015, 03:32:01 pm »


               

player 2 says to player 1 "look at this lovely fall foliage!"

player 1 says "huh? You're crazy!" (and PVP ensues...)




 


I better don't play on persistent worlds if people there are in the habit of killing everyone that's crazy. '<img'>


               
               

               
            

Legacy_niv

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #11 on: August 26, 2015, 03:50:05 pm »


               


Yeah, fair enough.  To the client, where it matters for this, it is essentially single player.  Do we know that it unloads all the textures for an are on exit (or on load of the next area or whatever).  I haven't wrapped my head around nwncx yet since there is no linux version for me to use on my normal system.


 


It could still lead to trouble. Consider the following:


 




 


At this point I'd just force all players in the area to reload it. '<img'>


 


But first I'll have to check the actual Resman impl. to see what's feasible. Don't want to make any promises.


               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #12 on: August 26, 2015, 04:50:20 pm »


               


I better don't play on persistent worlds if people there are in the habit of killing everyone that's crazy. '<img'>




 


Not me... I just go after the trolls.


 


But I left out: player 2 says "Who you callin' crazy, you pointy-eared ^!@%#!"   and _then_ PVP ensues...


 


I just liked the image of two heavily armed adventurers coming to blows over leaf peeping '<img'>


               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
NWNCX - texture swapping
« Reply #13 on: August 26, 2015, 11:35:37 pm »


               

That's why you break out this mod.


Player 1: "What if the passage of time is just, like, an illusion, man?"


Player 2: "Whoa, dude. That's deep."