VGUI HTML Screen In Multiplayer: Difference between revisions
m (categorized) |
TomEdwards (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
This tutorial is an add-on to the [[VGUI HTML Screen]] tutorial. Like the original version, this tutorial aims at placing in-game viewable HTML screens, which have the added bonus of being able to trigger entity actions. | This tutorial is an add-on to the [[VGUI HTML Screen]] tutorial. Like the original version, this tutorial aims at placing in-game viewable HTML screens, which have the added bonus of being able to trigger entity actions. | ||
The difference with this tutorial, is that it's written for Multiplayer, and works by sending the server a command to trigger it's entity. | The difference with this tutorial, is that it's written for Multiplayer, and works by sending the server a command to trigger it's entity. | ||
Line 6: | Line 4: | ||
This tutorial assumes you have read and fully understand how to implement the [[VGUI HTML Screen|original document]]. | This tutorial assumes you have read and fully understand how to implement the [[VGUI HTML Screen|original document]]. | ||
= Special Thanks = | == Special Thanks == | ||
Special thanks to Harm-Simon for coming to me with the proposal of a multiplayer version, for debugging, ideas and code that made the final version of this release. This is for you! | Special thanks to Harm-Simon for coming to me with the proposal of a multiplayer version, for debugging, ideas and code that made the final version of this release. This is for you! | ||
= Changes = | == Changes == | ||
== Singleplayer vs Multiplayer == | === Singleplayer vs Multiplayer === | ||
The Singleplayer version of the VGUI HTML Screens is implemented entirely in the client - as the client has full control over the game world in that version. | The Singleplayer version of the VGUI HTML Screens is implemented entirely in the client - as the client has full control over the game world in that version. | ||
Line 18: | Line 16: | ||
Conversely, the Multiplayer version is implemented in a mixed client/server system. Displaying the screen is done on the client side, and any entity IO commands are sent to a new command placed in the Server project. | Conversely, the Multiplayer version is implemented in a mixed client/server system. Displaying the screen is done on the client side, and any entity IO commands are sent to a new command placed in the Server project. | ||
== Code Changes == | === Code Changes === | ||
There have been a few changes to the code. Most notably, the entity parser has been changed to use the <code>sv_ent_fire</code> command to trigger entity actions. It is very similar to the [[ent fire]] command, except that cheats are not required to use it. | There have been a few changes to the code. Most notably, the entity parser has been changed to use the <code>sv_ent_fire</code> command to trigger entity actions. It is very similar to the [[ent fire]] command, except that cheats are not required to use it. | ||
== Compatibility == | === Compatibility === | ||
This code ''should'' work fine in singleplayer, but this has not been tested. It has been testing in multiplayer and has been seen to work perfectly. | This code ''should'' work fine in singleplayer, but this has not been tested. It has been testing in multiplayer and has been seen to work perfectly. | ||
This code is considered superior to the singleplayer versiom, but the tutorial is much shorter. | This code is considered superior to the singleplayer versiom, but the tutorial is much shorter. | ||
= Implementing the VGUI HTML View = | == Implementing the VGUI HTML View == | ||
== Conventions used == | === Conventions used === | ||
A number of files are required to be added to various projects in the your <code>src</code> directory. Please note the following conventions: | A number of files are required to be added to various projects in the your <code>src</code> directory. Please note the following conventions: | ||
Line 40: | Line 38: | ||
* Create a new file with the appropriate name, and paste the contents of the file into it | * Create a new file with the appropriate name, and paste the contents of the file into it | ||
== The New Files == | === The New Files === | ||
A number of new files need to be added to various projects. | A number of new files need to be added to various projects. | ||
=== Game_HL2MP === | ==== Game_HL2MP ==== | ||
* Add the following files to the '''client_hl2mp''' project (or '''client_hl2''' in the case of singleplayer): | * Add the following files to the '''client_hl2mp''' project (or '''client_hl2''' in the case of singleplayer): | ||
Line 53: | Line 51: | ||
:* <code>[[VGUI HTML Screen In Multiplayer/sv_htmlview_support.cpp|sv_htmlview_support.cpp]]</code> ''([http://www.thedaedalus.net/~daedalus/vgui/sv_htmlview_support.cpp download])'' — ''belongs in the <code>src\dlls\</code> folder'' | :* <code>[[VGUI HTML Screen In Multiplayer/sv_htmlview_support.cpp|sv_htmlview_support.cpp]]</code> ''([http://www.thedaedalus.net/~daedalus/vgui/sv_htmlview_support.cpp download])'' — ''belongs in the <code>src\dlls\</code> folder'' | ||
=== Everything_SDK === | ==== Everything_SDK ==== | ||
* Add the following files to the '''vgui_controls''' project | * Add the following files to the '''vgui_controls''' project | ||
Line 61: | Line 59: | ||
:* <code>[[VGUI HTML Screen In Multiplayer/EntHTML.h|EntHTML.h]]</code> ''([http://www.thedaedalus.net/~daedalus/vgui/EntHTML.h download])'' | :* <code>[[VGUI HTML Screen In Multiplayer/EntHTML.h|EntHTML.h]]</code> ''([http://www.thedaedalus.net/~daedalus/vgui/EntHTML.h download])'' | ||
== Finishing Up == | === Finishing Up === | ||
Lastly, a single file in the client project needs to be updated. | Lastly, a single file in the client project needs to be updated. | ||
Line 67: | Line 65: | ||
In the '''client_hl2mp''' (or '''client_hl2''') project, open the file <code>vgui_int.cpp</code>. | In the '''client_hl2mp''' (or '''client_hl2''') project, open the file <code>vgui_int.cpp</code>. | ||
=== Step 1: Adding the Include === | ==== Step 1: Adding the Include ==== | ||
Locate the following line: | Locate the following line: | ||
Line 74: | Line 72: | ||
#include "IHTMLView.h" | #include "IHTMLView.h" | ||
=== Step 2: Adding the Initialization === | ==== Step 2: Adding the Initialization ==== | ||
Locate the following line: | Locate the following line: | ||
Line 82: | Line 80: | ||
htmlview->Create(gameParent); | htmlview->Create(gameParent); | ||
=== Step 3: Adding the Deconstructor === | ==== Step 3: Adding the Deconstructor ==== | ||
Locate the following line: | Locate the following line: | ||
Line 89: | Line 87: | ||
htmlview->Destroy(); | htmlview->Destroy(); | ||
=== Finished === | ==== Finished ==== | ||
Now you're done! | Now you're done! | ||
Line 99: | Line 97: | ||
If you need more information on using these HTML screens, see [[VGUI HTML Screen|the original article]]. | If you need more information on using these HTML screens, see [[VGUI HTML Screen|the original article]]. | ||
= Notes on maps = | == Notes on maps == | ||
Please note that you are now required to use the [[point_clientcommand]] instead of the [[point_servercommand]] entity to trigger the HTMLView. | Please note that you are now required to use the [[point_clientcommand]] instead of the [[point_servercommand]] entity to trigger the HTMLView. | ||
[[Category:VGUI]] | [[Category:VGUI|H]] |
Revision as of 05:41, 4 April 2008
This tutorial is an add-on to the VGUI HTML Screen tutorial. Like the original version, this tutorial aims at placing in-game viewable HTML screens, which have the added bonus of being able to trigger entity actions. The difference with this tutorial, is that it's written for Multiplayer, and works by sending the server a command to trigger it's entity.
This tutorial assumes you have read and fully understand how to implement the original document.
Special Thanks
Special thanks to Harm-Simon for coming to me with the proposal of a multiplayer version, for debugging, ideas and code that made the final version of this release. This is for you!
Changes
Singleplayer vs Multiplayer
The Singleplayer version of the VGUI HTML Screens is implemented entirely in the client - as the client has full control over the game world in that version.
Conversely, the Multiplayer version is implemented in a mixed client/server system. Displaying the screen is done on the client side, and any entity IO commands are sent to a new command placed in the Server project.
Code Changes
There have been a few changes to the code. Most notably, the entity parser has been changed to use the sv_ent_fire
command to trigger entity actions. It is very similar to the ent fire command, except that cheats are not required to use it.
Compatibility
This code should work fine in singleplayer, but this has not been tested. It has been testing in multiplayer and has been seen to work perfectly. This code is considered superior to the singleplayer versiom, but the tutorial is much shorter.
Implementing the VGUI HTML View
Conventions used
A number of files are required to be added to various projects in the your src
directory. Please note the following conventions:
- Game_HL2MP refers to the
Game_HL2MP-2003
orGame_HL2MP-2005
project. Use the one associated with the tools you have.

Game_HL2-2003
and Game_HL2-2005
- Similarly, Everything_SDK refers to the
Everything_SDK-2003
orEverything_SDK-2005
project.
When adding files to a project, you have two options:
- Save the file to the appropriate directory (specified below)
- Create a new file with the appropriate name, and paste the contents of the file into it
The New Files
A number of new files need to be added to various projects.
Game_HL2MP
- Add the following files to the client_hl2mp project (or client_hl2 in the case of singleplayer):
HTMLView.cpp
(download) — belongs in thesrc\cl_dll\
folderIHTMLView.h
(download) — belongs in thesrc\cl_dll\
folder
- Add the following files to the server_hl2mp project (or server_hl2 in the case of singleplayer):
sv_htmlview_support.cpp
(download) — belongs in thesrc\dlls\
folder
Everything_SDK
- Add the following files to the vgui_controls project
EntHTML.cpp
(download) — belongs in thesrc\vgui2\controls\
folder
Additionally, the following file needs to be placed in the src\public\
and src\public\vgui_controls\
folders:
Finishing Up
Lastly, a single file in the client project needs to be updated.
In the client_hl2mp (or client_hl2) project, open the file vgui_int.cpp
.
Step 1: Adding the Include
Locate the following line:
#include "FileSystem.h"
Directly below this line, add:
#include "IHTMLView.h"
Step 2: Adding the Initialization
Locate the following line:
VPANEL toolParent = enginevgui->GetPanel( PANEL_TOOLS );
Directly below this line, add:
VPANEL gameParent = enginevgui->GetPanel( PANEL_INGAMESCREENS ); htmlview->Create(gameParent);
Step 3: Adding the Deconstructor
Locate the following line:
VGUI_DestroyClientDLLRootPanel();
Directory below this line, add:
htmlview->Destroy();
Finished
Now you're done!
Compile your project and you're ready.
Please post any errors or issues on the discussion page.
If you need more information on using these HTML screens, see the original article.
Notes on maps
Please note that you are now required to use the point_clientcommand instead of the point_servercommand entity to trigger the HTMLView.