Thread Tools Display Modes
05-06-15, 07:18 PM   #1
Digital_Utopia
A Flamescale Wyrmkin
 
Digital_Utopia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 110
My Next Addon

http://i.imgur.com/Gv339aQ.png

Wolfenstein 3-D

The screenshot itself is from a raycaster test I did a ways back - nice enough performance, but the original Wolf source code had a lot of assembly in it - something I know nothing of. But then, the other day - I noticed that they released the "source" to their javascript browser port (probably a while ago I guess, no HTML5 in sight). Now, that is something I can work with.

Amusing thing is, their "draw" for that port, is all DoM based - easily replicable with Frames and Textures, with probably a lot better performance.
__________________
  Reply With Quote
05-07-15, 11:08 AM   #2
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
How can you transform textures like that?
  Reply With Quote
05-07-15, 11:52 AM   #3
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.

  Reply With Quote
05-07-15, 12:46 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
You could use trapezoid-shaped texcoords to do the same thing. That would use one texture for Semlar's example instead of anywhere between a few dozen to hundreds depending on the size of the output.

Code:
texture:SetTexCoord(ULx,ULy,LLx,LLy,URx,URy,LRx,LRy)
http://wow.gamepedia.com/API_Texture_SetTexCoord

This is the function we had to use to rotate textures before they gave us texture:SetRotation() and the animation system.



Edit: Nevermind. Although it would work good in theory, the graphics engine doesn't quite support this.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-07-15 at 01:57 PM.
  Reply With Quote
05-07-15, 12:50 PM   #5
Digital_Utopia
A Flamescale Wyrmkin
 
Digital_Utopia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 110
Originally Posted by semlar View Post
By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.

Exactly. In this case it's every vertical line, but the technique is the same. Since there can only be one wall per line, you just have to take the appropriate wall texture, and use texcoords to get the appropriate horizontal section you want to display.

In the case of multiple textures per vertical line (i.e. Doom), you'd have to have a separate line for each wall/ceiling/floor texture.
__________________
  Reply With Quote
05-07-15, 01:08 PM   #6
Digital_Utopia
A Flamescale Wyrmkin
 
Digital_Utopia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 110
Originally Posted by SDPhantom View Post
You could use trapezoid-shaped texcoords to do the same thing. That would use one texture for Semlar's example instead of anywhere between a few dozen to hundreds depending on the size of the output.

Code:
texture:SetTexCoord(ULx,ULy,LLx,LLy,URx,URy,LRx,LRy)
http://wow.gamepedia.com/API_Texture_SetTexCoord

This is the function we had to use to rotate textures before they gave us texture:SetRotation() and the animation system.
That's certainly an option as well. In that case, the first and the last hits for a particular wall, as well as which point(s) along the wall were hit, and with the distance, you could use texcoords to draw the visible portion of the wall at once.

I'll probably go over it again, once the porting is complete.
__________________
  Reply With Quote
05-07-15, 01:23 PM   #7
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by SDPhantom View Post
You could use trapezoid-shaped texcoords to do the same thing.
No, you can't produce the same transformations using SetTexCoord on a single texture.

You can see why from this post - http://wowinterface.com/forums/showp...73&postcount=2

Last edited by semlar : 05-07-15 at 01:37 PM.
  Reply With Quote
05-07-15, 02:02 PM   #8
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
I forgot I came across that before a while ago. I did a bunch of testing following up my previous post and it's because of how the game engine draws textures. The game draws them internally as 2 triangles positioned top-left and bottom-right. Each triangle uses 3 points from the texcoords to render the image.

I'll just bring this image back from the other post...


In this example, the bottom 2 texcoord points were widened past the bounds of the image. The bottom-right triangle stretched properly while the top-left one merely skewed the image. I'm assuming if the top points were widened instead, the situation would be reversed.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-07-15 at 02:33 PM.
  Reply With Quote
05-07-15, 03:51 PM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by semlar View Post
By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.

So you draw a different version of the same texture for every vertical line? And how does that transition looks like line by line?
  Reply With Quote
05-07-15, 07:57 PM   #10
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Originally Posted by semlar View Post
By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.
Oh man, you can't show us this gif without uploading the addon for it
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
05-07-15, 07:57 PM   #11
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by Resike View Post
So you draw a different version of the same texture for every vertical line? And how does that transition looks like line by line?
I suppose he's taking 2 points and using SetTexCoord to take a proposed line of pixels. My guess is the internal line thickness would always be 1 pixel even if you reuse the points between UL/LL and UR/LR respectively.



Originally Posted by Tonyleila View Post
Oh man, you can't show us this gif without uploading the addon for it
It doesn't look that hard to make a library for. I've done a lot of vector calculations in some of my experimental addons.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-07-15 at 08:06 PM.
  Reply With Quote
05-07-15, 08:18 PM   #12
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Originally Posted by Tonyleila View Post
Oh man, you can't show us this gif without uploading the addon for it
Semlar has a history of non-publishing. I try to shame him as much as possible.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
05-07-15, 08:36 PM   #13
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Most of my stuff is non-published. Mostly because I keep starting projects and never finish them.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
05-07-15, 10:09 PM   #14
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by Torhal View Post
Semlar has a history of non-publishing. I try to shame him as much as possible.
tries to calm torhal down
  Reply With Quote
05-07-15, 10:24 PM   #15
Digital_Utopia
A Flamescale Wyrmkin
 
Digital_Utopia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 110
Other than the front end (titles, menus) the UI layout is done, including all the in-game visuals, shy of the actual raycasting/sprites. Now I can start on the main porting.

http://i.imgur.com/pW7MmvR.jpg
__________________
  Reply With Quote
05-07-15, 11:33 PM   #16
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by semlar View Post
By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.

I thought we couldn't do that anymore...
__________________
Tweets YouTube Website
  Reply With Quote
05-08-15, 01:15 AM   #17
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by 10leej View Post
I thought we couldn't do that anymore...
There's nothing stopping us from it. It's a nasty hack to work around functionality that should work, but is fundamentally bugged. Note this isn't using a custom model and rotating it. He's manually drawing every horizontal line of pixels. This would require a lot of CPU time to perform and I would not suggest doing this.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-08-15 at 01:19 AM.
  Reply With Quote
05-08-15, 08:18 AM   #18
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by SDPhantom View Post
There's nothing stopping us from it. It's a nasty hack to work around functionality that should work, but is fundamentally bugged. Note this isn't using a custom model and rotating it. He's manually drawing every horizontal line of pixels. This would require a lot of CPU time to perform and I would not suggest doing this.
It's actually not as resource intensive as you might think to draw the same texture even hundreds of times on the screen once it's been loaded into memory, it has a fairly minor impact on performance.

I think 10leej has the impression that I'm drawing on the game world like AVR, and that's completely unrelated.
  Reply With Quote
05-08-15, 08:47 AM   #19
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Digital_Utopia View Post
Other than the front end (titles, menus) the UI layout is done, including all the in-game visuals, shy of the actual raycasting/sprites. Now I can start on the main porting.

http://i.imgur.com/pW7MmvR.jpg
I see you have upgraded to ZPerl. Good.
  Reply With Quote
05-08-15, 08:48 AM   #20
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by semlar View Post
It's actually not as resource intensive as you might think to draw the same texture even hundreds of times on the screen once it's been loaded into memory, it has a fairly minor impact on performance.

I think 10leej has the impression that I'm drawing on the game world like AVR, and that's completely unrelated.
Show us some code master!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » My Next Addon

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off