Hot answers tagged .net
16
If I understood your problem properly, you just want to shoot a bullet towards a mouse position. Here is how I would do:
First of all, you must find the movement required for the bullet to get to the mouse, like so:
Vector2 movement = mousePosition - bulletStartPosition;
Then, you should normalize it to have a vector with a length of 1 so that you can ...
13
Well, you're obviously not a someone who gives up easily, you're a real man of iron, I would have thrown my hands in the air much earlier, since this project bears a strong resemblance to a kelp forest :)
First of all, positions and velocities are set all over the place, from a viewpoint of physics subsystem it's a recipe for a disaster. Also, when changing ...
11
I've been working in professional game development for over 5 years. Most of this time, I used C# almost exclusively.
C# and .NET stack in general is really great for server-side tech. I've worked on no less than 4 MMO games with server written in C#. Also, with Unity3D gaining popularity, many browser AND mobile games require C#. Don't forget XNA ...
11
Actually, order of update problems are quite common for normal impulse physics engines, you can't just delay applying the force as Vigil suggests, you'd end up breaking energy preservation when an object simultaneously collides with 2 other. Usually they do though manage to make something that seems pretty real, even though a different order of update would ...
10
In addition to the point already made that you should use a priority heap, you've misunderstood the heuristic. You have if (isCostBetter)
{
...
neighbor.H = GetManhattanHeuristic(current, neighbor);
}
But the heuristic is supposed to be an estimate for the distance to the destination. You should set it once, when you first add the neighbour: if ...
10
I see three things, one wrong, two suspicious.
1) You're sorting on every iteration. Don't. Either use a priority queue, or at the very least do a linear search to find the minimum. You don't actually need the whole list to be sorted at all times!
2) openNodes.Contains() is probably slow (not sure about the specifics of C#'s List, but I bet it does a ...
10
Visual Studio 2012 does not work out of the box with XNA 4.0 but there is a workaround but since this still requires VS2010 to be installed as well I would recommend to just use VS2010 since that still works as expected.
9
As has been mentioned, Mono brings C# to multiple platforms. In that same area, you'll find Tao, a multiplatform library for Mono and .NET that allows access to Cg, DevIL, FreeGLUT, GLFW, GLU, ODE, OpenAl, OpenGL, PhysicsFS, SDL, and WGL. It's obviously not as robust when it comes to features as XNA (which provides fundamental engine components directly to ...
8
Irrespective of your background, you need to bring something good to the table when looking for a job. Maybe you're a wizard at server load balancing and optimizing database queries for example, which would be pretty valuable for an MMO development project. Or maybe you're really good at project management or user interface design.
Overall though, it's ...
7
The only reason against using event in a game is that creating a delegate to attach to the event handler creates a heap object that can cause a garbage collection which can cause a frame-rate hiccup on on Xbox 360 (and possibly WP7, haven't tested it).
In general, this should not be relevant to a game UI that you set-up once and simply let run.
Also, ...
7
There are tons of books that you can find on Amazon to get you started. Just search 'XNA' on Amazon, and grab the first book that interests you. One title I highly recommend is XNA 4.0 Game Development by Example: Beginner's Guide by Kurt Jaegers. He'll walk you through several games step by step, the best way to learn, and most fun, in my opinion. You'll ...
6
There is no best architecture without knowing a lot more about your requirements, eg. the sort of interactions between characters, how much data is going to be persistent, and so on.
If you can cope with 1 second of latency, you can probably host 1000 players on a single server without problems - but that actually conflicts with the idea of an FPS as they ...
6
I highly suggest you take a look at OpenTK. Using it with MonoDevelop has worked out great for me in the past (Though I never wrote a full on game with it). If you stick the the C# 2.0 standard, you'll have little to no problems.
6
Unity ( http://unity3d.com/ ) is a good start. It's got C# as one of its core languages, there's a standard workflow for using 3DSMax models, it's got a certain amount of drag-and-drop for rapid prototyping, and there's a free version with somewhat-limited functionality so you can try it out. It's got a supportive community and some tutorials, and creates ...
6
Although in .NET value types are stored on the stack, resulting in a minimal allocation cost, it does not however eliminate the cost of initialization.
In this case we have a set of functions using one or two temporary matrices, which would result in the initialization of 16-32 floats per call. While this may seem insignificant, if the methods are used ...
6
When a body collides with another, it transfers its velocity to the other one by simply setting the body's velocity to its own.
Your problem is that these are fundamentally wrong assumptions about motion, so what you're getting doesn't resemble motion as you're familiar with it.
When a body collides with another, momentum is conserved. To think of this ...
6
This is not a good use of object orientation or typing. You've fallen into the trap that inheritance and polymorphism and metaprogramming and language features are there to solve every problem.
You should reconsider using a data driven approach. Your current design is partially data driven as you explain it, but the data is embedded in code. You are ...
6
I think many here are in the same boat, so to speak. XNA was great and I had a lot of fun, now I'm moving on as Microsoft is keeping too silent about it, and excluding it in the ways you already noticed.
There's a workaround to develop XNA projects with Visual Studio 2012 and they should still run on Windows 8 desktop, but there's no official support from ...
6
The wording of your question suggests a misunderstanding of how Unity works (please correct me if I'm wrong), so I'm going to recommend you just try out Unity. "Unity3D scripts" are just .NET classes that inherit from UnityEngine.MonoBehaviour or UnityEditor.EditorWindow.
There's nothing stopping you from writing freestanding C# classes or pulling in .NET ...
5
Have you considered using SharedObject? It allows you to store data on the hard disk, and the data is accessible even if the SWF is reloaded. Seems to meet your requirements, and doesn't require a separate program of any sort.
5
Both Unity and XNA are fine choices, but if you have a passion for learning things (as you imply you do), maybe you'd enjoy using OpenTK. It's an up-to-date .NET wrapper for the OpenGL API + input + window creation functions.
Dealing with OpenGL directly is as low-level as it gets, and, in my opinion, a very rewarding learning experience. I started out ...
5
Not only does C# have a future in games development, it has a present -
Check out Magicka, a game recently released (and selling well) that was developed using XNA.
Also take a look at the winning Dream.Build.Play entries. C# is a viable way to make games (although right now I don't believe it's the right choice for all games).
As time goes by we'll see it ...
5
It's been a while since I looked at SlimDX, so I feel like drawing some lines to remember how it feels :) Well, it looks like several colored lines are all we need, so lets arrange vertices as a list, describe it's order and draw it:
// Simple vertex with position and color.
public struct LineVertex
{
public Vector3 Position;
public int Color;
}
/* ...
5
I don't know why 2 people voted to close this as I think it is a legitimate questions that isn't more localized than XNA and threading
Starting a new thread is relatively expensive and might cause a tiny bit of jittering when you only have 15ms to build a new frame. The best way to overcome this is by using the a thread pool. Here you park a few threads so ...
4
Disclaimer: my game programming experience is based around client-side single player games, but I have a background in web applications (specifically on the Microsoft stack), so that is where I'm coming from with this answer, I feel that much would apply, but without actual testing a real game server its difficult to say how it will apply, but here goes. ...
4
Consider your own format only if you can articulate demands that are very unique to your scenario, and even then - (good) mesh formats are extensible and would probably suit your needs.
If you're developing in the MS universe there's DirectX's own .X format, which personally I think is very well designed. It supports animation, optional compression, and is ...
4
Timer can handle it, your main concern will be memory usage with thousands of requests.
A suggestion is to create an Async timer with a callback to signal the table or player of an action. The function signature is this :
Timer( TimerCallback callback, object state, uint dueTime, uint period)
so instead of keeping track of the timer queue yourself and ...
4
It's perfectly acceptable to use events to handle things like clicks and other interaction with your button interface; it's certainly a superior method to the one that involves subclassing the Button type to implement customized behavior.
Another uncommon alternative is to attach scripts to buttons and other UI elements, but this is more involved (unless ...
4
Direct2D is using the GPU unless you specified not to use it... but unfortunately, Direct2D is in fact not as efficient as we would expect. There was a similar question on gamedev forum "Fastest way to draw connected lines?"
I ran again the test on your test case and the results are again a bit scary...
When you are trying to draw 10000 ellipse on the ...
Only top voted, non community-wiki answers of a minimum length are eligible