Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I would like to make a 3d animation of a few dozens of primitives
I read the initial position of each atom and with other parameters I need to draw an animation that describe the ordering. I need to view then of all angles, manipulate the color and alpha channel.
All in all, it narrows to WPF 3D or XNA.
I would choose WPF, because I know it and it is a way much easier to add a TextBox to the app.
Yet I am afraid that WPF won't handle the animation or it would be problematic if I need to add some extra bits.
Which one is better for it? Can you point me to some examples how to manage datastructres and draw the animation? (I am new to 3d animations)
EDIT:
If anyone is interested in here the code and the app http://alloysvisualisation.codeplex.com/ I use Model3DGroup to build a mode from GeometryModel3D. As a result, performance is pretty good.
We use both WPF and XNA for 3D rendering in the projects I'm currently working on. The XNA stuff is used from within a WPF application, so there is no problem using those two combined either.
I would use WPF for the 3D rendering if you have a simple scene since I like the abstraction it gives you. You simply add objects to the scene, set up some cameras and lights and the rest is handled for you. We use WPF for a visual editor containing up to ~500 cylinders without any performance problems. The one performance issue we have had is that it takes a long time to add/remove objects from the scene. So WPF is not a good fit if that is something you need to do a lot of.
However, if you have more complex needs or if the application is performance critical I would go with XNA to get closer to the metal. It gives you a more "classic", OpenGL like approach to rendering.
To summarize:
WPF:
Simple to use
Nice abstraction
Ok performance overall
Poor performance when adding/removing objects
XNA:
Close to the metal
Good performance
Feels more like OpenGL if you are used to that
Works with both WinForms and WPF
A resource that we have used for the WPF side of things is Charles Petzold's writings on the subject. We currently use stuff from his library. It got us started quickly, but we've had some issues, so I would recommend some caution. However, the stuff on his site is worth looking at.
XNA + WPF is the solution. This article will guide you through the process: http://www.codeproject.com/Articles/38301/XNA-integration-inside-WPF
Definetely XNA is faster and more convenient for extensive 3D work. WPF is fine for 3D, but XNA is easier to debug and offers several nice features, such as additive alpha blending and a Camera object. Also, you can find good libraries to support your work.
If you are not sure, then you should without doubt use an XNA object to draw the graphics. WPF will provide you with buttons and text, which, in turn, are a pain in XNA.
Xna will offer easier debugging of the 3d aspects.
You could follow the winforms example to host xna in a windows forms form and then all the familiar controls like drop downs and buttons will work fine and interact with xna.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am writing a game in WinForms, using c#. Well, I absolutely love Visual Studio and WinForms, because coding is very simple, and there is usually no need in any additional content.
The game is text based, but it is also heavily based on UI. But, WinForms has no transparency, and this is something that hurts alot. Interface, labels and pictures are created and positioned dynamically.
I thought about moving to WPF, but I do not know, if i will be able to place controls dynamically in WPF like in WinForms (because WPF is based on grids).
Should I learn more about WPF, or there is any simple WinForms-like analogs, that support transparency and will allow me to create text-based games with UI?
P.S here is image, its QSP game (not mine, but it is something that I want to achieve, but have improved UI, transparent images, and etc.)
Since this is a multi-part question, I will not attempt to address any one specific question but rather provide resources to allow you to embark on learning WPF on your own, and assure you that moving to WPF is a safe choice for converting your application.
I thought about moving to WPF, but I do not know, if i will be able to place controls dynamically in WPF like in WinForms (because WPF is based on grids).
Yes, you can generate, create, and position content dynamically in WPF. See links for example code.
Should I learn more about WPF
Yes, you should learn more about WPF.
or is there any simple WinForms-like analogs, that support transparency and will allow me to create text-based games with UI?
Yes, you can create transparent windows and transparent controls in WPF.
I hope these resources are useful to you.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm developing a Windows application that would allow the user to fully interact with his computer using a Kinect sensor. The user should be able to teach the application his own gestures and assign each one of them some Windows event. After the learning process, the application should detect user's movements, and when it recognizes a known gesture, the assigned event should be fired.
The crucial part is the custom gesture recognizer. Since the gestures are user-defined, the problem cannot be solved by hard-coding all the gestures directly into the application. I've read many articles discussing this problem, but none of them has given me the answer to my question: which algorithm is the best for learning and recognizing user-defined gestures?
I'm looking for algorithm that is:
Highly flexible (the gestures can vary from simple hand gestures to
whole body movements)
Fast & effective (the application might be used
with video games so we can't consume all of the CPU capacity)
Doesn't require more than 10 repetitions when learning new gesture (repeating gesture more than 10 times to teach application is in my opinion not very user friendly)
Easy to
implement (preferably, I want to avoid struggling with two-page
equations or so)
Note that the outcome does not have to be perfect. If the algorithm recognizes wrong gesture from time to time, it is more acceptable than if the algorithm runs slow.
I'm currently deciding between 3 approaches:
Hidden Markov Models - these seem to be very popular when comes to gesture recognition, but also seem pretty hard to understand and implement. Besides, I'm not sure if HMM are suitable for what I'm trying to accomplish.
Dynamic Time Warping - came across this site offering gesture recognition using DTW, but many users are complaining about the performance.
I was thinking about adapting the $1 recognizer to 3D space and using movement of each joint as a single stroke. Then I would simply compare the strokes and pick the most similar gesture from the set of known gestures. But, in this case, I'm not sure about the performance of this algorithm, since there are many joints to compare and the recognition has to run in real-time.
Which of these approaches do you think is most suitable for what I'm trying to do? Or are there any other solutions to this problem? I would appreciate any piece of advice that could move me forward. Thank you.
(I'm using Kinect SDK.)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm designing and implementing the GUI for special application.
I'm using WPF on C#,
I intend to apply this app for different monitor resolutions (1366x768 or 1920x1080,...).
But I don't have any experience for this. I don't know how to implement the flexible GUI that can display on any resolution well.
Someone can give me the ideas?
1 - Write your XAML by hand and don't use the Visual Studio designer.
The designer produces fixed-size fixed-position UIs (ala winforms) and will not be useful if you need resolution independence.
2 - Do not fix the sizes and positions of the UI elements yourself either.
Don't do things such as <TextBox Width="56" Margin="50,30,10,5"/>. Instead of that, place your UI inside resolution independent layout containers such as Grid or DockPanel. Use Star Sizes in your Grids, too.
Edit: Adding #Viv's comment, which is so important I decided to make it part of the answer:
Like everything else in programming, take point 1 with a grain of salt. Don't make it another statement like "In MVVM ANY code in code-behind is wrong". Using the Designer(VS/Blend) for things like generating Template's, Modifying Storyboards, VSM, Importing Illustrator/Photoshop files is perfectly reasonable. Know what you're dealing with and even if in such cases you get constant dimensions, tweak the xaml accordingly to get rid of it than totally neglect every aspect of it
Firstly, it depends somewhat on the nature of the application, however the resolutions you specify are not MASSIVELY different in the grand scheme of things (if you were comparing 640x480 to 2560x1600, then you might have even bigger concerns!), so likely, if you choose the right components, they will organise themselves (or more aptly, the OS will organise them behind the scenes) for you.
The fact that you've chosen WPF means that you have massive flexibility with how UI elements will render, as WPF is natively a vector based rendering engine, as opposed to Windows Forms (GDI/GDI+) which was a DPI/per-pixel based rendering engine.
But lets delve a little deeper into this shall we?
Say for example you were designing your UI in Windows Forms, and it required a ToolStrip on the form, and then you all 1000 buttons to the ToolStrip. Okay, on a massive monitor, you might just see all 1000 buttons, but on your bog standard 1080p monitor, you might only see 30 of them; so what happens to the rest? - Windows will put these in a sub-menu for you, at the end of the ToolStrip, so that you can still access them, even though they are not on the main (visible) section of the ToolStrip. I'm pretty sure that the same principle will apply to WPF, through you will likely have even greater control over how things render, and appear!
The great thing that WPF brought to the table, through vector rendering, was resolution independence. This gives you the flexibility to decide if you want your elements to render as a "fixed" size (across any resolution, it will always use the same pixels), or, allow the engine to dynamically resize the element according to the resolution (on a low resolution the element will render using less pixels but will suffer with lesser quality, or on a high resolution, will render using more pixels and will have a much higher quality).
To get you started, here's a free WPF eBook from SyncFusion (seriously, check them out, they give away quite a bit of free, decent stuff!)
WPF Succinctly
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Back in the day it was easy; You made your own 3D stuff, then came DirectX, then came OpenGL. For .Net developers MDX was nice. Then XNA took over for MDX, but it its not the same. XNA seems to be very game-centric with all the content pipelining and preloading of fixed models and stuff.
So where do we stand now? After a couple of days of reasearch/trial&error I feel everywhere I look I find half developed libraries, libraries with overhead, severe limitations or libraries that are overly complex.
I want to do "free-hand" 3D stuff. For instance displaying 200k dots on a screen in 3D and move them around at 30fps (Kinect depth image). I want to make 3D screensavers, audio analysis plugins, etc. All of which is not prefabs for a content pipeline, and which require high performance. And (ehm) I want to do it from .Net.
Anyone have experience with libraries that are easy/understandable and still gives some fair amount of freedom and speed?
I seem to have landed on OpenTK. I think it gives more or less direct access to the OpenGL API and doesn't require loads of dependencies.
It is comparatively easy to understand. It requires few (and understandable) lines of code to get started. It doesn't hold the objects for me so I'm free to change anything for each pass, which is great because I'm mainly working with unsafe pointers to memory.
It is of course difficult to combine speed with ease of use. Speed requires talking directly to the 3D API while ease of use requres abstraction. Therefore this must be considered a lower level API than some of the others I've tried. If I wanted to do some prefab character animation then XNA would probably be a better choice, but for my use (described above) this seems very promising so far (4-5 hours of hacking).
Some sample code:
private void Render()
{
// Every frame
GL.MatrixMode(MatrixMode.Modelview);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.LoadMatrix(ref cameraMatrix);
GL.Begin(BeginMode.Points);
// Here I can add lots of points. I add 200k without any big problem.
// It seems these points could have been passed in as an array pointer too,
// but I'll look at that later.
GL.Vertex3(x2, y2, z2);
GL.End();
glControl.SwapBuffers();
}
If you liked MDX, SlimDX should be right up your alley. It's basically a replacement for MDX, but with a lot of the questionable design decisions fixed up, and a lot more functionality included. Anything you had with MDX, you will find present in SlimDX in one form or another.
Alternatively there is another C# wrapper package for OpenGL: OpenGL DotNet. Works great for me! Check it out at http://www.taylaninan.com/opengl-dotnet.php .
It wraps OpenGL up to version 4.4 and supports over 550+ OpenGL Extensions. It also supports GLU, GLUT, FreeGLUT, DevIL (Developer's Image Library), ILU and ILUT for DevIL.
It a low level API for the above libraries.
We faced a similar issue some time ago and the following represents our opinion only of course. One of our main concerns was that the library should be versatile, produce 3D images of very good quality, free, and not put loads of extra constraints on the installer, i.e. like with XNA where you have to have the correct files installed. This seemed like a possible source of headache. In the end we settled for DirectX and wrote the GUI in C#. All needed interaction with the 3D was done with wndproc. This provided us with both the power of DirectX and the ease of GUI development with C#. We haven't regretted this at all.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am trying to figure out what game engine I should use? Right now I am trying to pick from toque, shiva, and unity. I will be learning c# and objective c so I can develop iphone games, some windows games, and possibly xna games for xbox.
Also any tips for learning objective c, c#, and designing and coding games?
Best thing for the future is to do what RaYell said in his comment. Start with ONE thing, learn it, and learn it thoroughly before moving on to something else. If you try to take on a half dozen things at once, you'll have broad surface knowledge across all of them, but not enough depth to do anything useful with any of those technologies.
Depth-first > Breadth-first when it comes to learning programming. ;)
If you want to go for both iPhone and XNA then I would consider going with Torque as your engine. They have versions of their 2D and 3D engines for both of those platforms, as well as for the PC, so you can have a fairly similar experience and toolset when developing for all 3. Not exactly the same, but pretty close.
You don't have a choice when developing for iPhone. You'll have to use the Apple iPhone SDK. I think this requires you programming in C (I think).
Likewise, if you're developing for XBOX (and you don't have the corporate XBOX SDK that real game studios purchase), then you'll need to use XNA. You can use the XNA framework (free environment and framework), but you'll also need to learn C# (or VB.NET although officially just C#). Using XNA also lets you build games for Windows environment.
I think you should probably start with something simple before jumping into either XNA or iPhone SDK. Even using something like VB.NET (VS Express is free) windows form app for a simple game like tic-tac-toe would be a good starting point.
It seems like you need to learn a different language and a different framework/sdk to reach all of these environments, so I'd recommend picking one and trying to learn that before you try to learn multiple things. Since C# and VB.NET (and XNA) are all free, have free tutorials, and free development environments (and you're probably using Windows, so you have the requirements) then I'd recommend trying one of these things first. That way, you can see if its something you really want to do. Building games (and software) isn't an easy job, so make sure you do a lot of research and learn the fundamentals before trying to jump into game programming.
I'll add my two cents regarding Unity. I haven't worked with Torque and haven't even heard of Shiva until now (it looks interesting).
My (somewhat limited) experience with game development is that above all, there is a huge amount of learning involved with the game development world and you really need to choose carefully where you spend your time.
You're on the right track looking at comprehensive game engines that include middleware tools. If you really want to make games (and not game engines), you'll want to focus exclusively on generating assets and game logic.
I have worked with XNA and can say that, by itself, it doesn't provide any of the middleware tools you'd need to build a complete game.
As for Unity Vs Torque, I choose unity because of their strong focus on C# (which will only grow more central in their upcoming release). Furthermore, the two communities are vastly different. Torque developers take a lot of pride in the fact the Torque includes the source. It is regarded as more difficult to work with, but will allow you to learn about the core code. Unity is closed source, has an active community and focuses on game development. Their community's attitude is that they are not there to rewrite game engines and that if there is a bug, the Unity team can and will solve it faster and better (they do a great and speedy job of resolving bugs).
My coding philosophy is more to the second. I want to make a game, not a game engine and I prefer a comprehensive tool rather than multiple tools that you have to tie together. Unity is very professional and you can get up to speed very quickly. I'm having a blast developing in it and have gotten concept work together very quickly.
Also, you'll need to learn at least basic 3d modeling and animating. At the very least, you should be able to block out some characters and find an artist to make the real versions later. I strongly recommend Digital-Tutors great series on creating Next-Gen game characters in Maya and ZBrush. Its a series (you don't need the XNA part).
Best of luck. Above all else, make a specific plan and stick with it.
I heartily recommand XNA, not only is it free, well documented and easy to use, but it now runs across all mobile platforms with its open source incarnation MonoGame. You can also avoid having to learn different languages for each platform, C# to rule them all. And C# is a great language in itself.
I suggest starting out with the riemers.net tutorials and working from there. There are many others: that's one of the biggest advantages of choosing this technology, the sheer amount of tutorials and support online.
More importantly than learning an engine or a language (dialect) is to focus on something you can actually pull off in a reasonable time frame. Biting off more than you can chew (common in indie game development) will just deter you from ever trying again. Game development is difficult, an engine is no shortcut.
Aim on a simple, single-player, 2D graphics game. If it's really your first game, you should use generated, ugly-looking content rather than trying to load resources from disk, which probably just complicates things. Build it from the buttom up. You will learn the basics on memory organisation, sprite/bitmap workings, sounds, operating system interaction, to mention a few things.
When you know how to do that that and know it well, you can move on to an engine like Torque; and then you might actually put it to some use. And hey - good luck and have fun!
Edit: You might also be interested in using a rapid game prototyping tool such as Trabant. With such a tool you can try out game concepts in minutes rather than days. When you know what you want, you build it using UE4 or some other game engine. Disclaimer: I'm the author of Trabant.