I am currently making a simple game in XNA but am at a point where testing various aspect gets a bit tricky, especially when you have to wait till you have 1000 score to see if your animation is playing correctly etc. Of course i could just edit the starting variable in the code before I launched but I have recently been interested in trying to implement a console style window which can print out values and take input to alter public variables during run-time.
I am aware that VS has the immediate window which achieves a similar thing but i would prefer mine is an actual part of the game with the intention that the user may have limited access to it in the future.
Some of the key things i have yet to find an answer to after looking around for a while are:
how i would support free text entry
how i would access variables during runtime
how i would edit these variable
I have also read about using a property grid from windows form aps (and partially reflection) which looked like it could simplify a lot of things but i am not sure how I would get that running inside my XNA game window or how i would get it to not look out of place (as the visual aspect of is seems to be aimed just for development time viewing).
All in all I'm quite open to any suggestions on how to approach this task as currently I'm not sure where to start. Thanks in advance.
I've used this in the past, and it worked great.
http://xnacc.codeplex.com/
It will require some programming to set it up to work with your game, but may be worth the effort if this is something that interests you.
Related
In Unity3D the logic dictates that objects are not to be rendered unless in the field of view. This is obviously the way to go for optimization purposes. However, it still renders meshes that can not be seen by a player due to being occluded. I would like to solve this and was wondering if there was already a method to do so or if I had to do it myself.
Here's a picture to help illustrate my point.
So far my only real ideas are using the culling, but that still would be in a range not necessarily visible.
https://docs.unity3d.com/ScriptReference/Camera-layerCullDistances.html
I guess essentially what I need to know is how to do occlusion culling after a scene starts because the scene is generated, it's not premade.
For anyone who's interested, I asked the unity community
Answer by Bunny83 ยท 4 hours ago
No, that's not possible. At least not with the occlusion culling
system that Unity uses. The calculation which parts are visible from
which points is quite complicated and has to be precomputed in the
editor. So it won't work for procedurally generated levels.
You have to roll your own solution if you need something like that.
Just a few weeks (or month?) ago i implemented a VisPortals solution
similar to those used by Doom3 (basically how most ID Tech engines
work). It's more a prove of concept than a ready-to-use solution.
Usually i upload a webplayer demo onto my dropbox, however i just
realised that Dropbox finally prevented to directly view HTML pages
off my public folder. They now force a download of the page which
breaks everything. So if you want to try it, you have to download the
project.
Of course vis portals doesn't work in all situations. They are perfect
for closed environments which can be split nicely into seperate areas.
Of course this splitting into areas and the creation of the visportals
currently is done by hand. So you would need to automate this
yourself.
Be careful with static batching, it might break the system as each
area has to be seperate so it can be enabled / disabled seperately.
I'm trying to learn about injecting/hooking running processes.
I have a game running, and in the game you can type /coord to get a print of what your current X, Y coordinates are. Basically I want to just have this done automatically through a program so I was looking into how I might do this with C# but I'm not exactly sure what I would google to start to learn how exactly I might do this, basically I just want a small GUI that will update the X/Y position automatically as I move around.
I'm not exactly sure where to start if anybody can just point me in the right direction that would be great.
If this is too off-topic / broad feel free to close it, sorry for any inconvenience.
This is not really possible with c# only, unless the game is also written in c#, and you can somehow convince the game to load your module.
Otherwise, there will need to be atleast a native stub that starts up the .net runtime.
See this for an example of injecting native code in an application:
http://www.codeproject.com/Articles/4610/Three-Ways-to-Inject-Your-Code-into-Another-Proces
This native code can then bootstrap whatever intermediate language you will use.
On the other hand, reading the process memory can be done from any language that can use the Windows API, using OpenProcess, ReadProcessMemory, CloseHandle.
I'm working on a small tool for a DirectX game and I want to prevent the user from pressing a certain key (F12 in this case) for a certain period.
I could find many options for simulating keypresses but what are the options when it comes to nulling out a keystroke before the game reads it?
The language doesn't really matter, although I would prefer a C# or C++ solution, or just a nudge in the right direction :)
Thanks in advance!
The good news is, I've done this before so I can say that it is possible and it does work.
The bad news is that it's not simple. It requires a lot of complicated code, and will likely take a long time to implement, but I'll explain how you can do it.
Applications like DirectX games usually register for raw input.
Since you want to stop a keyboard event from reaching the application, you need a way to insert your code between the raw input and the game so you can check the raw input and decide whether to allow it to be passed to the game:
So you want to change the flow from:
Raw Input --> Game
to
Raw Input --> Your Code --> Game
Without having access to the source code of the game, you have to find a way to insert your code.
When there is keyboard input available, the game will call the WinAPI function GetRawInputData, which will tell it about the keyboard event. Ideally, what we want is when the game calls this function, it actually calls our code instead of the WinAPI function. Then we can decide what to tell the game about the keyboard event, we could tell it anything we want (e.g. ignore F12). Sounds great right? Here's where it gets interesting...
We can take advantage of how windows loads executables into memory. Typically, a program uses (or 'imports') calls to functions in other DLLs (such as GetRawInputData, in User32.dll). When the program gets loaded into memory, Windows will fill in a table (the Import Address Table (IAT)) with pointers to the executable code in the appropriate DLLs. This means that when the program calls the function, it gets directed to the executable code in User32.dll in memory to run it.
Wouldn't it be great if we could write/patch the address of one of our functions into that table, so that when the game calls GetRawInputData, it actually gets directed to our function for us to process? Well we can! It's called Import Address Table Patching.
There's a pretty good article on it here with some working code in C++. You should first read it to understand in more detail how it works, then you can modify it to support your needs. It will work, but I know it's probably more work (much more work) than you would have been hoping for, but essentially you're hacking the application which is never easy to do.
It's worth doing, even just to gain a better understanding of Windows behind the scenes.
Good luck!
EDIT
As Simon said, Windows Hooks is a much simpler way to do it if the game isn't using raw input. DirectX Games tend to be a special case that don't really work too well with standard Hooks as they use special methods to get the input from the user. By all means give it a go though, it will be a lot easier if it works.
I want to create a program that can log gathering in a RPG for me, the problem is that I dont know where to start. I know c++ and some c#, but I haven't got a clue on how to scan the screen.
What I've looked at:
Screen scraping (most info is on scraping HTML pages)
OCR (Most info
is on OCR on a image file, not an active window)
Spy++ (I haven't got
a clue)
I can do it with any language, but I'd prefer c++ or c# since that what I'm most experienced in
What is the best way to do it? anyone got some helpful links/tips?
example of something I'd like to know (amongst other things):
Would it be wise to make a screenshot like once every seccond and then analyze that image?
Should I learn and use windows API for this?
before you bash me:
Yes, I know that this will be a big project, nothing I expect to complete easily
Yes, I understand that I will have to learn more about programming to do this (that's part of the goal)
Yes, I understand that it might be more than I can handle at my current level of skill, but I'd like to figure that out by trying :)
Please help me, I really dont have a clue about where to start
If you are serious about creating this program I would suggest you forget about scanning the screen, image analysis gets very complicated very quickly.
Instead look into memory reading, the information shown in the game can also be read as a straight up value from the games working memory.
There are probably resources out there for your game already, google it.
World of Warcraft
Diablo 3
etc
I am working on a project in C# using WPF to attempt to make a program much like http://www.scaleofuniverse.com/.
I know it can easily be done in flash but I want to integrate the controls into other platforms (ie the new Leap motion and Kinect). I know I could rig it so that the kinect emulates key presses onto a flash game but i would really like to figure out making this in C#. I completed a few basic tutorials on basic animation and storyboarding but i've found nothing that indicates the project i want to complete can even be done! Am i biting off more than i can chew or am i over-complicating the program somewhere? I am only in the design stage so i do not have any source code for review (still completing tutorials). I really want to know if this project is even plausible before I continue working on it.
It definitely can be done in WPF. Here is an example of a custom zoom control for WPF http://www.ab4d.com/ZoomPanel.aspx.