Archived

This topic is now archived and is closed to further replies.

Mephs

Browsing the web within a DirectX app... possible??

Recommended Posts

I''m interested in allowing the user of a DirectX game to be able to view a webpage while in the game. Does anyone know if it woud be possible to integrate a web browser within the same window as a DirectX app, kind of an embedded window? I imagine my setup would be something as follows. A gamer is playing my game, wants to email a friend that is not logged into the game, but doesnt want to quit out of the game and have to sit there waiting 10 minutes for everything to load up again. So when he starts the game, he selects which browser .exe file he wants to use. He then goes on to head to a computer terminal in game, which opens a subwindow, while remaining "in game" he has access within the same game window, to an internet browser and is able to send his friend an email through web based email services. Is something like that even remotely feasible? Secondly, is it then possible for this web page to pass information between the app and itself? I may only need output to the program from the webpage, but bi-directional communication could allow for even more flexibility if it''s possible. I''m guessing something like CGI script or something could do this? I have some very cool, and as far as I know, extremely original ideas that would utilise this concept, integrating the web into a proper full blown game. The email example is but a tiny part of my greater plan =) cheers for any help, Steve AKA Mephs

Share this post


Link to post
Share on other sites
I''ve worked on a couple of products where something similar to this was asked for. In the end we took a simpler route, but I learnt a lot in researching this.

1. The absolute simplest thing to do is to start the users default browser whenever web access is requires - your app will minimise and the browser comes up. There''s a knowledge base article on MSDN for this.

2. You don''t need to ask the user for the .exe for their browser - all you do is use Shell calls to find out what program is associated with the Open verb for .htm files. The MSDN knowledge base article also covers this.

3. Note that disabled users may have installed accessibility tools and set browser options which mean their browser layout, font sizes etc might be different than you''re expecting - be wary of assuming layout.

4. If you''re intending on just having the the page itself without any of the window or controls, you probably won''t be running the .exe directly.

5. For complete control over browsing and getting just the page without the controls & window, the main way to do it is via the OLE/ActiveX controls exposed in IE.

6. If you have a fullscreen exclusive app, it''ll be difficult to get the contents of the browser window onto the screen - under DX8, the only practical method I can think of is to use the ActiveX control to render to an invisible window, get the device context for that window and copy the pixels manually onto a texture/straight to the back buffer.

7. If however you have a windowed app, you can simply make the browser window a child of the main app window.

8. If you go for for using the ActiveX control, use MFC or ATL. Embedding controls with UIs is an swine in straight Win32.
If you object to using either MFC or ATL in your app, create an MFC DLL containing the ActiveX control access code, and exposing a few simple functions for your app.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Hey cool thanks for all the advice =),
I might as well let the cat out the bag though, as I think you did make a couple of assumptions because I hadnt given enough away. Firstly, yes I think I would like the controls in there, as I want the user to truly be able to browse the web. My idea is this:

As with all my ideas at the moment, the end final product would hopefully be a MMORPG in a sci-fi environment. I want players to be able to design their own web page specifically for use with the game (though not a necessity). The idea is that items in the game are password encrypted. To be able to use something in a game (such as a clan HQ laser turret or a security door) you must locate a computer terminal in the game, browse to the appropriate web page for that object, crack a puzzle in the web page, and upon the correct solution being found, control of the item will revert to the person having solved the unlock puzzle. I thought this idea up because I thought that the way hacking items is dealt with in most games (read: system shock 2 =p) is extremely simplistic. Imagine being able to control a netrunner type character such as ones from CyberPunk that could browse the web and find ways to crack enemies codes and gain control of their key facilities.

This would be an awesome role that wouldnt necessarily involve a player ever having to fight, they could back up a team of players assaulting a base by taking over appropriate facilities remotely, and using them to aid the players, opening doors to allow access to restricted areas, using laser turrets to kill enemy guards, disabling laser fields etc etc. It wouldnt be so simplistic that anyone with a good enough game skill could open anyones doors or whatever, but it wouldnt be so difficult as to be impossible. It''s only the beginining of an idea, web integration may not ever be needed, I may find an alternate idea to simulate a similar effect, but I figure allowing net access in game, could also mean players being coordinated a LOT better by being able to consult noticeboards etc, in game. Take EQ for example, a lot of notice boards fail, cos players spend hours in game, and when they come out of the game, they are tired, the last thing they want is to go check a web page, but if they could check a clan web page in game? I think it''d be a different story =)

Failure at completing these puzzles set by the enemies could result in the netrunner character being physically damaged so as to discourage brute force style hacks. Oh and please note I''m not suggesting encouraging literal hacking of the web pages themselves, just finding good ways to solve these puzzles.

Anyways like I say please nobody flame away at it''s plausibility, I know there are a LOT of things left unconsidered, which is why I''m asking for further thought on it. Appologies also that it''s kinda design related, but in order to create this effect, I need to implement it via DirectX which is why the topic is here.

Share this post


Link to post
Share on other sites
it seems a better idea not to use a web browser and just simulate one. players may eventually decide to attempt to actually hack your web server. anything that promotes (i know you dont mean to, but players wont see it that way) such behavior should be ensured that there is NO ability for the player to access the content outside the game. granted it will be more diffiuclt to code since you will have to parse your own data files, but at least you have more control. plus you dont have to use html, and use a MUCH fancier dynamic interface (otherwise you have to assume flash is installed, and you wont benefit from hardware acceleration). best of all you can keep all data on the players harddrive/cd, and store only the solution to the puzzle on your server. all the game server to check whether the solution matches, not the client.

a spiffy idea, just try not to forget you can simulate and mimic interfaces.

message boards can be viewed and checked using muliple interfaces. since everything will be stored in a database, you will not need to have the game go through the standard http web interface. instead have the server able to take requests from the client (ie show first page of messages in forum1, or post new topic to forum2). the web interace would be done using php like normal. this allows the best of both worlds. on one side a more efficent and graphically cooler game interface with fancy fonts, animations, translucent windows, and other visual treats for the game. and a standard http web browser interface.

Share this post


Link to post
Share on other sites
why not just make a simple e-mail client in the game? that can handle pop3/smtp .. it could have a filter in it to only download messages with subject:
[YOURGAMESNAME]

and always send messages like that... The ordinary pop3 client would then get all "intresting" messages and if the gamer is logged out he will get the mail in his email client and log in(?)


Another thing that is more and more used by gamers today is IRC and making an irc client takes a couple of hours (USER,IDENT,PRIVMSG,JOIN,QUIT .. what more do you need to support for this such thing

Share this post


Link to post
Share on other sites
Thanks guys for your comments,
I shall definitely look into taking the idea further, I''m quite intrigued at the possibilities of a system such as this. Looking at the idea now I think yes, simulating the internet through my own interfaces would probably work a lot better. Well I wont be able to work on implementing it right now, but its sure as hell going in my design doc for further work later =)

Steve AKA Mephs

Share this post


Link to post
Share on other sites
Hmm - it''d probably be worth checking out the many versions of CoreWar out there - a version of that with true networked multiplayer and modern(ish) graphics could be quite good fun (albeit in a geeky kind of way ).

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
You could write a sort of inbult web-browser yourself, just to download text files from web pages, you just need to get the hang of sockets, after that the HTTP commands are pants. However, that wouldn''t let you upload files.

Anyone know if its possible to get the socket used by a web browser? You could then open a web browser in the background, and send / recieve HTTP commands using its socket, and then close the browser window.

2p
Steve

Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites