DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[Help]Creating wall texture pages on-the-fly
Page 1 of 2 Goto page 1, 2  Next
DieHard Wolfers Forum Index -> DieHard Archives View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
This forum is locked: you cannot post, reply to, or edit topics.This topic is locked: you cannot edit posts or make replies.
Author Message
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Tue Nov 16, 2004 2:02 pm
   Subject: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Hello,

I've been working on an idea and reached a point where someone with far more C experience than I is needed.
I'd like to be able to create wall texture pages in code.
The purpose for this is that I want to be able to combine two wall textures into one without affecting either of the starting textures.
I think that the ability to create a new memory page for this combined wall is necessary.

Any help would be appreciated.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Tue Nov 16, 2004 2:33 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

For all intents and purposes... you should be fine if you mean to use it for a ceiling/floor texture... you would need to create a small array large enough for the 64x64 graphic (probably byte type as that would accomodate each colour 0 to 255)... and then place your graphics into it... or at least the portions you wanted...

ie: from drawtexture (the ceiling and floor routines)... you tell it what texture to use.. it grabs it.. and draws... in this case you would have to tell it 2 textures... combine the 2 as you require in the array... and then tell it to use that.

I can't see any problem with grabbing graphics that way... to use this modified graphic for a wall is going to require a lot more code changes.. Much more playing with the raycastor and the HitVert/HitHorz Wall routines . You will need some type of modifier to tell it that it should use a combined graphic... but then telling it what graphic to use will be the difficult part... Essentially, with this you are probably going to need the 3rd map plane....

ie:
  
Plane 0 holds the first texture....
  
Plane 1 holds the modifier toggle - if toggle then mix graphic
  
Plane 3 holds the second texture value....

Then it gets even more difficult as how do you pass varrying combinations.... like top is 25% of graphic 1... and 75% graphic 2... and next time it's 50/50.... This might be done with some type of array... ie: graphic 1 + graphic 7 = this ratio.... graphic 1 + graphic 10 = different ratio... and so on... Then pass your new graphic to the proper place holder:

ie:
Instead of *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);

It would be something like:
if (plane1) *( ((unsigned *)&postsource)+1) = YourGraphicCreatorRoutine(valueplane0,valueplane3);
else *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);


So... for a ceiling/floor... No problem... but for walls... well... still possible, but with greater code modifications.

Greg
BrotherTank

PS: Mind if I ask what you are planning or trying to do?
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Tue Nov 16, 2004 3:37 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, the wall combination part is taken care of already. (Use the high byte for the combined wall texture: 0x0201 = the 2nd patch texture on the first wall texture)

It's just the method of storing the combined wall textures in memory. I guess I'll have to make an array of byte arrays and point HitVert/HorizWall to that.

I'm hoping to add the ability to have wall-patch modifiers.
ie: Take the normal Gray brick, tell it to add the hitler pic. Voila, new texture.
This will allow the re-use of wall decorations and reduce wall redundancy. I think this will also allow you to work around the 64 wall limit. You can make 64 base walls with 255 wall patches available for each base wall.

The wall decorations are stored in separate chunks (right before the doors) and use the transparency color as expected. I suppose the decoration could be a whole new wall and extra walls could be added like that if one would want to do that.

Maybe I'm off my rocker - or a few fries short (for the McD's fans out there) - but I think this could be cool and useful.

Hope I'm clear enough.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Raistlin
DieHard Guard
DieHard Guard


Joined: 22 Apr 2003
Last Visit: 18 Oct 2006

Topics: 24
Posts: 246

blank.gif

PostPosted: Tue Nov 16, 2004 4:02 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hmmm....
So, as with the build engine, you could put any wall
decoration on any wall base?

This would be very useful......I've often bemoaned the fact that
I didn't know how to do it.

One thing that might be interesting, is if you could make it so
that it could also draw sprites on the walls?

_________________
As I watched him on T.v, somehow it really bothered me...
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Tue Nov 16, 2004 4:17 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Oooh... ok... I see...

Yes, that is a very neat idea.... And I think I can make the programming of that much simpler then. For that I would use sprites to hold the images for signs, wall tapestries, pictures...etc.. and then you can get away with using only two map planes... For most of the editors out there though it requires the "place floor code - place obj modifier - then place wall tile" order to put things properly on the map, as most don't allow you to place sprite over a wall tile... Anyhow...

To code it... would be rather simple then.... during each scan of the HitVertWall and HitHorzWall routines... I would have it do something like:

if (MAPSPOT(x,y,1) >= firstwallgraphicmodifier && MAPSPOT(x,y,1) <= lastwallgraphicmodifier)
  
*( ((unsigned *)&postsource)+1) = ProcessCombinedWall (MAPSPOT(x,y,0),MAPSPOT(x,y,1))
else
  
*( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);


You might have to do some fudging... ie... take out the check to see if the texture is already used or modify the check to include if (sprite in wall) then get new texture... rather than use that cached in memory...

But yes... Highly possible... and would open all kinds of possibilities....

Looking forward to seeing this one make it to tutorial... I really thing this would make a great addition to WolfPlus... and my other projects....

Greg
BrotherTank
ChiefRebelAngel
DieHard SS
DieHard SS


Joined: 27 Jul 2004
Last Visit: 09 Jan 2010

Topics: 28
Posts: 485
Location: Northern Darkness
blank.gif

PostPosted: Tue Nov 16, 2004 4:41 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

This is one of the most interesting ideas I've seen yet. With permission, I would love to use such a feature for Helvete. This would make life much much easier!

Good F***'in thinking!!!! Shocked
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Tue Nov 16, 2004 5:28 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks. I think it'll make some things easier to handle.
Now, that ProcessCombinedWall () part is the trick. I know about 2% of C memory management.
I assume I need to somehow memory for this new texture, draw it, and then unlock it. Correct? Or is there an easy way to make and return a byte array?

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Tue Nov 16, 2004 6:54 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Adam...

Take a look at Ripper's Cloudy Sky... That sets a page of memory (much larger that what you need) for the skyc or sky texture... You only need 4096 bytes... but the rest should just fall into place once you see his code... Smile

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Tue Nov 16, 2004 9:43 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@ChiefRebelAngel: Of course you'll be able to use it, if I can get it written.

@BrotherTank: Thanks, I'm looking into it, it looks like I'm having trouble passing the array to *( ((unsigned *)&postsource)+1) because I'm getting tutti frutti when I run it.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 4:09 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ah... ok....

If you defined the array outside the new routine... then it would end up something like this:

if (MAPSPOT(x,y,1) >= firstwallgraphicmodifier && MAPSPOT(x,y,1) <= lastwallgraphicmodifier)
{
  
ProcessCombinedWall (MAPSPOT(x,y,0),MAPSPOT(x,y,1)) ;
  
*( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(nameofarray);
}
else
  
*( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);


For the ProcessCombinedWall:

it would be something like:

byte far nameofarray[4096];

void ProcessCombinedWall (int First_Tex, int Overlay_Tex)
{

byte far overlay[4096];

nameofarray=PM_GetPage(First_Tex);
overlay = PM_GetSprite(Overlay_Tex);

Then code to combine the two in nameofarray...

}

Or something along those lines... Hope that helps...

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Nov 17, 2004 5:48 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

BrotherTank wrote:
  
*( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(nameofarray);

I can pass nameofarray into PM_GetPage? !@#$%^&* I think I'll slap myself silly if this works.

EDIT: It didn't Type mismatch for the parameter. Should be int, but I get the feeling that if I pass (int)nameofarray, it won't work. Sad
It compiled with (int), but I need to test it.

EDIT 2: It works!! And as far as I can tell, there was no drop in FPS, which is good.
::: CODE :::
*( ((unsigned *)&postsource)+1) = (unsigned)(memptr)patchedwall;

Was the magic pass phrase (where patchedwall is nameofarray).

OK, now on to how the best way it'll be used. The only things I see against using sprites is 1) one would also have to set up an object for the patch texture, taking a bit more memory and a bit more code and 2) I'd have to do a bit more coding to interpret the sprite page (not a big deal since it's already in there). Having the special patch wall spots could be a pain too, since they are a new beast.

Opinions?

EDIT 3: OK, It has some bugs yet. Mainly disappearing/changing wall textures when at different angles. BTW, ignore the FPS count.. DOSBox mucks with it and makes it very low. It's a constant 70 on my machine.
Correct:

Weird:

This wall should be gray stone, not a hitler pic wall.


Here's the Applypatch function, if anyone can find a problem:


Sorry this doesn't use sprite frames yet. I started with the wall patch idea, so I kept going with it. Converting it to sprites shouldn't be too hard.
And in the HitVert/HorizWall functions, I do:

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page


Last edited by Adam Biser on Thu Nov 18, 2004 2:00 pm; edited 1 time in total
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 8:29 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Very good Adam....

I think the problem the code is having is based on what I mentioned previously... Ie, is it the same texture as last time drawn.

That value is checked in the:

if (lastside==1 && lastintercept == xtile && lasttilehit == tilehit)
{

in both the HitVertWall and HitHorzWall routines. So basically, you have to do a little tweaking to the if statement... First... Make sure you have modified your source to include at least this portion of my 64+ code... So somewhere above HitVert place this routine:

::: CODE :::


int CheckAdjacentTile (int   x,   int y)
{   //   Part of 64+   Wall Tiles - Make   sure within   Map Boundaries
   //   to   fix bug of not   allowing   64+ in outer edge   of   map
   //   Checks Adjacent Tile   for Bit 7 Set - Door   or   Pushwall
   if   ((y-1   >=   0)   &&   (tilemap[x][y-1] & 0x80)
   ||   (y+1 <= 63)   &&   (tilemap[x][y+1] & 0x80)
   ||   (x-1 >= 0) && (tilemap[x-1][y] &   0x80)
   ||   (x+1 <= 63)   &&   (tilemap[x+1][y] & 0x80))
    return 1;
   else
    return 0;
}


So that you can add "&& !CheckAdjacentTile(xtile,ytile)" into the "if (lastside==1 && lastintercept == xtile && lasttilehit == tilehit)" line in both the HitVert and HitHorz Wall routines.
ie: the lines become:

if (lastside==1 && lastintercept == xtile && lasttilehit == tilehit && !CheckAdjacentTile(xtile,ytile))

This alone will fix the door bug problem.... ie put 2 doors... 1 north and 1 east in the same corner of any room... then open one of the doors... Without the above fix, it will make the door sides on the open door disappear on the side nearest the closed door..

Anyhow... That is also the line where you are going to have to have it make it's check to see if the previously drawn tile was a "combined grahpic".... or you will have to change the line:

lastintercept = xtile; // (and the proper one in the HitHorzWall routine)

So that should you be using some kind of combined grahpic it sets lastintercept to some unknown wall value. That is the trick... So if it see's your flag on the sprite plane of the map... it should set "lastintercept" to some unused number like 999... (as there are nowhere near that many textures). ie:

if (MAPSPOT(x,y,1)=combinedgrahpic value) lastintercept = 999; else lastintercept = xtile;

Doing that will have it always grab the new texture if it previously drew a combined graphic and should eliminate your bug problem...

Hope that helps...

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Nov 17, 2004 8:49 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@BrotherTank: The bug is still there with those changes. The FPS drops to 20 with the four walls.
I can't have it always creating the combined texture. It needs to have a more elabotate storage, which I *think* I can handle.
I'll just create an array of about 20 byte arrays, each having an ID that can be checked to see if the wall needs to be created an all that. That might help the FPS, but the purple wall bug is a more difficult problem, I think.

It acts as though it passes the wrong wallpic to ApplyPatch or something.

By the way, In WL_Game.C, I added the red line, so that only the lower byte was read when seting up walls.
::: CODE :::
         tile = *map++;
         tile &= 0x00ff;  // ADDED
         if (tile<AREATILE)
         {
         // solid wall
            tilemap[x][y] = tile;
            (unsigned)actorat[x][y] = tile;
         }


Other than that, no other code changes.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 8:57 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Give me a few mins.. and I'll have the answer for you... Smile I see where part of the problem is... Smile ie the drop in framerate...


Greg
BrotherTank
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 9:13 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ok... assuming you are using just 2 patches...

we can assign say objdata id 500 01f4 in hex... as the first modifier... for patch 1
and 501 or 01f5 as the modifier identifier for patch 2 - Both of these go into the Sprite or Object data... So now it's place floor tile value on map... apply patch number onto floor tile... then place walltile to be patched on the spot on the map requiring it.

Now above your routine "ApplyPatch" we have:

::: CODE :::

byte far patchedwall[4096];
#define PATCHSTART PMSpriteStart-8-NUMPATCHES
#define NUMPATCHES 2

void ApplyPatch(int wallpic, int patchpic)
{
   byte   far *scan;
   byte   far *pscan;
   int    pixel;
   unsigned spot;

   // This works, but the patch gets overwritten.
   spot = patchpic - 500 // 500 being first defined patch
   if (spot >= NUMPATCHES) Quit ("ApplyPatch: Invalid patch number!");

   scan = PM_GetPage(wallpic);
   pscan = PM_GetPage(PATCHSTART+spot);
   
   for (pixel=0; pixel< 4096; pixel++,pscan++,scan++)
   {
     if (*pscan < 255)
        patchedwall[pixel] = *pscan;
     else
        patchedwall[pixel] = *scan;
   }
}


in Hit Vert Wall
::: CODE :::


    if (MAPSPOT(xtile,ytile,1)>= 500 && MAPSPOT(xtile,ytile,1)<= 500 + NUMPATCHES)
    {
          ApplyPatch(wallpic, MAPSPOT(xtile,ytile,1));
          *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(patchedwall);
     }
     else
          *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);


Then change the line:

lasttilehit = xtile to:
::: CODE :::

if (MAPSPOT(xtile,ytile,1) >= 500) lasttilehit = 999; else lastilehit = xtile;


What this will do is only have it combine and create a graphic on the fly when the modifier is set on that graphic... else... it will just grab the original wallpic. This will reduce overhead and should bring back your framerate... Of course, the more patched walls the slower the framerate... but it shouldn't affect it that much on faster machines.

Hope that helps...

Greg
BrotherTank

Edited: slightly to fix ApplyPatch routine to void and change the call to get the returned graphic...
andy3012
DieHard Guard
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008

Topics: 29
Posts: 292
Location: England
uk.gif

PostPosted: Wed Nov 17, 2004 10:04 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

This is a really kool idea, perhaps when you guys have finnished fixing it, you would supply a tutorial? Does this also mean that walls can have transparent colours aswell...?
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Nov 17, 2004 10:11 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@BrotherTank: OK, I see how the sprite graphics can be more easily used now. Thanks.
However, your ApplyPatch is essentially the same as mine - except for using sprites.
But I think that PM_GetPage returns the compressed sprite data, so that would also have to be interpretted.

As for HitVert/HorizWall: patchedwall can't just be passed into PM_GetPage because it expects (int).
The drop in FPS is due to the wall(s) be re-created every frame (since one memory location is being reused for all the walls).
I've not tried this code, but I don't see the difference that will fix the problem. Sorry, maybe I'm just missing something.

@andy3012: Yes, there will be a tutorial made, but no wall transparency... closest thing for that is a directional sprite.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 10:34 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ok Adam,....

Here's the differences...

In your code, you were calling the ApplyPatch everytime it saw a new wall... What this does is weigh down the raycastor as you were using:
::: CODE :::

   if (ApplyPatch(xtile,ytile,wallpic))
         *( ((unsigned *)&postsource)+1) = (unsigned)(memptr)patchedwall;
      else
         *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);

And I am telling it:
::: CODE :::

    if(MAPSPOT(xtile,ytile,1) >= 500)  // If the sprite plane holds a value of 500+
    {
         ApplyPatch (wallpic,MAPSPOT(xtile,ytile,1)) // Sending it wallpic and value of the sprite plane
         lasttilehit = 999;  // this allows for different patches to be side by side or same patch
         *( ((unsigned *)&postsource)+1) = (unsigned)(memptr)patchedwall;  // new combined texture
     }
     else
         *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);


By telling it to only Apply the patch if the location MAPSPOT(xtile,ytile,1) >= 500 that will stop it from generating the graphic each time, or at least trying to, and then returning a value of true or false.. This should greatly reduce the overhead on the raycastor... and if you assign lasttilehit the higher value there, then you would save a few bytes because of less code (no need to look for the same if condition twice).

Effectively what I have done is said get the base image from the mapplane 0... from wallpic... and then get the modifier page from the sprite mapplane 1. And only do any of that if the mapplane 1 is a value of 500 or more.

I'm just testing it here... but I've had to modify the code slightly because I am using a different engine now.. but technically, it's still as I have posted... And it doesn't seem to have a problem so far...

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Nov 17, 2004 10:43 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

So moving the if statement I had inside ApplyPatch to HitVert/HorizWall fixes the bug?

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 10:52 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I don't have Apply Patch returning any value... I am telling it that I have 2 patch graphics and if it sees 500 or 501 on the map to grab either graphic 0 or 1 to apply to the wallpic passed. My graphics are stored as yours are in the vswap (above the walls and below the doors)....

Just doing the testing now... But between my cat wanting to help... and chatting with others... lol.. it's taken longer to know for sure... Hopefully have an answer shortly...

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Nov 17, 2004 10:57 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, I tried yours and still get the FPS drop and purple wall bug.

Setting lasttilehit = 999; causes the wall to be recreated each frame in both of our code. That causes the FPS to drop since your ApplyPatch proc will always be called when the wall is to be drawn as well.
See what I mean?

Purple walls, I don't know why.

EDIT: Purple walls are happening because the wallpic's page is getting overwritten. So maybe I've mucked something up somewhere with my testing, I'll try a fresh copy.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 11:30 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yep.. same major FPS drop here as well... but only when looking at the affected tiles... great idea... but I'm not sure how many graphics one could page into memory... To be honest... it's almost better to use WSJ's offset code to just grab from the next set of wall pages... let the game handle which pages it needs...

I didn't have the purple variance though... so not sure what was happening at your end. I do have 1 graphic though that only shows when you face a specific angle...

I still think it's a great idea... but what is needed is 2 fold... an area of memory to hold the images once they have been created and assigning a specific value to each... and secondly... to somehow have it be flexible (maybe an outside configuration file)... telling it which graphics to combine and the value to get each one from memory...

Not to sure on what to do there... So... Got me stumped... Great Idea... but not sure where to take it next...

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Nov 17, 2004 11:32 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Do you get the purple walls too?

Try getting rid of the lasttilehit = 999 lines... I notice no difference with or without it, except the FPS stays at 70 without it.

EDIT: Right now I'm not worried about the FPS as much as the purple wall bug.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 11:46 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Adam Biser wrote:
Do you get the purple walls too?

Try getting rid of the lasttilehit = 999 lines... I notice no difference with or without it, except the FPS stays at 70 without it.

EDIT: Right now I'm not worried about the FPS as much as the purple wall bug.


Hmm... I'm not getting the purplewall bug... but I do see reduced FPS... I'll try removing the lasttilehit=999 and see if that helps with the speed...

Greg
BrotherTank
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 11:58 am
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ok.... The speed is back, except that now without the lasttilehit == 999 all the walls on that side (with or without the modifier) are all the same as the first modified wall.... The more I look at the code.. the more I'm beginning to believe that this might not be workable... at least not until we have 5Ghz machines... lol...

I have also noticed that when I did something like MergedWall Wall MergedWall2 (corner turning 90 degrees inward to make an inside L) and then had WALL MergedWall3 Wall... and so on... the Merged wall 1 was right... the merged wall 3 was right ... the merged wall 2 only showed when viewing it from strange angles.... otherwise it just showed the original background image...

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Nov 17, 2004 12:07 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@BrotherTank: Yeah, I'm starting to give up as well, but I'm still going to toy with it I think it could be done... somehow. I don't get the repeated wall pattern. Everything on mine shows up as expected, except for the purple walls at some angles.

My test map is based on e1m1, and standing on the other side of the door at the end of the hall (not a cell door) and looking south at the added walls does some funky stuff. When the door is all the way open, they're purple. When it gets about halfway open/shut though, they correct themselves.

Strange. I tested all values when the purple wall occurs, and they're good. However, when this happens right after "scan = PM_GetPage(wallpic); "
*scan will be 255, meaning the original wall's page has been altered, but using the ALT-Tdebug codes, the wall appears correctly in the box (still wrong in the game) though.

EDIT: Upon further testing I find that (scan == pscan) when the wall purple. So the pointer starts to point at the wall patch for some reason.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 12:24 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yep... Same as mine Adam... E1M1... the wall that the guards back is against I put two different merged textures... 1 in one corner... then a space... then the second in the other corner... Then on the wall on the right... it's 1 regular wall in the corner and then the third merged texture wall...

Without the lasttilehit=999 all the walls behind the guard go to merged texture 1... With the =999 then I get proper merged... regular wall... regular wall (unless I hit the right angle and then it shows merged 2)... and on the righthand wall I get the merged 3... The FPS drops drastically with the 999, but it is needed so that you don't have the whole wall as the same first merged texture..

I may do some more tinkering as well... but unless you want to store them in memory, assigning them page values for each combintation, and then also having some way to define which textures will merge with which graphics....

I don't think this idea will fly... It partially works... but the loss in FPS is just too drastic to make it usable...

Greg
BrotherTank
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 17 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Wed Nov 17, 2004 12:39 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

What a feature! I think I'll add it to Wolf3D Fully Featured!!!
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 16 Oct 2017

Topics: 46
Posts: 2291
Location: USA
usa.gif

PostPosted: Wed Nov 17, 2004 12:56 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@TexZK: Yes, but can you make it work 1) without the FPS slowdown and 2) without the purple wall bug that I seem to be getting?

EDIT: OK, I got mine working. No more purple wall.
The problem? I called the PM_GetPages right after each other. I seem to remember that the floor/ceiling textures would do this at times too, but I can't find the post.

I changed some stuff around and came up with this code (All in WL_DRAW.C right above HitVertWall):

* CODE REMOVED DUE TO INCOMPLETENESS *

EDIT 2: Also note that you shouldn't try this in anything you plan on releasing yet as this code is rough and liable to changes as well as incomplete.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page


Last edited by Adam Biser on Wed Nov 17, 2004 6:22 pm; edited 1 time in total
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Nov 17, 2004 4:27 pm
   Subject: Re: [Help]Creating wall texture pages on-the-fly
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

@Tek-ZK:

This isn't working... If you have figured out a solution to it, please post it here. If you haven't fixed the problem which Adam and I have been trying to fix, then please don't install it as it is a speed killer. The problem is, in order for it to display different merged graphics or a merged graphic and a wall of the same base - side by side, you must change the value of lasttilehit. When you do that the FPS rate bottoms out. Also there is a bug in viewing it. Based on the angle that you look at certain walls, the graphic will change.


@Adam:

Yep... That is a problem when trying to grab two graphic pages that aren't sequential. That is why most suggest that if you want to use completely seperate textures for floor and ceiling that you break the routine into seperate parts. If you grab texture and texture + 1 ... it never happens.

As for this routine.... I've tried a few more variations, but it still has the angle bug and/or the fps bug. While I think this is a great idea... I'm not sure how to go about keeping the raycastor at a decent FPS and get rid of the view angle bug as well.

Greg
BrotherTank
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.This topic is locked: you cannot edit posts or make replies. Time synchronized with the forum server time
DieHard Wolfers Forum Index -> DieHard Archives View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 2 Goto page 1, 2  Next
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts New Pallette Help Please!!!
Author: JackaL
8 2753 Wed Oct 27, 2004 7:47 am
Adam Biser View latest post
No new posts Creating new doors
Author: Guest
1 136 Sat Oct 09, 2004 4:30 pm
MCS View latest post
No new posts Help adding walls in SOD
Author: Guest
2 146 Sun Aug 15, 2004 3:04 pm
Guest View latest post
No new posts [Help] Activate Debugging Mode
Author: Aryan_expirement
13 4018 Tue Dec 09, 2003 4:28 am
Loki View latest post
No new posts [Help] Adding 64+ walls?
Author: Reivax44
6 2737 Tue Jun 03, 2003 1:24 pm
Ripper View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group