Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
SheriffHippo
Jul 18, 2002
What is a good size for a CTF or Deathamtch map?

Possible examples: UT99's Coret, Team Fortress's 2Fort, or any Counter Strike map.

I am looking for units in terms of a player's height when compared to width and length of the map. (Something like Unreal Units)

Adbot
ADBOT LOVES YOU

SheriffHippo
Jul 18, 2002
I am trying to create a FPS-like mouse input system in C#.

*(This is a 2D top-down game. I do not need to do matrix/transform stuff)

I simply wish to record mouse movement input that is not inhibited by the constraints of the screen, or window.

For every mouse movement, the program should force the mouse back to the center X/Y point of the game. Each mouse movement is measured in terms of distance from the game's center point.

C# has some mouse functions that can get/set the cursor position, but they all exist in terms of the program window. (This won't do if one is playing in a window)

Because of this, I am importing win32 functions in C#. For example:

code:
[DllImport("user32.dll")]
public static extern bool SetCursorPos(int X, int Y);
This gives me more low level access to the mouse. I am now able to get and set the mouse position in terms of screen coordinates.

However, I am experiencing various problems.

I think I want the following rules to exist:

1. For every mouse movement, record the distance and duration of movement. Set the mouse back to center X/Y.

2. Hide the cursor. The cursor should be invisible even when it leaves the program window. I am currently unable to do this. Both C#'s Cursor.Hide() and win32's ShowCursor() do not keep the cursor hidden if it leaves the game window.

3. If the cursor happens to leave the game window, clicks should not register. I am having a problem with this too.

I don't know if I should:

A. Intercept all mouse input and keep it from passing to the OS.

Or..

B. Sample the mouse input often enough to keep it inside the game window.

Ultimately, I would like to use an OnMouseMoved event as opposed to a timer loop. I am attempting to use a mouse-moved event, but I am having problems with win32's SetCursorPos() function, when this event is fired. (Perhaps there is an issue that requires a Delegate. I am lost here.)


In conclusion, this has become retardedly hard.
Should I continue blindly trying things, or can DirectInput, XNA, GLUT, SDL, or some other library make this easier?

edit: I have written a Direct3D/C++ 2D game before, so C++ is an option. I would prefer to use C# though, as it is much easier to deal with.

SheriffHippo fucked around with this message at 10:26 on Aug 3, 2008

SheriffHippo
Jul 18, 2002

MasterSlowPoke posted:

What API are you using? XNA? Managed DirectX? SlimDX? GDI (is there even GDI for C#)? If you're not using XNA, it would probably be best to use DirectInput for this.

I am not using a gaming API. The game consists of a Flash swf embedded in the form. I tried XNA, but it doesn't seem to use forms, and input relies on a built-in game loop, something that C# programs don't seem to have exposed.

MasterSlowPoke posted:

If you're sampling the mouse once a frame (1/60th of a second) this should never happen.

I've set up a timer that runs every millisecond. The mouse still escapes the window. :(


StickGuy posted:

The Windows API provides functions to "capture" the mouse so that a window receives all mouse events, even if they're generated outside of it.

I am having terrible problems with SetCapture(). Perhaps I will keep trying that.


edit: I've also been trying to do this in C++/MFC. I am having all the same problems. It seems that if anyone has ever done this, Google has decided not to record it.

SheriffHippo
Jul 18, 2002
I wish to have FPS-like mouse control and UDP support.

I've just posted this question in the .NET thread. I may be fairly close to a solution.

Solved. Please see solution here: http://forums.somethingawful.com/showthread.php?threadid=2262300&pagenumber=77&perpage=40#post347255779

(I used a C# class I found on CodeProject.com which uses a system hook to trap all mouse input)
http://www.codeproject.com/KB/cs/globalhook.aspx

SheriffHippo fucked around with this message at 04:16 on Aug 5, 2008

SheriffHippo
Jul 18, 2002

Suburban Krunk posted:

I want to learn a programming language and learn about game development at the same time.

My personal opinion is that Flash is the best for beginners. One main reason is that the Flash IDE allows you to create named graphical assets instantly.

In Flash, you can literally open the IDE, draw a circle with the pen tool, right-click the circle, name it "circle_lol", then type the code:

code:
circle_lol.x += 3;
Compile, and your circle will move.

Conversely, in OpenGL, Direct3D, SDL, or XNA, you will have to spend hours setting up confusing libraries and write several lines of cryptic code just to get a graphic to appear on the screen.

Also, what you learn about programming and game programming in ActionScript will be transferable to C# and even C++.

However, if you don't want to use Flash, XNA and SDL are the easiest of the C++/C# graphical APIs.

C# is also far easier to learn than C++. (XNA uses C#)

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply