Quake3World.com Forums
     Level Editing & Modeling
        Visual Studio Code & Shaders


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Visual Studio Code & Shaders

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1918
PostPosted: 05-30-2017 03:17 PM           Profile   Send private message  E-mail  Edit post Reply with quote


Hello. Recently I found quite good code editor by Microsoft, available for Windows, Linux and Mac, titled as Visual Studio Code. It's pretty much just a text editor, with syntax highlighting feature and auto-completion feature. I'd recommend this editor alongside with other ones (like Notepad++ for Windows or Sublime Text for Linux) as it knows only two formats of line ends (omits Mac CR format on Windows), but it can seriously take over the place of your current text editor (even classic Notepad on Windows or gedit on Linux) It has also debugging options, though much limited compared to full Visual Studio IDE.

My goal is this: Create and release extension for Visual Studio Code for highlighting syntax of Quake engine shaders. I know that shader has this format:
Code:
textures/custom/sprite
{
    surfaceparm nolightmap
    surfaceparm nodlight
    surfaceparm nomarks
    surfaceparm noimpact
    surfaceparm trans
    deformVertexes autosprite
    {
        map textures/custom/sprite.tga
        blendFunc GL_ONE GL_ONE
        rgbGen wave square 0 1 .25 .125
    }
}

And I would like to know how to make such syntax highlight using yo code. I mean, how to design keywords plus their parameters, how to design q3map2 directives (and allow for custom ones), allowing for custom surfaceparms, etc. Pretty much take plenty of notes from obsidian's Shader Manual and make syntax highlighter for VS Code out of that. It's great guide and making a tool for relatively new coding text editor to help to find its users also here between level designers would be great pleasure for me. But it's really new editor and I have to learn all the possibilities for it, including creation of custom syntax highlighter for custom languages (which shader is).



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 

Old Skool'
Old Skool'
Joined: 02 May 2002
Posts: 5230
PostPosted: 05-30-2017 10:56 PM           Profile Send private message  E-mail  Edit post Reply with quote


I haven't tried it myself, but here's syntax highlighting for Sublime:

https://packagecontrol.io/packages/Quake3%20Script




Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1918
PostPosted: 05-31-2017 01:27 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Unfortunately, I do not have Sublime Text, so I could only look into syntax and borrow some methods, if it will correspond to my needs:
  • I need to identify all general directives (surfaceparm, and other non-q3map directives), q3map2 directives respectively (allowing for custom q3map directive in case of modified compiler), and stage related directives (map, clampmap, etc.) - custom directives should be visually different from the standard ones
  • Identify known keywords for each directives (e.g. surfaceparm nolightmap an so on, allowing for custom surfaceparms in case of modified engine & compiler) - there are number of more directives which would require custom keywording - again need to be visually different from standard ones
  • Identify each directive their positional parameters (required or not required)
    • Texture paths, keywords like $lightmap, *whiteimage, etc.
    • Numbers in numeric parameters
    • Block comments (using multiple line comments arranged into block) would be great to recognise
  • Shader must have a name (the very beginning of the {} code wrap)
  • Block comment just before a shader name could be a shader documentation (e.g. what's the purpose of that particular shader) - like a documentation feature
  • etc. There are plenty of other things to take care of. Also, the syntax highlighter would be required to be up to date with most recent q3map2 version (the official one)...

In fact, I just started using VS Code and it's really good editor. It lets me install various extensions which may turn it into a simple, yet full working IDE (something like Vim on Linux). I also installed Vim mode to VS Code, so I can use simple keyboard strokes to execute text editing commands. Just like Vim. It's pretty handy sometimes...



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 05-31-2017 08:58 PM           Profile Send private message  E-mail  Edit post Reply with quote


Fjoggs wrote:
I haven't tried it myself, but here's syntax highlighting for Sublime:

https://packagecontrol.io/packages/Quake3%20Script


Thanks! :up:



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Old Skool'
Old Skool'
Joined: 02 May 2002
Posts: 5230
PostPosted: 06-03-2017 03:50 AM           Profile Send private message  E-mail  Edit post Reply with quote


CZghost wrote:
Unfortunately, I do not have Sublime Text, so I could only look into syntax and borrow some methods, if it will correspond to my needs:


You can just download it. It's basically free.




Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1918
PostPosted: 06-11-2017 07:34 AM           Profile   Send private message  E-mail  Edit post Reply with quote


@Fjoggs: Well, it's pretty logical. Since I will have to move to Linux soon, it's just to give it a try :) Windows just drives me crazy :(



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1918
PostPosted: 06-11-2017 07:44 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Well, works pretty good :)



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1918
PostPosted: 12-16-2018 04:19 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Okay, Installed Sublime Text 3 and it seems to work perfectly :) I'll use Sublime Text for Quake 3 script coding, because it runs quite smoother and quicker than VS Code.



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.