• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

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

cody

accessing screen buffer of other programs

23 posts in this topic

hi i wanna make a video capture program for unreal tournament because i didnt find a good one. so i must get access to unreal´s screen buffer through opengl. i know that is possible because i think the hl-wallhacks and aimbots used the same method. so how do i do this? cody
0

Share this post


Link to post
Share on other sites
There is no ''clean'' way to do this through OpenGL. The rendering context for UT belongs to UT, so by that means you have no access to the video memory allocated for that context.
The only thing you could do is work around the API and somehow retrieve the address of the currently displayed video buffer from the system, and capture the frames from there. To get every single frame you''d have to enable vsync in UT and time your machine to retrieve the screen at every vsync (which means it''ll also have to be fast enough to copy and save a buffer in one vertical retrace). Or, capture every second frame (every other retrace).
As of how to get the address of the currently displayed video buffer - I don''t know.
0

Share this post


Link to post
Share on other sites
One way would be to patch the DLLs. You run your program, initialize and then patch the Windows function for loading modules. Your function checks for specific DLLs and if it isn''t one of them just passes it on to Windows. If it is one of the ones you are looking for then after Windows loads it you patch the specific ones you are looking for. Using that general procedure you could get the program to render into the DC you specify. Then whenever they flip surfaces you log the image. That will slow down your frame rate because eventually you are going to be constrained by the rate at which you can write data to the disk drive. You could intercept the timer functions as well to put the program in a differant time frame, i.e. make one minute one second for the program.

The only place I''ve seen it documented how to patch DLLs as they are loaded was in Windows 95 System Programming Secrets. It shows how futile it can be to attempt to foil a knowledgable and determined hacker. People always argue it will stop most hackers, but it only takes one hacker to write the program that thousands then use.
0

Share this post


Link to post
Share on other sites
first off aimbots DONT look at the video info. they use the actual game engine calls to get player positions and such. wallhacks simple control the rendering pipline by making an opengl pass through, bassicall an opengl32.dll which modifies certain calls before passing them to the real opengl32.dll it may also add calls as needed.


video capture? hmmm, you could just record demos (ut does have that capability right?) and then the ppl who wish to view them must have the game. benifits are massivly reduced file size, smooth frame rates (assuming ou have an average pc (400+ with 3d card)), and the best part its built into the engine.


on the other hand if you are creating videos for ppl without the game. (pretty stupid unless its to show off an unreleased mod). you will have to do some crazy stuff.

method 1, easy method (decent quality if you have extremly fast pc and harddrive):
use directshow''s screen capture feature. this can be accessed via filtergraph editor (comes with the dx sdk). you can setup compression as well as audio capture.

method 2, the hard way you wont be able to do since you are asking how:

1. you MUST control the rendering and game timing if you wish to even attempt to compress the video while recording. sound increases complexity since you will have to control ALL audio output as well.

2. no input will be avaiblible to the game in its slowed down state. oh well.

method 3:
try to write a mod that can do this, though it seems unlikly.
0

Share this post


Link to post
Share on other sites
damn, i thought it could be done easier :-(

i know there are also aimbots that look at the position info of the game engine. but i have also seen one where you could set a rectangle on the screen where the bot should scan the pixels. you had to use couloured models and the aimbot aims on these.
anyway, these bots suck.

of course i know that u can record demos in unreal.(demorec filename)
but u cant but some cool stuff into it and cant cut pieces out and such.
something like that(u need divx, and turn brightness up):
http://uz.clanzenkai.net/stuff/video/TRUE-ASMD-STYLES-XERO.zip
this is recorded with movieunreal, and u see it doenst run smooth at all and the shock rifle shots fly with wrong speed.
i have tried it myself and it really doesnt look good.

another problem with demos is that they dont run on every unreal installation. even if they are the same version.

i think a better way to record videos is to run unreal in windowmode and capture the windows dc, that shouldnt be a problem, right?

or wait until movieunreal gets smooth motion...

cody
0

Share this post


Link to post
Share on other sites
Why not just run the game in windowed mode and use a capture program, that allows you to specify a rectangle, over the window and have it do it...
0

Share this post


Link to post
Share on other sites
i need 25 frames per second and i dont know a program that can do that.

i think saving to harddisk on the fly wont be possible, so i have to save to ram first, i will see. if nothing works good i can record the screen with a digital camcorder...
0

Share this post


Link to post
Share on other sites
Simplest way I can think of:
Download/re-compile the OpenGLDrv sources, and change the function ClearZ to output the display to either memory/file/virtual file. ClearZ *should* only be called once per frame, and will display EVERY frame (assuming it is called once per frame) as fast as the game can run. If you need help doing this, let me know, i may be able to help (and I stress, MAY, because I don''t know a whole lot about the Plugins sytem of UT as IU didn''t write it).

Billy - BillyB@mrsnj.com
0

Share this post


Link to post
Share on other sites
That will look like crap!

I think the screen capture programs depends on how fast your card is... That why you wont get the 25 frames a second...
0

Share this post


Link to post
Share on other sites
I fail to see why that would look like crap? It would be much better than setting a region to caption, and will give you DIRECT access to the display. You can put a flag in to capture only every other frame or however many frames you want to capture. The only thing that wouldn''t work good with this, is you wouldn''t know how many frames you''re grabbing per second unless you put some sort of timer system in.

Billy - BillyB@mrsnj.com
0

Share this post


Link to post
Share on other sites
If you want to capture the entire screen, you could just go to the video memory offsets and copy them. Or if you know the rect, you can use that area instead of the entire memory block.

-----------------------------
The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.
0

Share this post


Link to post
Share on other sites
I wasnt quoting you Anon I think are posts got submitted at same time...

The fact that cody will record the screen with a cam corder will look like crap! Wont the cam corder capture the vsync of the monitor so it will look like you you have these big black lines go up and arround through your screen?
0

Share this post


Link to post
Share on other sites
i think ansi ment the thing with the digi-cam.
i tested it with a cheap web-cam and yeah, it looks really bad, but with super cool digital camera it will look much better!

what billy wrote is interesting, but where do i get the source for this dll? i will take a look at some unreal sites...
0

Share this post


Link to post
Share on other sites
i found the source but theres a problem:
ut doesnt call ClearZ on every frame... damn again!
0

Share this post


Link to post
Share on other sites
i highly doubt you have a pc capable of capturing to ram as you would need quite a bit of ram (talking about 1gig or so). since very few pcs can run ut AND compress video on the fly at 25 frames per second. you do realize at 16bit video would get you (at 320x240 res) about 3.6 meg per SECOND. or 219meg per minute or 1089meg for a nice 5 minute video. now you probally could use some of the crappier codecs to get realtime compression on a 800mhz+ pc. if you got a pentium4 the divx4.11 codec is quite optimized and MAY yeild fast enough performance at 320x240 so that ut framerates dont go to crap. though ut may "steal" too much cpu to make it useful. also no matter how good the video camera it will look like crap thanks to the anomolies you get from the "scanning" the moniter performs during rereshing of the screen. basically if if avi capture is not built into the game dont even bother since the quality will suck unless you really want to work hard at writing all the required components.

as to demos not working. the thing is that they do, just not if you dont have the required levels/mods installed that the demo uses. i am not sure about player models, though i am pretty sure they dont matter (like if you were to play the game online).
0

Share this post


Link to post
Share on other sites
well, i have 1gig ram and i will need about 10-20mb per second.
thats enough for half a minute video. there wont be single sequences that take longer.
i know all that is not perfect, but i will try...

and it really often happens that ut demos dont work!
when you play on a internet server there are downloaded many packages. (like cshp(anti-aimbot), ut map vote,skins and other stuff, and all that in many different versions)

compressing the video while recording is not an option i think.
divx is very fast and can compress in realtime without problems, but not when ut is running...

perhaps i will wait until there´s a new version of movieunreal...
0

Share this post


Link to post
Share on other sites
Optionally, you could write an opengl32.dll wrapper that passes all calls directly through to the real opengl32.dll, except for calls to wglSwapBuffers. When SwapBuffers is called, you could do a glReadPixels and save to a file (or whatever).

As far as creating the wrapper, probably a good place to start would be glTrace (http://www.hawksoft.com/gltrace/).
0

Share this post


Link to post
Share on other sites
LordKronos: That was going to be my original idea (instead of when ZClear is called), but the problem is when writing an OpenGL app, you simply do a SwapBuffers (windows call) and it does not call a glSwapBuffers (well, not that i''m aware of anyways). I would not do a glReadPixels for an entire screen though!! :o). Using the OpenGL driver for UT gives you access to the windows DC (device context) and RC (rednering context), which makes image capturing pretty easy and fast (much better than "getting" every pixel). Cody, are you sure that UT doesn''t call ZClear every frame? If so, how did you determine this? I am trying to think of a good way to capture the screen on every refresh, it has to do something every 1 frame :o).

Billy - BillyB@mrsnj.com
0

Share this post


Link to post
Share on other sites
I am almost positive from experience that it doesnt call clear every frame, because I remember playing one level once where the level data was messed up and there were places where no poly existed. As I recall, when you looked at these areas, you would just see garbage (blurred from previous frames). I suppose it could also have been doing something really strange, but to me it looked like it wasnt clearing.
0

Share this post


Link to post
Share on other sites
LordKronos: I know the Color Buffer isn''t cleared AT ALL, but I beleive the Z-Buffer is. They are 2 seperate entities.
0

Share this post


Link to post
Share on other sites
Doh...brain meltdown. You are right, I was thinking color buffer.

However, it is also possible that the zbuffer is not cleared. If you dont know, there is a trick you can do where (with a zrange of 0 to 1) you use NearClipPlane=0.0, FarClipPlane=0.5 on frame with a Z compare of <=, and then the next frame use NearClipPlane=1.0, FarClipPlane=0.5 with a Z compare of >=, then repeat this process every 2 frames.

I am NOT saying UT does this, just speculating that it COULD. perhaps a run of glTrace could tell you.
0

Share this post


Link to post
Share on other sites
i have put my screenshot function into ClearZ() to test, so every it should make a screenshot. i was running the intro scene.
a few seconds it runs smooth and then it gets interupted.
later i checked that realy no screenshot was written before this interuption.

now im looking at OpenGlDrv.ini:

[Default]
MinLogTextureSize=3
MaxLogTextureSize=10
MaxLogUOverV=10
MaxLogVOverU=10
UseZTrick=1
UseMultiTexture=1
UsePalette=1
DoPrecache=1
ShareLists=1
AlwaysMipmap=1

UseZTrick?? i will check that later...
0

Share this post


Link to post
Share on other sites
The most info I could find on UseZTrick was this:

"Changing UseZTrick=1 to 0 can fix Z-buffer related problems, although as above may reduce performance. You can also fix Z-buffer errors by running the game with a 32-bit colour depth."

Nothing more. This might be the trick I just mentioned earlier, as that trick does increase performance (by avoiding a clear) and it can cause z artifacts (as it wastes 1 bit of precision, since only half the zbuffer is used each frame). Try disabling it, I have a feeling ClearZ() will get called
0

Share this post


Link to post
Share on other sites
No input will be available in its slowed down state? Surely you jest. The only problem with my suggestion is that it takes a lot of knowledge he most likely doesn''t have. More importantly the value of that knowledge for him is most likely substantially less than the cost of acquiring it. I might be a bit cheaper to buy a video card with a composite or s-video output. That would be too easy though.
0

Share this post


Link to post
Share on other sites