laztrezortMember Since 20 May 2009
Offline Last Active Sep 11 2015 04:10 PM
- Group Members
- Active Posts 428
- Profile Views 6,263
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
Posted by laztrezort on 13 September 2012 - 12:48 PM
Going from XNA to DirectX, you will see yet another massive reduction in productivity. This is not meant to discourage, but keep this in mind if your goal is to get a specific project finished, you will need to choose for yourself depending on what your goals are.
Posted by laztrezort on 09 September 2012 - 09:50 PM
I looked briefly at Tao, but it looked a bit too thin of wrapper for what I wanted, and doesn't look updated much anymore.
From the OpenTK homepage they claim it supports the latest versions of OpenGL, though I only used a small subset of OGL, and have so far only built/tested under Windows.
Posted by laztrezort on 23 August 2012 - 10:20 PM
I had success years ago using a tile map editor called Mappy http://www.tilemap.co.uk/mappy.php with Allegro - there is even a "playback" library you can download that has a minimal tile engine built in.
Note that this was years ago, so I'm not sure which version of Allegro it works directly with, so YMMV.
Posted by laztrezort on 14 August 2012 - 11:28 PM
With the DX debug mode enabled, are you still seeing debug output in the output console? what do the exceptions look like that you're receiving?
The only information it gives it an "HRESULT" value, "DXGI_ERROR_INVALID_CALL: Message Unknown", the rest of the exception data is default or unset. Output also gives no information. I get the stack trace up to the first managed call that produced the exception, of course.
Thanks Mike & JWalsh, I'll try these out and see what I can make work.
Posted by laztrezort on 07 August 2012 - 06:47 PM
So in other words you need the XNA 4.0 framework to run a program created in XNA?
Yes. Here is a rundown of methods to distribute an XNA application: http://rbwhitaker.wi...-game-tutorials
Using ClickOnce (the fourth tutorial) is probably the easiest way to distribute an XNA game.
Edit: to clarify, using ClickOnce will ensure that the end user has the necessary XNA libs and .NET libs, and downloading them if they do not.
Posted by laztrezort on 06 August 2012 - 03:25 PM
I would like to see an example in which writing a script is required (in lua for example), because I didn't found anything on the web..Most of examples I've read are writable in a simple XML format file! So when is suggested using scripting language? Ok, when the behaviour isn't static like NPC dialogue, but I can't figure that kind of situation!
You could store flags and/or condition keys with the XML file, so that certain dialog node is only produced if the attached flag/condition is true. You can also store "magic" attributes to do hardcoded actions, such as "Open Store" or "Give Key to Dungeon". You can insert special embedded strings into the dialog to control things such as "Pause Here" or "Ask for yes/no".
At some point, however, you will realize that you are basically re-inventing a scripting language, as the list of attributes and magic keys and embedded codes grows. Animations, taking player items, healing the player, etc. You may find that your design has become brittle, in that you now have to go back to the source code to change & add dialog logic, do a full re-compile etc to test.
At his point, it may be worth looking into leveraging full scripting, where all of the dialog logic is isolated into seperate scripts. These scripts can be modified (sometimes during runtime!) during testing & debugging without having to change the main source code.
The tradeoff is the complexity of adding the scripting support, which isn't exactly trivial.
If you haven't already, plan out exactly what the extant of and logic of your dialog will be. From your OP, if that is the extent of your dialog system, then it looks like you can just implement [Condition Flag][Dialog Node] nodes in a data file and call it day.
Posted by laztrezort on 02 August 2012 - 08:51 AM
However, to clarifty one point, you can definitely make 2d games in Unity - in fact, there is an entire tutorial available on their site for making a 2d platformer. My suggestion is run through that tutorial and see what you think.
Posted by laztrezort on 02 August 2012 - 08:41 AM
Here is an article describing one technique: http://www.gamedev.n...t-shadows-r2032
Here's another technique using XNA and shaders: http://www.catalinzi...mic-2d-shadows/
I thought there used to be another good article on 2d lighting on this site, it was a bit older but may have been useful, unfortunately I can't seem to find it.
Posted by laztrezort on 02 August 2012 - 07:20 AM
1 - Can anyone explain or link, genericaly, how side scrolling works in terms of programing (or more specificaly in XNA)?
Assuming you are using a tile map (or similar), you just have to draw the correct range of tiles at the correct offset according to the current "camera" position. There are various approaches to this, one is to draw the tile map to a rendertarget, but drawing an extra column, then draw that rendertarget to the screen on an offset. The best way to work this out is to draw it out on graph paper first. I don't know of any links offhand, perhaps searching for "smooth scrolling tile map" or similar may net you some good info.
2 - My Tetris game had around 10 classes, (representing the state manager, the generic state, menu state, game state, paused state, and the game classes, block, map, piece (the block is each square) and the current moving piece), all this to a simple tetris. Now, Do a big game really has a huge ammount of classes? Like some for each level? Or am I thinking of it wrong?
You shouldn't expect to get a perfect design at first. That is what refactoring is for. My method is to just plug away at getting something to work, then I factor out base classes & interfaces when it seems applicable. Experience will certainly cut down on the amount of this type of refactoring, but I doubt it can ever eliminate it.
My code often contains many classes, it helps seperate functionality. However, you should look for ways where composition is more useful - for example, I've never made seperate classes for each level of a game, since levels are expressed as data, not polymorphism.
3 - All of the games Ive made untill now had colision or movment based on a grid (the pacman movment was fluid, but could only change direction on intersections), so , being 2D or even 3D, how am I supposed to check for colision between lots of diferent corpses? I know it is easy for spheres, as I can go through each object and check arround the radius, but what about more complex shapes like a sprite with a transparency in 2D or a person model in 3D? Does XNA has anything to help in this situation?
Collision detection covers a wide range of algorithms and methods, but it is well understood and documented. I'll try and throw some search terms out that you can research if you want.
Likely the most common method are bounding boxes, more specifically AABBs (axis aligned bounding boxes). The only thing that XNA provides that might be useful for those is the Rect class.
AABBs are usually good enough (and simple to implement), but if not there are other shapes (such as capsules), and even "pixel perfect" collision detection.
For checking lots of objects, modern hardware can actually handle a lot of checks. However, when it gets to be too much, you need to start optimizing. This is where broad phase and narrow phase checks come into play. Basically this means that you can eliminate many checks right off that bat.
As objects start to move quickly, it gets a bit more complicated ;). Since checks are only done every 60th (or whatever) of a second, fast moving objects can sometimes go through other objects before a collision check is made. I believe this often referred to as "tunneling". There are a whole slew of methods to address this issue, some of them get pretty advanced in terms of maths.
Note that we still haven't said anything about collision response, just in answering the question of whether to objects are colliding (intersecting). They may be touching, or one may be inside another, or (going back to the previous paragraph) we may have determined that they passed through each other in the last frame. How we want to resolve the collision is a different matter. Here is where physics libraries come in handy, which is what I usually fall back on as this stuff is mostly over my head.
Posted by laztrezort on 01 August 2012 - 07:57 AM
2. Im trying to learn somewhat off terraria's source but its really messy and doesnt use things such as inheritance. Please recommend any well designed games that has its source available to learn off (C# would be nice).
If you are using XNA, I would look through some of these: http://create.msdn.com/en-US/education/starterkits/, and poke around for other code examples on that site. There are many examples, they have been designed by some smart people, and they even include comments
Posted by laztrezort on 31 July 2012 - 12:48 PM
I could be wrong, but I would rather not iterate through a nested loop to render each tile as the screen scrolls. I've looked at several xna tile engines that use that sort of algorithm and I can't help but think it's not optimal. I would much rather pre-render the entire map in memory and then blit the window to the screen as it scrolls around.
Unless there are other considerations I don't know of, I can guarantee that such an approach will be fast enough (as long as you are not iterating far beyond the extents of the screen). I can also almost guarantee this approach will be far easier to implement than what you are describing as an alternative. I am also 80% sure that just iterating through and drawing all the tiles will actually be quicker than creating some sort of memcpy routine.
In short, SpriteBatch can throw many, many, many sprites onto the screen without a hiccup, unless you are doing something incorrect. If you haven't already, try out a quick prototype, you may be suprised.
If for some reason you do want to pre-render the entire map, just use a rendertarget to do so (you will need to stay within the limits of the graphics card constraints for texture size, however).
If you really, really want to implement a way to transfer data to a texture (not recommended!), then look at Texture2D.SetData and GetData methods.
Posted by laztrezort on 31 July 2012 - 07:02 AM
something like SDL.NET is far more exciting because nothing is done for you
It's been a long while since I've used SDL (and never the .net wrapper), but I don't remember it being particular "close to the metal" anyway. If you really want to dig into the inner workings of these systems, you will have to interface OpenGL or DirectX.
There are also some thin wrappers around DirectX and OpenGL you could use, some I've heard of (but never used) are SlimDX, SharpDX and OpenTK. I believe there is a book on using C# with OpenGL, but I do not know the name of it offhand.
Also, XNA is just a framework around DirectX, you don't have to use (for example) the provided Game class, or SpriteBatch, or BasicEffect. In fact, I'd wager many developers end up rolling their own versions of these classes specific to their needs anyway.
Posted by laztrezort on 27 July 2012 - 01:43 PM
A quick glance over the OP it looks like you are basically using a type of cellular automata, if that is the case then you could read this for some ideas: http://www.gamasutra..._automation.php
For optimizing, you will need to restrict the number of calculations that need to be made, there is really no other choice. This can be done by constraining the simulation to only those areas that need it and/or precalculating as much as possible.
I'm reaching on this one, but it also may be possible to memoize fluid calculations somehow (see here for example: http://en.wikipedia.org/wiki/Hashlife). If even applicable, this could greatly increase simulation speed (at the cost of memory obviously).
For determining feasability, the only way is probably to just bite the bullet and prototype the simulation.
Posted by laztrezort on 26 July 2012 - 08:45 AM
If the the OP is using or extending an API, then possibly it would make sense to me, although a bit odd.
For my part, I am unsure of the OP's famiarity with C#, so my first intuition was that there was some confusion about ref paramters vs. pass by reference. I know coming from C++ this was a point of confusion for me.