No Responses to “”

  1. Geek Says:

    I hope you’ll port it to the 360 now that it can be done. I look forward to seeing your progress :)

    btw nice transition effects ;)

  2. Sharky Says:

    cheers! :)

    I’ll look into that XNA stuff one day. It sounds mint!
    I already have my game working with an XBOX 360 Controller, so why not eh!
    For now I’ll keep plodding along with DirectX 9.0c.

    I’m guessing I’d need Vista & DirectX 10 to have a go with XNA.

  3. Geek Says:

    All in good time eh, btw if you need any “play testers” am always happy to help :)

  4. Sharky Says:

    Excellent!

    You’re most welcome to. I’ll be putting the latest build up for download soon, so stay tuned.

  5. Martin (AKA NadNailer) Says:

    It was a great round, BUT, it was better than the screenie suggests. If you look at the ticket count in the top right hand of the screen, you can see that the game wasn’t even over. As I recall, SaltedMirken and SharkBiscuit ended up 1 and 2 for the round, and with greater scores than what you can see. =NAD= is growing, before long we’ll be able to enter competitions. Watch out!

  6. Sharky Says:

    indeed! Plus we have NadNailer’s secret Weapon Of Mass Humiliation – which I think should remain nameless in this blog. ;)

  7. John-Daniel Trask Says:

    XNA will work just fine with DX 9 & Windows XP. XNA is not just an API but a development environment for managing all your digital assets pertaining to your game development.

    There were some good sessions about XNA Studio at last years TechEd. I’ll see if they have much on XNA this year.

    – JD

  8. Sharky Says:

    I feel a blog coming…

  9. JD Says:

    Good to hear we can’t fly off the screen but seriously, lets get to some senseless killing! :)

    – JD

  10. Sharky Says:

    Senseless killing of what exactly? Perhaps my next step should be mulitplayer LAN action? (that’s my goal actually, but I don’t think I’m ready for that just yet)

  11. Jeremy Says:

    Wicked! But come on, what good is shooting if there is nothing to shoot at ;) Make sure you add some stationary object to aim at, please?

  12. Sharky Says:

    I might throw another Spitty into the mix (i haven’t embarked on an Me-109 model yet).

    I’ll probably just make it fly around randomly at this stage – I don’t want to get bogged down doing scary AI code just yet. In fact I’d rather focus on simple network multiplayer action berfore single player. I’m a firm believer in letting the player(s) invent the gameplay themselves to some degree. Give them a sandbox and some toys, and we’ll see where it goes from there. ;)

  13. jd Says:

    Great to hear :)

    And we need weapon upgrades – that’s important. When I blow a plane up I want to get a freakin’ gattling gun or h-bomb upgrade.

    – JD

  14. Jeremy Says:

    So how do you shoot? I downloaded the latest version but not sure how to shoot?

  15. Sharky Says:

    To shoot, use the SPACE button.

    Or, if you have an XBOX 360 controller it’s the A button.

    ;)

  16. Jeremy Says:

    Okay, works now, after getting the right version (damn proxy server caching).
    The file rename fixed it :)

  17. Sharky Says:

    Kick arse!!

  18. JD Says:

    Looking good man :)

    Gravity would be cool – make sure you seperate your physics code as much as possible from your game code so you can eventually seperate out the engine :)

    – JD

  19. Sharky Says:

    Yeah, good plan that! :)

  20. JD Says:

    Is a HLSL similar to the rendering languages created by NVidia and ATI for their specific cards?

    – JD

  21. Sharky Says:

    As far as I know, HLSL is a directX standard, that compliant hardware has to handle.

    Hardware branded as “DirectX 8″ does Shader model v1.1. Hardware branded as “DirectX 9″ does Shader model v2.0. I think there is also a Shader model v3.0, but I’m not sure what/if any hardware does that yet. Probably a Vista/DirectX 10 thing.

    Anyway, to answer your question. I believe nVidia & ATI have some optimized “features” that can be exploited, but the language itself is probably the same.

  22. Jeremy Says:

    And in VS 2005 or any of the Express editions you can do this through the UI! Just add a resource file and then start adding your files through the nice interface. The coolest thing is all the resources are strongly typed and accessible through the Resources class.

  23. Sharky Says:

    REALLY?

    Shite, I hadn’t unearthed that one. DAMN IT, I hate the fact that I’m still having to do old skool VS.2003 professionally. It’s precisely WHY I got into the Game Dev hobby in the first place – knew I needed to keep up with VS.2005 + .NET 2.0.

    Thanks for the heads up Jerms!

  24. Debz Says:

    same problems here…. but connecting to a server in dallas texas… normal ping of 230ish now anything from that to 30thou…. done alot of research found a alot of others with same problem…. my vent server has just changed codecs but still pinging big…

    drop me an email if you like….

  25. Sharky Says:

    Cheers for that.

    I’m wondering if the traffic is being shaped at certain servers (because it’s VoIP etc…). Someone suggested I check if Vent supports Encryption. If so, it could work around any shapping.

    Anyway, our problems have actually gone away (not resolved), because my Wife’s GuildWars buddies found another Vent server to use for low $$$.

  26. riemer Says:

    Hi there,

    I’m writing my HLSL tutorial to be a starting point for the absolute HLSL beginner, if you have any additional ideas I should add, let me know!

    –riemer

  27. Sharky Says:

    Hey thanks for that.

    I’ll certainly be in touch.

    :)

  28. Sharky Says:

    I’ll get the ball rolling!

    XNA or not Game development IS hard!

    I would like to see more HLSL tutorials that explain even the simplest things. Beginners like me need a careful guiding hand before some of these things click and become understanding. The answers are out there, but most tutorials & forum threads I’ve read assume you know a certain amount of the 3D math, color theory, circuit diagram of the 1.21 gigawatts flux capacitor blah blah blah… You get the point?

    With XNA out now there is a growing flood of people just like myself looking for answers in small words. We’re not necessarily grounded in any of the theory that a game dev professional might be, so some might scoff at the thought. However, we’re keen, VERY keen! Who knows, the next John Carmack might be reading this very blog!!! ;)

    For example: I’m not worried about how Matrix Math works, or why it works. So far I’ve got by not needing to. I certainly don’t remember it from school!!! But it’s very helpful to know what a particular Matrix multiplication is trying to achieve, and in language light on jargon.

  29. Sharky Says:

    And here’s another…

    I wouldn’t have a clue how to write one, but I’d very much like to see a tutorial with samples of an HLSL Skybox / Skydome, from a TextureCube. i.e. one that makes a spheracle background sky, rather than a cornered box. I gather it can be done, but I’ve given up finding a sample I can actually get working in the context of XNA & C#.

    I’ve seen this one.
    But I had no success getting it rendering anything at all. Possibly because the mesh and texture were embedded in the .x and .fx files, rather than being provided by C# code. I guessed at how to refactor it, but alas, no success.

  30. riemer Says:

    OK to keep this thread rolling :)

    I see some pretty contradictory demands in your posts.. I consider HLSL already as quite advanced in 3D programming. I think when you move over to HLSL, you already have a understanding of basic 3D stuff. That’s why you won’t find a HLSL tut that explains matrices is basic detail. However, most tutorial sites have pages that explain those points in detail, apart from HLSL, color theory, or a circuit diagram of the 1.21 gigawatts flux capacitor :) You can read my pages on matrices, starting from http://www.riemers.net/ExtraReading/matrices_geometrical.php

    As in your second post, the example you mention there again is pretty advanced, so people not knowing what a spheracle background sky is, will already be turn away from the tut before reading it.

    BTW…. what exactly is this 1.21 gigawatts flux capacitor ??? ;)

  31. Sharky Says:

    Thanks Riemer, and Yes, I agree totally with you on every point.
    I am being very contradictory, and I had the feeling the Skydome one would be considered advanced. (I just have a need for it right now, as would others I imagine).

    In my game at the moment, I have about 4 .fx files for various things.
    - cloud rendering (alpha blending for transparency, no lighting, but they need to fade in and out, and colour tint to match the background sky colour). I didn’t use sprites because I needed them to render with perspective according to their Z position in the world.
    - the planes (nice lighting)
    - the bullets (nice lighting)
    - and the Skybox (unlit, no Zbuffer, just a box at the moment).
    In all cases, these .fx files have been put together or modified from samples, or tutorials I’ve found, and somehow I’ve made them work.

    I imagine I’m not alone in this situation. This is the difficulty with so many beginners, particularly myself NEEDING to pick up HLSL very quickly. XNA doesn’t allow the Fixed-Function Pipeline thingy anymore, so rendering pretty much anything 3D requires some sort of HLSL, unless you can get by with the BasicEffect class.

    I just used the Matrix thing as an example to get my point across. I think to summarise, more explanetory Code commenting with minimal jargon would be fantastic.

    (By the way, I’m not singling out your tutorials. In fact yours seemed much better than most I’ve seen, and I’d really like to spend some time going through the whole lot. ;) )

    I realise at some point, that it gets unrealistic, and people like me are just going to have to accept they are swimming in the deep end, and perhaps learning a little theory would prevent sinking ;)

  32. Sharky Says:

    p.s. I present you the Flux Capacitor….

    http://en.wikipedia.org/wiki/Flux_capacitor

    ;)

  33. riemer Says:

    My point exactly. I haven’t yet had a decent look at XNA, but from what I’ve seen up till now, shaders are needed for almost everything. This makes simple things a lot more complex, and at this moment I absolutely don’t have a clue what a first (’Hello world’?) tutorial on XNA would look like..

    I’m going to finish my 3rd series first, after that I’ll try to figure out what would be the best way to learn XNA.

    Oh and, it seems to be Jigowatt… You were right about the 1.21 though :)

  34. Sharky Says:

    Ah yes, the “Jigawatt” indeed!

  35. John Hurliman Says:

    I would love to see a set of HLSL tutorials that start from the very ground up. I’ve found plenty of “here’s how to make a realistic water shader!” followed by 100 lines of code, with no explanation of what each part is doing. Start from the very ground up, such as how to add a color tint with a pixel shader, or do a very simple vertex modification with a vertex shader.

  36. Sharky Says:

    Thanks John.

    Yeah, I know how you feel.

    I might be able to help you with the color tint thing. I don’t have the code in front of me (I’m at work), but from memory it was something like:

    outputColor.rgb = outputColor.rgb * tintColor.rgb;

    where tintColor is a global(?) variable Vector4 passed in to the shader using the Effect class at render time.

    I believe this is equivalent to doing:

    outputColor.r = outputColor.r * tintColor.r;
    outputColor.g = outputColor.g * tintColor.g;
    outputColor.b = outputColor.b * tintColor.b;

    I will confirm, and blog it along with my Cloud.fx hlsl source code ASAP.

    Stay tuned…

  37. C#Re_eYe Says:

    any source codes?

  38. Sharky Says:

    Hmmm… sorry, well Yes and No actually.

    I just blogged the about it over here…

    http://sharky.bluecog.co.nz/?p=82

  39. C#Re_eYe Says:

    thanks buddy :)

  40. BlackICE Says:

    Your game looks really cool, I was wondering if it was possible to either turn of multisampling, or add it as one of your options in your xml file, so people like me with lame laptop graphics cards can give it a spin.

  41. Sharky Says:

    Ok, good idea BlackICE. I’ll do that. Now to find out how…

    My XML file … LOL … you’ll see it’s still full of the Spacewars sample stuff. Must clean that up. ;)

    Thanks for the feedback.

  42. Zygote Says:

    holy shit this looks hot!

  43. Sharky Says:

    aw shucks – thanks!

    :)

  44. Derek Says:

    I tried it out and immediately thought of Time Pilot, but with nicer graphics. Are you using a 3D model or is that prerendered?

    Also the game runs slowly on my system – it looks like it’s hitting about 10-15 fps. Admittedly, the machine I’m using has a crap video card but considering the low complexity of the scene, it seems it should run faster.

  45. Derek Says:

    Ah, I poked around in your config file and saw the multisampling option. Things run much more smoothly with multisampling off. And that’s obviously a 3D model.

  46. Sharky Says:

    Yeah that’s right. Time pilot was the original inspiration – years and years ago when I became a geek programmer. ;)

    My point of difference is that I intend to put in a ground, rather than an infinite sky like there was in Time Pilot. The idea being that you would have to land occasionally to refuel / restock with ammo every now and then. Plus I plan to add levels featuring Air-to-Ground bombing missions.

  47. Derek Says:

    I played Time Pilot like a maniac when I had it on Colecovision, but the semi-updated graphics on the Xbox Live version didn’t do much for me.

    I’m sure there are plenty of other people out there who’d be interested in seeing your progress. Why not post it up on my site (www.threesixbox.com) and get some more exposure? You could post a link back to this site in your project description as well, hopefully netting yourself some new admirers.

    Regardless, I’ll pop back in every once in a while to see how the game is progressing.

  48. BlackICE Says:

    Thanks for the Multisampling option!

    Unfortunatly I’m still getting an error, I suppose thats because its starting with multisampling on. :(

  49. Sharky Says:

    DANG! I wonder what’s up with that BlackICE?

    Are you’re sure it’s the Multisampling?

  50. XNAtutorial.com » Weekly Update Says:

    [...] Lawrence is working on porting his code to XNA, and has . He might not share his source, but he is asking if you want to know anything in particular, as he shares code snippets. (Game Zip) (Screenshot) [...]

  51. Omegaman Says:

    I was wondering what file format you were using for your models and if you could share some of your mesh code and the shader you used. If you don’t want to share that maybe what tutorials you looked at to get your models into the game and why you used that specific one.
    Thanks!

  52. Sharky Says:

    Hi there.

    I’m currently using the SWM mesh format & loading code straight out of the Spacewars sample.

    My shader for the planes is actually based another piece of Spacewars. I think it was called Ship.fx.

    I will blog with my fx file soon. Not right now though. It’s late here, and I’m exhausted from playing BF2142. :)

  53. BlackICE Says:

    Well the errors I get are not very informative, so im not entirely sure. Im just wondering do you have it defaulted to start with multisampling, then as it starts the graphics device, my computer has a fit, before it gets a chance to turn it off.

    Thankfully Microsoft are MEANT to be fixing this issue for the full XNA release!

  54. Omegaman Says:

    Thanks for sharing the info. Keep up the good work!

  55. JD Says:

    That’s great :D As we all know, once it’s smoking it’s *about* to explode – I look forward to the next release with explosions ;)

    Remember – planes holding bombs make bigger explosions ;)

    – JD

  56. Sharky Says:

    hehe

    :)

  57. Ianski Says:

    That smoke certainly is impressive, well done :)

  58. Sharky Says:

    Thanks.

    :)

  59. Ultrahead Says:

    Nice screenshots.

    Regarding the build, as I have WinXP Pro 64-bit i couldn’t run it.

    If you want 64-bit users to be able to run your game build it targeting x86 platform only.

  60. Sharky Says:

    Ok. I didn’t know that one. Thanks for the heads-up!

  61. John Hurliman Says:

    Sharky thanks for the help. I went out yesterday and bought a book on Managed DirectX which covers shaders, and most everything applies to XNA with a few code tweaks. I have a basic XNA app written (video here: http://www.jhurliman.org/index.php/2006/sceneviewer-video/) and will try out your color tint pixel shader now.

  62. gamehunter101 Says:

    cool man

  63. gamehunter101 Says:

    oh thx for the info

  64. David Weller Says:

    Hey! Write to me…we want permission to showcase your game in a video of XNA community games! We need a response by Wednesday, otherwise I have to go find somebody else :-)

  65. Sharky Says:

    w00t!!!

    (sent you an email David)

    =)

  66. dommafia Says:

    Great game! Would love to see a speed variable though. Like having a key for slowing down a bit or a key for a small boost. This would add more dynamic to the game. Maybe you can earn “turbo” slots for each plane u shoot down? i don’t know, i’m just sharing some ideas ;)

    I doubt you’ll ever have free time for a tutorial ( :( ) but we can hope to see your source soon so we can dissect and learn ;)

  67. Sharky Says:

    Thank you! :)

    Hey, I really like those ideas. A “full throttle/boost” button would be very cool.

    I’m very happy to share snippets of code, but not planning on sharing the entire solution.

    See my earlier post.

  68. JD Says:

    It could be the capital letters… it could be the three exclamation marks… either way it seems you’re excited :)

    Does this include the content pipeline you wanted? :)

    Time to start doing one click deployments with automatic updates of your build too btw, then you can put a link it to the redist. for folks who you detect don’t have it :) Will help ‘hook’ those people who like your game.

    Keep up the good work.

    – JD

  69. Sharky Says:

    Yeah man, the Content Pipeline IS included.

    Yeah, some kind of installer/one-click deployment would be the bizness!

  70. XNAtutorial.com » Weekly Update Says:

    [...] Lawrence is also improving on his Air Legends. It’s actually kind of playable right now, so do check it out. [...]

  71. Buzzrick Says:

    Looks great sharky. I can’t wait to see this on the new XNA game studio release.

  72. Sharky Says:

    Hey thanks for that.

    Wait no longer. I’ve just uploaded the XNA v1.0 converted build, now with Sound Effects!

  73. XNAtutorial.com » Weekly Update Says:

    [...] Sharky’s Air Legends now support explosions. [...]

  74. Ultrahead Says:

    Hi Sharky,

    I’m having difficulties to run the exe (all versions). When I try to run the exe everything goes black in a sort of weird loop (until I press ALT+F4).

    My OS is WinXP Pro 64-bit (and yes, my card supports shader model 1,2 and 3). Maybe you are compiling each version targeting “all platforms” and thus, as soon as the exe runs an exeption is infinitely caught since a “bad image format” exception will pop up for 64-bit machines.

    Verify whether you are compiling only to “x86″ (it is the only workaround for this so far). If you are, then I don’t know what else may be happening.

    Anyone else with 64-bit OS is getting similar results?

  75. Jon Schwartz Says:

    Hey Lawrence, XNA dev that you are, thought I’d let you know that I blogged about the XBox.com video from Monday night’s XNA Open House at Microsoft. Also on Wordpress – my name should link to the blog.

  76. Sharky Says:

    Ultrahead, sorry to hear it isn’t working for you. I know it works for some others that have downloaded it. I built it exactly the same as I have done previous releases, except of course this is now an XNA v1.0 game.

    I’m not sure what my build target is, but I have never changed it. X86 sounds familiar though.

    Have any of my previous releases worked for you?

    You have just triggered my memory now though. A long time ago (beta 1?), someone reported problems running my game with XP 64-bit. I’m afraid I forgot to look into that one at the time.

    I’ll make a point of checking it out asap.

  77. Ultrahead Says:

    It’s ok.

    As I could never run any of SAL’s versions, my first guess is that it has to do with the platform settings problems under 64-bit.

    Thus, in order to make sure that any XNA program runs under both kind of Win OS (32 and 64 bit) you must select “x86″ only. To do so, there are 2 very simple methods you may follow. Just read this post for detailed instructions:

    http://amapplease.blogspot.com/2006/09/managed-directx-and-windows-xp-pro-64.html

    After recompiling the assembly, please let me know so I can download & test it again.

    Best regards,
    UH

  78. Sharky Says:

    Thanks. I’ll get onto it.

  79. Ultrahead Says:

    Hi Sharky. Did you manage to target x86 platform only?

  80. Ultrahead Says:

    Hi Sharky. Any news? Cannot wait to test the game. The screenshots are catchy … ;)

  81. Sharky Says:

    Hi Ultrahead. Well I’ve finally had a chance to check my build options and it already is targeting x86. In fact x86 seems to be the only option I have to choose from anyway.

    I’ll keep studying the link you sent, but in the meantime I’ve sent you an email with a screenshot.

  82. Ultrahead Says:

    I’ve just seen the screenshot. Then the platform settings seem not to be the problem. I’ll try to record a small video so that you see what happens.

  83. Xtramalt Says:

    Sharky, have you got any plans/or are you working on an Xbox 360 version?

  84. Sharky Says:

    Hi Xtramalt.

    I’d love to see it running on a 360, and actually it’s probably more suited as a console game anyway.

    However, I don’t actually own a 360, so it’s not going to happen in the short term.

    Also, there’s a possibility I could go commercial with some form of this game one day – when it’s actually complete. So I think I’d rather wait until XNA v.Next when hopefully it’ll be possible to distribute without giving away all the source code. When that happens it’ll be an awesome way of sharing the work-in-progress builds/demos.

  85. Ultrahead Says:

    Yes, yes, yes … it works. Wohahahahahaaa … thanks.

    Great game, man!

    For the smoke trails are you using billboards, pointsprites or normal particles?

  86. Sharky Says:

    w00t!!!
    Glad to hear. :)

    For the smoke trails, fireballs, explosions & clouds I’m just using a single quad with a texture. (using the Spacewars’ Shape.Plane(1,1) method).
    I don’t know how to do *true* billboards yet, but I really want them to be billboards. With the clouds in particular you’ll notice they’re not true billboards (always facing the camera) with the high altitude clouds. When the camera looks up towards them as the plane flys higher you’ll see they are slightly squished with some perceivable perspective. Not pretty.

    Yep, yet another thing on my lengthy todo list. I’ve noticed there’s a Matrix.CreateBillboard() method that looks like a starter. I’m assuming you’d use it instead of applying any Rotation Matrices?

    If you have any more great tips, you know where to send them. ;)

  87. Ultrahead Says:

    ” … more great tips …”

    Yes, a small radar quad located, say, near one of the screen corners would be handy …

    “Glad to hear”

    I really like when the planes collide since it’s quite fun to see them fall … ;)

  88. XNAtutorial.com » Weekly Update Says:

    [...] Lawrence updated Sharky’s Air Legends with better sound. [...]

  89. Ultrahead Says:

    Cannot wait for part 2. And of course a new release … don’t forget the radar … :)

  90. Garrett Hoofman Says:

    That’s exactly how I did it when I was playing with my 3D characters. One for the lower legs, one for the upper legs, one for the body, and one for the head. It worked great.

  91. abi Says:

    Nice screens and a good solution for the 2 planes in the last picture.
    But wouldn’t it be nicer to have real polygon-based collision testing like in MDX without having to hand-create these spheres yourself? Worked great in Rocket Commander and was just a few lines of code. Its really a pity that XNA does not allow access to the model vertices, I guess polygon based collision testing is only possible through own model formats and lots of own code to handle any intersections.

  92. Sharky Says:

    Yeah, that’d be nice.

    I hope future XNA releases can provide some sort of good-enough mesh collision detection out of the box.

    For now I’m just trying to eek out what I can from the existing BoundingSpheres you get automatically in the ContentPipeline loaded Model. More on how I do that in Part 2!

  93. Steve (Jinkster LA) Says:

    This article sheds some light on why my collision detections sucks the big one. I thought of it the same way as the author.

    Anyway, I’m new to game programming, but wouldn’t it make sense to tie collision detection more closely to 3d objects or sprites? I mean, using totally different objects to do collision detections seems a bit primitive and counter productive…especially when you can’t physically seem them!

    Maybe they are doing that way for performance reasons, but in that case there should be different objects.

    For instance,

    3d object 1- with no bounding box …so no collision detection possible

    3d object 2 – includes a bounding box…which is UPDATED automatically with scaling and rotation. Collision detection possible with a built in “intersects” method.

    It just makes more sense to me to do it this way…they could even make the boudingbox’s size adjustable….

  94. Sharky Says:

    Yep, I agree. I imagine performance is always going to be big consideration. Also Microsoft are probably leaving the Framework pure & bloat-free so as to be flexible & performant. That is wise IMHO, but it would be nice if there were optional bits like you say.

  95. Ultrahead Says:

    Take your time, man! No preassure, no rush …

  96. zygote Says:

    The latest build crashes upon load for me.

  97. Ultrahead Says:

    Runs ok here … the collision accuracy is great … maybe at the bottom side of the “playfield” you could add some terrain, and then when the plane fall and crash they crash against something so they explode …

  98. Sharky Says:

    Noooooooooooooooooooooooooo!!!

    Dang it. I’ll look into it.

  99. Sharky Says:

    Oh that’s a relief Ultrahead.
    I wonder what the problem could be for Zygote?

  100. Ultrahead Says:

    Maybe Zygote can give you more info on how it crashes.

    Did you change something in the settings file since your previous build?

  101. Ultrahead Says:

    “Zero works fine for mee too” … Funny: I also used “CIRCLE_NUM_POINTS” to set the ‘number of vertices’ parameter and it worked.

  102. Ultrahead Says:

    Downloaded and tested: “CIRCLE_NUM_POINTS + 1″ works ok … :)

  103. Sharky Says:

    Good to hear. Thanks for the feedback.

    I can’t remember where exactly, but in the XNA help I saw a statement suggesting that the parameter is for optimization in some way.

    So Zero seems fine, but perhaps it is sub-optimal!

    I’m glad that “CIRCLE_NUM_POINTS + 1″ is working then. Best of both worlds I guess.

    ;)

  104. dastle Says:

    Hey, your collision detection tutorial is quite neat. I’ve been wanting to add the ability to do collision detection for bones in my animation library, and was wondering if I could get permission to use some of your code.

    Thanks!

  105. Sharky Says:

    Absolutely! By all means, go for it! I have no problems with anyone using any code or snippets published on this blog. Feel free to change it too.

    If you plan to share your code too, I suppose a courtesy code comment with a link to my blog would be nice – but only if you are feeling super generous.

    ;)

    I figure I’ve left plenty of room for improvement.

    Actually, I’m tempted to make more of a reusable component out of it, so it’s a bit more plug-and-play for people.

    Thanks!

  106. Ultrahead Says:

    “So 70% must be 170.” … :)

  107. Ultrahead Says:

    “The second collection is for holding Transformed versions of these spheres. ”

    An idea: if you can hold both the BoundingSpheres created by default by XNA for each MeshPart and your BoundingPart, you could skip the process of transforming the spheres each frame and instead, you could only transfor each frame per request.

    I mean, let’s say you can check collision on the default bounding sphere of any models (”default” = the big one that encloses a MeshPart of the model), then if two default BS collide, you:
    1) start querying down each “child” sphere in the respective BoundingParts.
    2) for each sphere queried, call the Tranform method (but only to affect that BS, so the Transform method must be modified accordingly).
    3) check for collisions between current child spheres.

    If no collisions were found, just continue from 2) for next pair of “child” bounding spheres until you find a collision or the query ends (no collision).

    That way you avoid the following things:
    1) To call the Transform() method every frame.
    2) To transform child BS that you won’t be using that frame (either beacuse there was no collision between default BS or if it was, you found a collision in a former child node).
    3) To check for collision of all “child” BS each frame (you will check only those that you need, of course, you need to set a criteria like “check the BS with the largest surface first” or so).

    I’m just thinking loud as I type so my apologies if I’m not clear enough …

  108. dastle Says:

    Thanks, I’ll be sure to add a shout-out if I can successfully incorporate it.

    My project is at http://www.codeplex.com/animationcomponents, and since it’s a pretty ambitious undertaking, it may be a bit before I can get collisions working.

  109. dastle Says:

    Oh yeah, if you are in the mood to spend a lot of time on it and think others can help, I might even suggest turning it into a codeplex project.

  110. Ultrahead Says:

    Errata: “… you could only transfor each frame per request.” … it should say “… you could tranform those “child” BS that need processing on a per-case basis” …

    As Sharky’s remarked “comments and feedback are most welcome” … :)

  111. Sharky Says:

    Yeah, I agree. Definately room for optimizing. I’m pretty sure you’d still have to Transform() at least one sphere on every Update regardless.

    XNA’s “default” sphere is still in Object Space.

  112. Sharky Says:

    cool.

  113. Ultrahead Says:

    “I’m pretty sure you’d still have to Transform() at least one sphere on every Update regardless.”

    Yes, the default one, the main one, the partent of all childs in the BoundingPart, the … well, you know …

    What I’m going to say is not applicable to your project since there are only two planes fighting each other, but imagine a lot of planes -and thus, meshparts- that must be checked for collisions every frame. If you can find a way to “truncate” the loop when needed, unless you really need to check all of the nodes, the better …

  114. Sharky Says:

    Yeah, for sure.

    :)

  115. BlackICE Says:

    I also get an error on start, unfortunatly its rather indiscript.

    “Legends has encountered a problem and needs to close. We are sorry for the inconvience.”

    All I can tell you is that once you click close, you briefly see a full screen window which looks white and covered the entire screen, start menu and all.

  116. Ultrahead Says:

    I also agree with Benjamin’s comment on this post (abi): http://sharky.bluecog.co.nz/?p=108, regarding polygon-based collision testing.

    I don’t know whether I’d prefer to check for collisions on the original mesh, but I’m sure I’d love to do it for a simplied version of that mesh (and with “simplified version” I mean a second mesh built with the sole purpose of enclosing the original mesh for collision testing) so as to gain some performance at the expense of accuracy (not as simple as checking AABB, OBB, and BS but still less faces to check than with the original mesh) …

  117. Sharky Says:

    Hmmmmm…

    Thanks BlackICE. Does this happen after the selecting from the Title/Menu screen? Or before ANY screen at all has shown?

    This is really very strange. The only thing I can think of that has changed is my new collision detection logic.

    But since this only happens on some peoples machines I’m thinking it has to be in some way hardware related. I don’t mean that there’s anything wrong with your hardware – just how my game might behaive with it.

    With that being the case the only change low-level enough to be that would be my class for rendering the spheres based on a Settings.xml setting.

    That will be switched off by default, so no sphere rendering would occur, but I think I may still initialize the class on startup.

    I’ll look into it folks.

  118. Ultrahead Says:

    oh, my … I want to thank the Academy for this recognition … the truth is I don’t deserve it … ok, maybe a little … I do believe in XNA and it was what I was waiting for serious development -meaning, to start a game project in a serious way from scratch to fully completetion … and that’s why I (background music) … ok, time to go. Thanks.

    … Regarding the tip that caught your attention, let’s all thank Stephen Styrchak who posted it in MS’s forums and XNAtutorials.com for bring it in the Weekly Update …

  119. Sharky Says:

    :)

  120. Sharky Says:

    That’s strange. I just noticed http://www.xnatutorial.com/ had disappeared from my RSS feeds. I’m sure it used to be there. All fixed.

  121. XNAtutorial.com » Weekly Update - Competition in February Says:

    [...] Lawrence finished his 3D collision detection tutorials, and it ended up in three parts. Well worth checking out. [...]

  122. Ultrahead Says:

    The shout-out is working, mate!

    More and more people is starting to be aware of -and post comments on- XNA Community Blogs … there are interesting blogs I didn’t notice they existed until this wave of posts happened … Thanks!

    Talking about pimpage to Sharky’s blog: it will continue since ‘Sharky’s Air Legends’ was one of the first games created through XNA GSE from someone outside the XNA Team when XNA GSE was still on beta phase … that takes guts! And as I said before, it’s also fun to play … when XNA GSE eventually implements some solutions for networking you should consider extending your game for, say, 4 teams with upto 4 players each or so …

    BTW, and regarding the tip on deploying games to the 360 without sharing source code, maybe that should be complemented with proper obfuscation … if that is accepted by the 360, of course. I don’t have a 360 yet so I don’t know whether obfuscation works ok on the 360, so I hope Stephen, Shawn, or someone else that can confirm it, read this ‘thread’ and post a comment.

  123. Sharky Says:

    Excellent!

    And thanks for those mighty generous comments. ‘guts’ may be stretching it though. ;)

    • When I first started the game it was purely a .NET Framework v2.0 familiarisation exercise because I was still using v1.1 at work. Managed DirectX and I hadn’t even heard of XNA until Beta 1 came out! :o
    • I first started the blog as a way of sharing my progress with friends. (I feared my frequent emails were becoming like spam.) %)
    • as for becoming part of the community I think I can thank Google & various blog Comments & pingbacks. :o )

    It’s been awesome to witness the community evolve automagically:

    • First seeded by Microsoft’s own community efforts.
    • Then the (initially isolated) websites & blogs popup.
    • Then google & other search engines come to the party and mix it all together
    • Not to mention the community nature of blogs themselves – comments, pingbacks. etc…

    One big melting pot of tasty goodness!

  124. Ultrahead Says:

    “… ‘guts’ may be stretching it though.”

    :)

    Regarding obfuscation and the 360, Stephen has provided a pretty clear anwser: http://amapplease.blogspot.com/2007/02/tip-deploying-games-to-360-without.html

  125. Sharky Says:

    Interesting read that.

    I’m not too worried about obfuscating my assemblies for “Air Legends” project. That said, I’m unlikely to ever share the entire source.

    For me it’s not so much the code I’d want to protect, but the art assets. I’d be pretty annoyed if I saw my deliberately “cute & cuddly, sharkified” Spitfire model in someone else’s game. Not that it’s a perfect model (not by a long stretch), but it’s unique and distinctly mine.

    :)

  126. Ultrahead Says:

    “For me it’s not so much the code I’d want to protect, but the art assets.”

    Yes, I agree … and aslo re-enforced with a proper license agreement … just in case …

  127. Pekuja Says:

    So… how about source code or a 360 version? :-)
    My PC can’t run XNA games so I’m bound to the 360.

  128. John Sedlak Says:

    Hey! Good work, it is loads of fun to play! Just wish I was a little better at it! ^_^ I keep running into the enemy, haha.

  129. Sharky Says:

    Thanks. :)

    Yes, the AI is quite suicidal. ;)

    Pekuja, I’d love to get this working on a 360, but I’m afraid I don’t own one. I’d love one, but it’s not a priority right now while the game still largely conceptual.

    At this stage, I don’t have any plans to give away the source - certainly not the art assets.

    This might be an interim solution to that though.

  130. BlackICE Says:

    Hey Sharky,

    Things have moved on slightly since last time, I’ve disabled multisampling which now gets me to the main menu, then changed to windowed. The menu opens and I can select between two places, if I choose one pressing return, or space, after a few seconds of thinking the error pops up again.

    Im sure this is more a hardware issue!

    Thanks anyway, title menu looks great =D.

  131. Sharky Says:

    Hmmm… I’m really not sure what it could be.

    I remember you needed the MultiSampling bit disabled (back in October).

    After the menu, there’ll be sound effects loaded and a whole lot more textures. I haven’t learned to be careful with texture sizes yet, so I suppose that’s a possibility on some hardware.

    Or, I wonder if it could be sound related. Random thought really, but take a look at this

  132. sickbattery Says:

    Hi,

    I found your tutorial some weeks(?) ago and wondered if you will finish it. Now I’m sitting at work, drinking some coffee (I’m a bit burned out today) and surfing the web… thought I should check again if someone has found a good way for collision detection with XNA … So, I read and read your tutorial an suddenly oO … at 50% on page 2 … I got the Idea oO …

    I coded a bit wirh C# and Managed DirectX 9 and remember a function to subdivide faces/vertices from meshes oO … to make it short: Why don’t you try to create a second Mesh with 33% of the faces your real model has and take that one for collision detection?

    You don’t need to transform the lowpoly Mesh every time you transform the real one. Transform it when a bullet is inside the BoundingSphere of your whole Model. Now, meshes/models consist of faces and faces have a forefront and a flipside oO … so all you have to do is check the Normals of every face in your lowpoly model for that (when the “bullet” is inside the BoundingSphere oO) … …

    Oh. Sorry, I don’t have the time to read your tutorial to the end right now ^^ … have to work again. Maybe you allready got that Idea ^^ …

    CiaoCiao,
    sickbattery.

  133. BlackICE Says:

    Just to let you know, I installed .Net 1.1, it made no difference.

  134. Sharky Says:

    dang! :(

  135. Sharky Says:

    Yeah, for sure.

    Some kind of Mesh based collision would be the ultimate.
    I wouldn’t have a clue how to do something that advanced though! I wonder if future versions of XNA will provide a solution for that?

    My tutorial goes no further than describing a multi-Sphere approach. Relatively primitive I know, but still an option, and it was something I was able to get working with my limited knowlege. It can definately be optimized and improved on.

    BTW, I’ve heard some commercial games still use this approach for collision detection. Depending on the game, it might be appropriate. It’s good enough for my game anyway.

    :)

  136. Silmar Says:

    A shame you are not willing to share out the source, many would-be budding developers are missing out.

  137. Ultrahead Says:

    Sharky, are you using textures with different width and height? I mean, instead of 64×64, 128×128, and so on, you use, say, 96×256, etc. … I’m a bit lazzy this days so I didn’t check in the latest build … :)

    If so, BlackIce: you should check whether the gfx card you have accepts this kind of “arbitrary” textures or not.

    Since you changed to window mode this seems not to be a problem of gfx card vs. monitor refresh rates (issue that I faced with previous builds of Air Legends).

  138. Sharky Says:

    Perhaps Ultrahead. I’ll have to take another look.

    A couple of my bigger textures were, so I fixed them. I’d appreciate some guidence on acceptable texture sizes, dos & don’ts etc…

    My Skybox textures are quite large. 1024×1024 (formerly 1024×768). But I think they need to be – it’s the background! I wonder if that’s just too large for some hardware though?

  139. Ultrahead Says:

    In a bottom-up manner …

    “I wonder if that’s just too large for some hardware though?”

    Not for “now-a-days-standard” hardware … What is more, brand-new-top-of-the-line-sell-all-your-goods-to-buy-one gfx cards support textures sizes other than power of two … So, in a couple of years or so this shouldn’t be an issue anymore …

    “I’d appreciate some guidance on acceptable texture sizes, dos & don’ts etc…”

    Some subject! If I say it depends you’d probably want to meet me in any online-videogame session and kick my @$$ … At least, two schools here:

    1) Pursue high resolutions in case you look for “more-than-good” detailing, because you can always scale it down if needed when needed. This would be mostly desirable for “static” rendering (i.e.: animated movies) when we are talking of objects that will remain close to the eye (camera) for certain amount of frames enough for the eye to perceive that something maybe wrong with the object’s detail. Of course, the higher the resolution the more the time needed to render each frame, and
    2) Set resolutions on a case-by-case basis: so as to avoid any sort of “thrashing” (term that one can use in this case when the gfx card’s video memory gets exceeded and starts swapping textures more often), which would cause performance issues (specially when anti-aliasing is on). If you’re making a car game, where the speed of the game is ultrafast, you may then only worry to set high resolution textures on your car models and medium-to-low ones on surrounding objects (like buildings) since the player will spend most of the time watching his/her car (maybe Benjamin talks about this in his upcoming book). Also, when using textures for say, 2D animations, it’s better to tile all of the frames for a character animation in the same texture, so as to reduce texture swapping when rendering.

    So, it’s a trade-off. Maybe someone with more experience in the field than me could collaborate adding its thoughts on the matter, since this worths more than a simple post. Guys?

    “Perhaps Ultrahead. I’ll have to take another look.”

    Maybe you could downsampe the textures (perhaps XNA does that by default when importing textures through the pipeline) and let the user choose a “pre-made combo” in the settings in case of problems (or just for testing purposes) …

    Hope this helps!

  140. Ultrahead Says:

    BTW, for your game, if I were you I’d just leave it “as is” by default since there’s plenty of time for further optimization (if needed), most cards accept 1024×1024 textures and the type of game does not create pressure to gfx cards (only two models, a skybox, some bullets).

    Meaning, if the background’s texture size is a problem you could give users the choice of setting 512×512 textures for the background in the game’s settings XML file. But only if that really brings a solution to issues like BlackICE’s one.

  141. Sharky Says:

    Sweet. Thanks for the advice. May just do that. It’s on the ever growing list of todos anyway. ;)

    I wish it were easier to diagnose problems on end-user systems. It’s hard enough on my own PC, but when it’s a release build on someone elses machine I’m flying blind at the moment.

    Some sort of log file would help narrow problems down at least. I wonder if Log4Net works well with XNA games? Probably not on a 360 build, but I can’t see why it wouldn’t be a good logging option for a windows build.

  142. Ultrahead Says:

    “Some sort of log file would help narrow problems down at least.”

    Indeed.

  143. Ultrahead Says:

    Ok, read the comments on this post: http://amapplease.blogspot.com/2007/02/acceptable-texture-sizes.html

  144. Gogs Says:

    I started my first gamelast night. Luckily i started converting a game i wrote in blitz basic that mostly had spheres. I was in hysteric at some of the stuff i was coming up with where the balls would transfer energy into each other and change their rotation. although my balls started sticking to eachother more than i liked hopefully i can eventually get some deflection going today without one ball taking priority over the others.

  145. Sharky Says:

    nice

  146. Derek Nedelman Says:

    Hi Lawrence. Looks like you’ve been making some nice progress with the game. Keep it up! I added your RSS feed some time ago to my site’s news page so that others can track your progress.

    By the way, my site used to be called ThreeSixBox but I renamed it a few days ago to the new and improved GameProjects. I was hoping you could update your link to my site to reflect the new name.

    Thanks.

  147. Ultrahead Says:

    Good to know this quite handy links … thanks!

  148. Sharky Says:

    hehe.

    Overall I think I’m favouring the last one (#3).

    #1 is fairly good, but it seemed to need a css Stylesheet hooked up to the Blog to render with any colouring.

    #3 is visually ok, and as a plugin it’s much nicer to use. After pasting into Live Writer it still allows edits, whereas #2 doesn’t.

    #3 seems pretty self contained too – no additional stylesheets required.

  149. dczraptor Says:

    Actually, with #2 you can still edit the code. Select the code block and then go over to the right side and click the ‘edit code’ button. You can even insert line numbers, a border, or change the background color. However, you won’t get the same amount of manual control over it, but it’s pretty close.

  150. TehOne Says:

    I would have to say I like #3 the best as well. #1 is good but it makes the page overflow very wide. #2 is nice but too condensed and wraps too much for my tastes. #3 is just right i’d say, just the right amount of wrapping for me.

  151. Sharky Says:

    Yeah true.

    Hey, dczraptor, thanks for pointing that out to me. I can’t believe I hadn’t noticed the context sensitive properties for that plugin. Must be code blindness. ;)

    I think I must have an older version, because I don’t see an option to edit the code in mine.

    Being able to make it fixed width makes #2 quite compelling again. I’ll give it some more thought.

    #3’s HTML is a bit more readable too (not that that really matters).

  152. dczraptor Says:

    Yea, I probably have a newer version, cause I only went to test it after I read your post. You can even specify the width constraints using the options for #2, so you can get the code to wrap precisely the correct amount. For #1 and #3, the code doesn’t wrap around at all for me (IE7), so longer lines might have code that gets cut off.

  153. Ultrahead Says:

    The same here: IE 7. #2 wraps the code right (as dczraptor says the latest version lets you specify certain things in a custom editor).

    For #1 and #3, you have to manually change the tags, for instance, to and or including everything in .

  154. Ultrahead Says:

    ooops, my tags dissapeared: here we go again!

    … change the tags, for instance, “pre” to “p” and or including everything in a panel (”div”).

  155. xtamillion Says:

    To optimize: use two AABB covering the entire planes and just check if anything collide with the boxes ;-) stop testing after one hit is a bad design imo as you can probably bit the plane several times, and i doubt the benefits will be bigger then the complexity. by creating big primary boxes you can just create a few big ones covering multiple rounds for even bigger effect. That way you can reduce 20 spheres on the plane + 100 shots to perhaps 1 for the plane and 10 for the shots as a rough test. If your half as bad a pilot as me that would reduce the collision detection a lot =P

  156. Sharky Says:

    Yep. Although, transforming an AABB for the plane’s rotation, is more of a deform really (see part 1).

    Because it is axis-aligned, it wouldn’t always adequately enclose the entire model, so I would think an “primary” Sphere would still be better?  Unless a non-AABB can be implemented?

  157. XNAtutorial.com » Weekly Update - SpaceWar Competition Says:

    [...] Lawrence tweaked Shawn Hargreaves screenshot component, so now it works for Windows. Also, he updated Sharky’s Air Legends, so if it used to crash on you, try again. [...]

  158. RJ Says:

    I was going to use a model for a level but this means its impossible to implement the collision detection because I can’t get at the verticies. How are you supposed to make a first person shooter in XNA? I guess you can’t. The model which i use as a level is too detailed for me to attempt to add hundreds of boxes and spheres and to try and manage them myself would be a waste of effort.

    I know having a model for a level is probably not the pro the way to do it but for a really simple game it would have worked fine because the 360 is quite powerfull. I was amazed at how well it was running actually the framerate is great even with an enormous model as a level. Now I will have to try and build some kind of home brew level editor?

    Perhaps I should stick to a 2d game until they finish xna. Or am I missing something big? I’m very disapointed.

  159. Sharky Says:

    I’m guessing Microsoft are brewing up some goodies for the next release. Here’s hoping there’ll be more support for more serious collision detection. :p

    I can appreciate how the technique used in this article would certainly be less effective in FPS style games. The player tends to be a lot more aware of whether a shot should have hit or missed. Sphere’s are a bit two approximate for that – unless your character IS a sphere. (mental note to oneself: game idea #76. “Pacman 2007″)

    ;)

  160. zygote Says:

    Nice! I cant wait to check it out :)

  161. Alfons Says:

    I like your tutorial a lot.

    But I’m not sure it’s the right version that’s up for download. Because I downloaded it and when I tried it the Xbox360 controller didn’t rumble and all of the spheres moved even if the cursor was far far away.

    Will you update the tutorial as well?

  162. Alfons Says:

    my bad…didn’t follow the instruction. “…(just scroll down a little to the “updateâ€?)”

  163. Sharky Says:

    hehe. No worries, and thanks. :)

  164. Sharky Says:

    I’ve updated the text to be a bit clearer.

  165. Ultrahead Says:

    Hi, man! Nice update. Glad to see the proximity test implementation …

  166. Ultrahead Says:

    Yes OOB can be implemented (remember this post: http://amapplease.blogspot.com/2007/01/oob-intersection-test-using-xna-as-we.html), but a boundingsphere approach works quite ok …

    Glad to see that you’ve implemented the tree approach to optimize your collision testing process …

  167. Ultrahead Says:

    “… Why don’t you try to create a second Mesh with 33% of the faces your real model has and take that one for collision detection? …”

    I agree: http://sharky.bluecog.co.nz/?p=120#comment-1250 , but I’d wait to see what’s coming on next releases/updates of XNA; maybe methods to ease collision testing on polygons are provided by the XNA Team for us.

    So, for now, the tree testing implementation on boundingspheres seems to be quite ok to me …

    Cheers!

  168. Pekka Kujansuu Says:

    When’s the XBox 360 version coming out? The game looks cool, but my PC can’t handle it. (yeah, it’s a bit outdated even for a laptop)

  169. Ultrahead Says:

    Nice update!

  170. Sharky Says:

    Thanks guys.

    I’d love to do an XBOX 360 version. If I had one I’d do it right now, but santa hasn’t brought me one yet.

    I’m not in a particular rush to do it yet – at least, not until you can share games as binaries to non-Creators Club members.

  171. XNAtutorial.com » Weekly Update - Chronological Order Today Says:

    [...] Lawrence updated his 3D Collision Detection source code and tutorials, especially focusing on proximity tests. He updated Sharky’s Air Legends in the process. (tutorial) (Sharky) [...]

  172. XNAtutorial.com » Weekly Update - SpaceWar Competition Says:

    [...] Lawrence tweaked Shawn Hargreaves screenshot component, so now it works for Windows. Also, he updated Sharky’s Air Legends, so if it used to crash on you, try again. [...]

  173. XNAtutorial.com » Weekly Update - Chronological Order Today Says:

    [...] Lawrence updated his 3D Collision Detection source code and tutorials, especially focusing on proximity tests. He updated Sharky’s Air Legends in the process. (tutorial) (Sharky) [...]

  174. Nathan Says:

    Looking great dude. Installer makes it really easy. Could you add a dependency checks into the MSI for the appropriate frameworks to be installed before you can install your game. Might make Joe Bloggs install a little easier.

  175. Sharky Says:

    Thanks Nate. Yeah, dependency checks are on the list.

    ;)

  176. Chris Says:

    http://andyq.no-ip.com/blog/?p=16

    this blog contains code for a dll to help with making a bb from the mesh
    haven’t tried it yet but looks promissing. It creates a handler for the content pipeline that stores the bb in the tag property of the mesh.

  177. John-Daniel Trask Says:

    Also, use one click deployment so people can get an update should you release it without always checking the site :)

    I know it’s not ideal for pulling people back but you should expect a certain % aren’t that into XNA but just stumbled across a free home brew game that’s shaping up to be cool and might not return to check on it :)

    Push the wife for a 360 man, she’ll get to game on it too and she likes games :)

    – JD

  178. Sharky Says:

    LOL.

    Yeah, I hear ya JD. Though, I’m not too keen on the one click deployment idea for XNA games just yet. XNA doesn’t currently support compressed Audio, so as I add more music or sounds the download will grow bloated.

    I’ll look at it when MP3 music is supported though.

    Didn’t you know? My wife IS Santa. Which means, not before Christmas, and probably not then either.

  179. Tim Says:

    Thanks. This was really great stuff and certainly worth the read. I also appreciate the sample you put together!!

  180. MadMojo Says:

    I like how this title is looking, Sharky. =) Latest build works fine on Vista for me, by the way. Look forward to seeing this title evolve.

  181. zygote Says:

    Time is for Einstein ;)

  182. Sharky Says:

    LOL.

    :)

  183. Cogs Says:

    What 3d model editor are you guys using?
    Are you outputting a collision from the 3d editor ?

  184. Sharky Says:

    No, I’m not outputting any collision from the 3d editor. Do you mean like some kind of low poly collision mesh?

    As far as editors go, I built most of my model with Milkshape, but was having problems with that and export formats until I tried 3DStudio Max. That’s what my model was exported with in the end, but I’ve done no more work with 3DStudio Max since. I want to find a tool I can actually afford.

    I really want to use the Softimage|XSI Mod Tool. It’s free, powerful and relatively intuitive. Just having some problems with its .x export at the moment.

    See this thread…
    https://creators.xna.com/forums/thread/1211.aspx

  185. Banzai Says:

    I have created a 3D level and collision mesh for it (optimized version, takes a few hundred faces off) and I must admit I am Not a great programmer, more of a technical designer. Is there anyway I can just use the mesh I made for collision or am I going to have to sphere/box the whole darn thing? For an entire level that could take a while….

  186. Sharky Says:

    Banzai, sorry I’m really not sure. I’m no expert I’m afraid.

    Have you asked in the http://creators.xna.com forums? Someone will know, and the microsoft fellas are very good at responding too.

  187. John Says:

    How do you know the vector 4 values? Is their a way to calculate this during runtime?

    //Tail
    new Vector4[] { new Vector4(0.25f, 0.52f, 0.45f, 0.40f), new Vector4(0.50f, 0.56f, 0.53f, 0.55f), new Vector4(0.75f, 0.52f, 0.45f, 0.40f)

  188. Sharky Says:

    Hi John.

    The Vector4 values are where you can get creative.

    You choices really depend on the shape of that particular piece of the model.
    Something long and thin like a wing for instance. You might choose to define 3 or 4 smallish spheres along whatever Axis the wing goes. The spheres near the wing tips will likely be a little smaller the the one(s) around the center, because that’s typically how wings go.

    For something fat and generally spherical like a propeller cone, you might do just 1 sphere.

    The important thing to remember is that the values in the Vector4’s are like percentages along an imaginary line in the given Axis (0.5 = 50%, 1 = 100%). Where the length and center of the line is determined by XNA’s default sphere (a sphere that exactly surrounds that bit of the model).

    Hope that clarifies things a little more. :)

  189. zygote Says:

    Sweet!

  190. Ultrahead Says:

    lol

  191. Ultrahead Says:

    Hey Sharky, Dave is watching: http://letskilldave.com/archive/2007/03/19/Sharky_2700_s-Air-Legends_3A00_-Now-with-two-player-split-screen_2100_.aspx

  192. Wyrm Says:

    Excellent work. You should be proud. Ran excellent under Vista.

  193. Sharky Says:

    Thanks, and good to hear it ran on Vista too.

    :)

  194. Arek Bal Says:

    Heh… it’s easy to say about using simpler models. Harder to do.
    1st. xna team tried their best to make it hard. There is no easy way to retrive vertex data from Model Object. You can’t just catch that data before model is pushed to gpu(i wonder why?). It’s preety obvious that we wish to have few more parameters in content loading method.
    I spend few days in my research… and I was really sure(it was so obvious to me)… that is possible. There is a way to store vertex data from model at loading time. But if you wish to just load low poly collision model, without loading it to gpu, you would have to reinvent the wheel, and rewrite process method of loader.
    So…
    I ended up with my own .x mesh reader. No content pipeline procedure implemented for know.
    Ok. Sorry for crying up all my tears on you guys. ^^
    Btw. ANybody know how to register from poland to xbox gamertag without lying?

  195. Zygote Says:

    Very nice :) Now to just poke MS in the eye so they release the update.

  196. Ultrahead Says:

    Nice to hear from you, man …

  197. Sharky Says:

    Thanks.

    :)

  198. Will Branch Says:

    looks like a nice game and cant wait to see the code…
    Thanks

  199. Corpse Like Says:

    Hi Sharky,

    This is an excellent project man… really inspiring.

    Could you provide me with some pointers on how you achived the split screen support, perhaps another excellent tutorial….

    Later…

  200. Sharky Says:

    Thanks for that!

    Hey, good idea about the splitscreen tutorial. I just assembled various suggestions from forums to do it, but I know from experience it would have been helpful to have a full working sample to reference + tutorial. I’ll definitely keep it in mind. Not sure when I can actually do it though.

  201. nih Says:

    Hi! Nice to see another kiwi doing XNA. I’m still learning but I’m finding your posts immensely helpful! Keep it up!

  202. Sharky Says:

    Awesome! Great to see another kiwi in the mix.

    I really like your site. Nice work.

  203. Me Says:

    but it’s not on runtime…

  204. zygote Says:

    Great news Sharky! This is awesome :)

  205. Mach1.9pants Says:

    Another goodun, mate. OK I will buy a couple of 360 controllers while in the UK- you convinced me.
    When is the aerial t-bag option coming? ;)

  206. Sharky Says:

    LOL

  207. Ziggy Says:

    This game is a great hit around here :) With the new maneuvers and speed increase, its loads of fun ;)

    My wife was babysitting tonight and one of the girls (8 yrs old) loved it so much she played it for about 2 hours straight ;) The colored smoke trails are crazy fun ;)

    Again, awesome work.

    I can’t wait to see the single player and multplayer mature ;)

  208. Ziggy Says:

    sorry for all the smileys… hehe

  209. Sharky Says:

    Thanks Ziggy. That’s awesome, I’m stoked!

  210. Pekuja Says:

    Now I don’t really know much about additive blending, but if you wanted your smoke to get darker as it thickens, shouldn’t you be doing the additive blending in reverse? I think the formula would be:
    source_color + destination_color – 1.0
    where the colors are in the range [0..1] . So then use bright gray textures… dunno if that produces good results, but I think it’s worth a try.
    Also, a lot of photo editing tools like Photoshop or Gimp allow you to blend layers additively, so you could use that to play around and find what works.

  211. Sharky Says:

    Hmmm… I hadn’t thought of that. Additive, but not additive. Subtractive!

    Thanks Pekuja.

  212. Anxiety Says:

    Just make your source images dimmer.

  213. Sharky Says:

    I think I tried that, but I’ll have another go. From memory things tended to lose their nice colors.

    Are there any techniques to employ with the Alpha channel for Additive blending?

    For instance, should any of the Alpha channel be 100% opaque? In the end I suppose it’s always going to depend on the result you want.

    I want my Explosions to be fairly Opaque, but I still want the colors to be rich.

  214. Eivind Says:

    I support Pekuja’s idea of using a “subratctive” technique but I am curious if you have to turn the expression the other way around to: 1 – (source_color + destination_color)? That way as the result of adding source_color and destination_color gets brighter the end result will diverge towards 0 (dark).

    It would be interesting to see some example code on this.
    Air Legends sounds really interesting, will have to try it out when I get home!

  215. Sharky Says:

    Thanks.

    Looking forward to giving these ideas a try.

  216. Stefan Says:

    I just keep getting a Error report…
    Someone know why?

  217. Stefan Says:

    I can’t play the game, all I get is a error report :P Can someone help me?

  218. Sharky Says:

    Hi Stefan.

    Sorry I’ve been slow to reply.

    If you can paste in some of the error report that could help.

    Have you had success running any other XNA games on your system?

    Also, have you read the “Here’s what you’ll need to play it…” bit of this page carefully?

    My Installer is a little immature, and doesn’t install some of the prerequisite windows software. Such as XNA v1.0 Refresh, .NET Framework v2.0.
    It’s also very important to do the Web Installer bit for DirectX. While most people already have 9.0c, it still needs updating occasionally for newer things like XNA.

  219. Danny Tuppeny Says:

    Excellent – I’ve been looking for a decent tool for a while. 3D Studio Max is a little out of my price range, and the free tools have all been pants :-D

  220. Mal Says:

    You need to upgrade the webserver running ActionThis, it’s abysmally slow (today at least)

  221. Sharky Says:

    Agreed!

    The site is an interim step, our goal is to launch with a lightening fast product, and we have to put the site through a few iterations to get there.

    There is a lot happening behind the scenes, the homepage will be optimized soon, plus there is a massive amount of shiny new hardware on its way.

    Exciting stuff.

  222. Ultrahead Says:

    Hi man,

    Good to hear from you.

    Haven’t played with the new version of ModTool yet, but it looks great.

    Hope to see new screenshots of Air Legends soon.

    Cheers,
    Pete

  223. Sharky Says:

    Thanks mate.

    Nice to hear from you too.

    Yeah, I’m gradually picking up the pace again.

    At the moment, I’m importing all my old models into XSI, since it’s easily my tool of choice now. Having some issues with the tail on my BF109 not texturing right in-game. Looks fine in XSI.

    Probably my dodgy self-taught modelling skills to blame. ;)

  224. CrazySheep Says:

    I was wondering exactly how you createdf the installer? many hobbyist developers need a good installer and yours seem virtualy perfect in every way :D . Can you share your secret???

  225. Sharky Says:

    Thanks CrazySheep.

    Dunno about perfect, but seems to do the job aye. :)

    I tell you what, I’ll work on Blogging a wee tutorial+sample about it. In the meantime, you could look into WiX (Windows Installer XML). That’s how I did mine. Before I blog about it I just want to convert it from WiX v2 to WiX v3. Also some minor improvements I could make now that I know how.

  226. A Says:

    Hi,

    I am just a newbie here. I just tried out your code to use on my FPS style game (basically in Half life style). The problem I got is my 3D model mesh is not properly allocating in the boundingspheres. The coordinate is not right the scaling also wrong. How could I make this spheres to world coordinate?

    Any suggestion?

    Thx

  227. Sharky Says:

    I’m not really sure.

    Before I finished my tutorial and sample, I had originally resorted to a bit of a magic number hack when my XNA generated bounding spheres appeared too small. I just experimented with multiplying by different numbers until it looked about right for the model. As it turned out though, it was because my rendering code originally didn’t take into consideration any Bone Transforms. Once I implemented those things came right with no magic number required.

    Another thing to consider, is within the modelling tool itself. When you adjust various pieces of your model in whatever tool you use, they can remain as transformations that potentially effect the exported model. Each tool will have it’s own way of committing these transforms. In XSI I believe you have to “Freeze all transforms”.

    Your mileage may vary. I’m really no expert at any of the above. It’s just been trial and error experience for me. I could be talking bollocks, but this is what worked for me in the end.

  228. Mach1.9pants Says:

    Hi mate,
    i am about to order some 360 controllers, you sweet talker! What is the problem with the wireless? I fancy playing your game with the boys on the TV…

  229. Ultrahead Says:

    Hey Lawrence, congrats on the new version!

    This game deserves to be on the XNA Live Arcade, imvho. It has been here since the beta days and frankly, I love to see its progress … keep up this great work, man!

  230. Sharky Says:

    Thanks Ultrahead.

    Feels like I’m close to being about to work on serious gameplay “features” again.

  231. Larry Says:

    Wow! Flight Simulator with XNA! Nice job! Keep coding and learning… Share knowledge and games!

  232. Nih Says:

    Hiya! Nice to see another kiwi working in XNA! :) Air Legends is downloading while I write this, I can’t wait to try it!

    I was wondering if you ever solved your difficulties you mentioned on the XNA forums with XSI exporting to .x and XNA. I’ve just spent a week teaching myself XSI only to get to the export stage and find as you did that it isn’t up to par.

    Any hints would be appreciated.

  233. Sharky Says:

    Hey Nih.

    Good to see ya. :)

    The new version of the XSI Mod Tool (see this post) solves all my problems now.

    Though, I don’t actually export to .x format for XNA. I don’t need to. Nor do I need FBX anymore. The new version of XSI integrates with Game Studio Express letting you “publish” your models to your project (well, more or less). These come out as .XSI files and they’ve provided dlls for using them in XNA’s ContentPipeline.

    Simply add these dll’s to your Project’s > Properties > Content Pipeline references.

    One of them is needed at runtime, so you reference that in your project refs too.

    I recommend you view the Help from XSI’s “XNA Game Studio” menu. Pretty good for getting started.

  234. Nih Says:

    Nice! That’s exactly what I was after for. Thank you very much! :)

  235. Andrew Cooper Says:

    I’v created a setup at the moment and i’m having trouble with the Boinding Sphere’s not being inline with the “ModelMesh”. If you could please tell me how to determin the Location and Radius of a Bounding Sphere for a ModelMesh it would be a great help. Its probally in you demo app, but i cant see it. Thanks.

  236. FD Says:

    Hey sharky!

    from what i’ve seen of “air legends”, it just amazing what u have done ;) right now i’m just wondering what the name of the original game was… i’m not sure but i think u got ur ideas from a this classic game. do u know?

    thx 4 help and continue your work (and i hope i see air legends someday in the xbox live arcade list or smthg ;) )

    mfg fd

  237. Hannes Says:

    I am very new to XNA programming and I want to make a water shader for my game.
    Can anyone help me?
    Thanks.

  238. Sharky Says:

    I’m not strong on shaders myself, but you could start by looking at this Ziggyware post & HLSL links…

    http://www.ziggyware.com/news.php?readmore=461

    p.s. HLSL = High Level Shader Language = “Shaders”.

  239. Rick Says:

    I get errors when I try to compile “unrecognized escape sequence”, anyone else received this message?

  240. Sharky Says:

    I’m not sure Rick.

    Are you trying with XNA 1.0 or 2.0?

    I’m still converting my stuff to XNA 2.0, but I haven’t come across that one yet.

  241. Sharky Says:

    Thanks so much for the nice comments FD.

    I actually had the concept of this game about 25 years ago, and initially did a 2D sprite based version on a SpectraVideo SV-318 with it’s BASIC language.

    I was inspired by the old arcade game TimePilot. I liked the gameplay, but felt a side on view would be more fun (instead of top down). A side view would suit gameplay features like landing to rearm/refuel etc…

    That’s where I’m heading with Air Legends. Still lot’s to do & learn! I’m stoked with how the game looks right now, which makes doing an acceptable ground/terrain all the more difficult. It could ruin the whole look of the game, but I will need to start simple.

    I’ve had comments from people likening it to another game (on the Amiga I think?) but I don’t remember the name. Never seen it either, so similarity is purely coincidental.

    I’d love to see Air Legends on an XBOX. If only I owned one!!!

    :)

  242. Sharky’s Blog » Blog Archive » "Sharky’s Air Legends" now for XNA 2.0, featuring new 3D View, Scoring etc… Says:

    [...] One word – Busy… busy, busy, busy. Ok, so I cheated on the word count, but that’s how life’s been lately.  So much has happened since my last post. In work, play & personal life.  I’ll cut to the chase though.  Here’s my latest and greatest release of “Air Legends”.  You can download it from here. [...]

  243. Pete Says:

    Welcome back, man!

  244. Sharky Says:

    Thanks man.

    Hey well done on the your Article by the way. A very good read.

  245. Pete Says:

    Thanks :)

  246. sueds Says:

    I would like to know if its possible to use this method in a not subdived character ?

  247. Sharky Says:

    Hi Sueds.

    I think you could still use this technique but your Model would only have one ModelMesh in its Meshes property. That ModelMesh would therefore have a default bounding sphere big enough to surround the whole model. You could use its radius to position and scale a bunch of BoundingParts just as I do in the tutorial.

    p.s. I just remembered this sample is still for XNA 1.0. I really should convert it to 2.0 one day. The ideas the same.

  248. Phil Perm Says:

    Hey,
    I really liked this tutorial, one problem though I’m using XNA 2.0 and I can’t launch or use the tutorial. Are you going to provide a version for XNA 2.0? I’m a geekbie (a newbie geek)…

  249. Phil Perm Says:

    You can discard my last post, i managed to convert it my self. I used the XNA Upgrade wizard and changed some of the code.

  250. Sharky Says:

    ha ha, no problem Phil. I’ll update it one day…

    ;o)

  251. Phil Perm Says:

    When i change the camera view to be more of an isometric view (_cameraView = Matrix.CreateLookAt(new Vector3(0f, 1000f, -250.0f), _position, Vector3.Up);)

    The mouse input gets all distorted, even though I change the z-component for the mouse vector, how come?

  252. John Brathwaite Says:

    Hey Lawrence, have you still got your Spectravideo? That’s a while back I know!

    Cheers
    John

  253. Sharky Says:

    Hey John!!!

    Looooooong time no see! Great hearing from you.

    No, I dumped the SpectraVideo when I moved house once. One of those regrettable ruthless clean outs. :(

    Such a shame aye – lots of sentimental value there.

    I still remember the time we set about making our own “Bombjack” clone! How old were we? Maybe 17? AWESOME!

    Hey, expect an email from me soon.

  254. Pete Says:

    Congrats man!

  255. Pete Says:

    “All you need to do is sign up for a FREE trial of ActionThis using the Referral code INT413.”

    Done. Good luck, man!

  256. Sharky Says:

    Thanks Pete!

    :p

  257. Ziggy Says:

    I found a crash in the game in the Windows version where shortly after you collide with a ship and die it errors some times. It seems to happen after horsing around button mashing for about a minute. :)

  258. Sharky Says:

    Yeah. That’s one reason it’s still a “preview” release. hehe.

    With all the extra planes flying around now, I need to look at memory usage. I think all the extra particles (smoke, explosions, bullets etc…) might be consuming too much memory after playing for a bit. Get’s garbage collected, but sometimes not soon enough.

    That’s my guess anyway.

    On the 360 I get similar symptoms. Play for 5 minutes and eventually it crashes – sometimes.

  259. Philippe Da Silva Says:

    Hi Sharky,

    I installed the preview and I get a crash whatever options I select when I start a round.
    Unfortunatelly, I have no idea how I can help you debugging this windows installation as I have no logs written.
    If you want your readers to help you out, maybe you could just add some try…catch with a TraceListener attached to a file output so that we can at least send you over some exception information?

    Cheers,

    Philippe

  260. Sharky Says:

    Thanks for the feedback Philippe. I agree, logging would certainly help and I’ll see what I can do.

    I am surprised you’re getting a crash so quickly with the Windows version though. The only crashes I’ve been getting are with the XBOX 360 version and I’ve been looking into that.
    Or if I play for ages I can make the windows version run out of memory (I fixed that last night, not released yet though)

    Have any of my previous builds worked for you?
    http://sharky.bluecog.co.nz/?page_id=27

    Sounds like you got past the menus, so I’m guessing you must have all the prerequisite stuff installed and updated…
    - XNA 2.0
    - and have you done a recent WebUpdate for DirectX? (I’d do this anytime a new XNA comes out)
    - .NET Framework 2.0

  261. Stefan Virag Says:

    Done, best of luck mate!
    Hopefully, you’ll get Wii..

    You.. I mean Your kids deserve it :)

  262. Sharky Says:

    Thanks Stefan!
    I’ll know by the end of the month.

    Fingers crossed.

  263. Major “Sharky’s Air Legends” release for Windows & XBOX 360 out now! Loads of enhancements, changes & fixes. | Sharky’s Blog Says:

    [...] No more “preview builds”, this is the real deal folks.  I’ve just uploaded the new release here. [...]

  264. Major “Sharky’s Air Legends” release for Windows & XBOX 360 out now! Loads of enhancements, changes & fixes. | Sharky’s Blog Says:

    [...] Don’t forget to help me win a Nintendo Wii! [...]

  265. Pete Says:

    Nice. One recommendation: create a video trailer/demo and upload it to zigyware, youtube, an so on.

  266. Johan Lindfors Says:

    Great work!

    However if you (like I) are using Swedish regional settings you will get a FormatException which is easily resolved by changing regional settings to English (US), but that’s possibly something that should be investigated in code as well…

    Regards

    Johan Lindfors

  267. Sharky Says:

    Ah, thanks Johan.

    I haven’t even considered regional settings yet.

    Hmmmm…. was it the Game over stats screen by any chance?

  268. A new "Sharky’s Air Legends" release is out! New features, enhancements & bug fix | Sharky’s Blog Says:

    [...] grab the new Windows & XBOX 360 version from the Latest Build page [...]

  269. A new "Sharky’s Air Legends" release is out! New features, enhancements & bug fix | Sharky’s Blog Says:

    [...] I didn’t win the Nintendo Wii! but big thanks to all those that [...]

  270. Richie Says:

    Hey cool, found your site when searching HLSL sampler_state, still can’t figure out where this fits it… Hope my work looks as good as yours one day..

    r

  271. Sharky Says:

    Thanks very much Richie.

    Been a long time in development. Looking back now I realise it was mid to late 2006 when I first started – just before XNA even came out!

    I suppose that can be expected with a lot of single developer Hobby projects. A labour of love really. It helps that I’m a perfectionist. I’ve been careful not to include features I wasn’t capable of making look acceptable. Little steps.

    Good luck with your work. Do you have a web site/blog etc???

    p.s. I don’t know much about HLSL myself. I seem to get a lot of google hits for it though since ages ago I posted some links to sites that helped me a little.

  272. Barry Says:

    Tried out the game but it crashes after about a minute on my PC. Am running Vista 64 which might not help. When’s the next update?

    :)

  273. Sharky Says:

    Hmmm, that’s strange. Unfortunately I’m unable to test 64bit.
    A while ago there were reports of problems running on XP 64bit, but that has been long resolved. Or at least it was resolved – I haven’t heard otherwise, but I’ll have another look.

    Thanks for the feedback. Not sure when my next update will be, but I’ll be concentrating on making the performance better. My particle systems are too old-skool & CPU bound. I plan to push more stuff into the shaders.

  274. Steven Linton Says:

    Hey there,

    Really impressed with you XNA game. Just wondering what part of NZ you are in?

    Cheers,
    Steven.

  275. Sharky Says:

    Hey thanks Steven.

    I’m in Wellington.

  276. Borealis Says:

    Hey Sharky,

    As promised I checked out your game. I just ran it on the Xbox360.
    I tried several game modes and planes. Did not experience a crash or slow down.

    Hope this helps.

    Bino

  277. Sharky Says:

    Thanks heaps.

  278. Pete Says:

    Congrats man!

  279. Barry Dahlberg Says:

    Nice work, much more stable than the previous build I tried too. A huge improvment for me would be an indication of where the off screen enemies are, perhaps an arrow at the edge of the screen or something.

    Good luck.

  280. Air Legends trailer! | Sharky’s Blog Says:

    [...] Sharky’s Blog Home of “Sharky’s Air Legends”, XNA game development journal & other madness « Air Legends gets ROCKETS and significant gameplay improvements. Out now! [...]

  281. Barry Dahlberg Says:

    Nice work. It suddenly occurs to me that I’ve written a timepilot clone at some point in the past as well!

  282. Sean Says:

    Fun, only things i can suggest are adding propellers!

    WW2 planes aint WW2 planes without propellers?!

  283. Sharky Says:

    Thanks.

    True true. Props are definitely on the list to-do.

  284. David Says:

    Crashes for me on Vista SP1:
    Description:
    Stopped working

    Problem signature:
    Problem Event Name: APPCRASH
    Application Name: Legends.exe
    Application Version: 1.6.0.2
    Application Timestamp: 48abfc15
    Fault Module Name: KERNEL32.dll
    Fault Module Version: 6.0.6001.18000
    Fault Module Timestamp: 4791a76d
    Exception Code: e0434f4d
    Exception Offset: 000442eb
    OS Version: 6.0.6001.2.1.0.256.4
    Locale ID: 3081

  285. Pete Says:

    Kudos for you. Cheers!

  286. Xtramalt Says:

    A good read. Good Luck with Dream Build Play.

  287. Sharky Says:

    Thanks all.

    :P

  288. Martin Says:

    Air Legends FTW!

    Hat’s off to you Sharky – you’re the main talent behind this game. I’m blown away by what you have achieved with XNA. Think back to the old days when people would try to make games with 2d sprites and text characters in the days of the Commodore 64!

    The music was very fun to make, and if you like it, buy Air Legends to support Sharky!

  289. James Newton-King Says:

    Looks great!

  290. Sharky Says:

    Thanks James.

    Jeesh, you’re quick of the mark. I was still correcting all my typos when you left your comment!

  291. David Weller Says:

    Nice work, Sharkster! You’ve come a LOOOOOOONG way since you first version. It’s great to see you’re still chipping away at it!

  292. Sharky Says:

    Thanks Dave!

  293. Dan Lodge Says:

    In one of the early posts on here, riemer suggests that people looking into HLSL already [should] have a foundation in 3D programming.

    I’m an artist who is interested in post process effects and NPR (non-photo realistic) shaders. A few less technical artists have told me that shaders are programmer work, but at the end of the day shaders are a visual thing, and i want them in my bag of tricks – ideally without having to dedicate masses of time learning irrelevant info.
    :)

  294. Michael Says:

    As a commander I always like trying to hit enemy snipers with falling jeeps.

    Good times. I should get back into BF2, it was a lot of fun.

  295. Pete Says:

    Congrats, man!

  296. James Newton-King Says:

    Is that a frickin’ laser beam?!

  297. Sharky Says:

    Nah, too much red tape, with sharks an endangered species and all.
    Will save the lasers for the Sea Bass – ill tempered, mutated Sea Bass.

    ;o)

  298. Pete Says:

    Kudos for you and good luck, man!

  299. Oli Says:

    Awesome game Sharky : D
    Can you help me?
    I wanna create AI that mmoves towards a given point
    how do I do this?

  300. Sharky Says:

    Thanks Oli.

    Well in simplest terms, you’d probably want to start with getting the Vector between your AI position and the target position.

    e.g. (not sure if this compiles – doing it from memory – but you’ll get the idea)

    //assuming you have a TargetThing object and an AIThing object, both with Position
    //(vector3) properties defining their position in the world.

    Vector3 targetPosition = TargetThing.Position;
    Vector3 aiPosition = AIThing.Position;

    //the difference between these to vectors gives you an offset vector
    //from one to the other

    Vector3 offsetToTarget = targetPosition – aiPosition;
    float distanceToTarget = offsetToTarget.Length();

    //you probably don’t want your AI to warp jump straight to that position
    //so we normalize the offset vector (turns it into a vector heading the same direction,
    //but with a length of exactly 1.

    Vector3 moveDirectionVector = Vector3.Zero;
    if (distanceToTarget > 0) //Normalize would get odd result if the positions were the same.
    {
    moveDirectionVector = offsetToTarget
    moveDirectionVector.Normalize();
    }

    //now to actually move your AIThing in that direction
    //you’ll want something kind of like this.
    //Note: your games Update method would likely have a gameTime parameter.
    //AIThing.MaxSpeedPerSecond would be a float value defining how far something would move in a Second.
    //gameTime.ElapsedGameTime.TotalSeconds is how many seconds
    // (likely fraction of a second) have passed since the previous Update.
    //We use it to even out the perceived movement regardless of the
    //game’s Framerate which fluctuates.

    Vector3 velocity = moveDirectionVector * AIThing.MaxSpeedPerSecond * gameTime.ElapsedGameTime.TotalSeconds;

    //add the velocity to your AI’s position to move it.

    AIThing.Position = AIThing.Position + velocity;

    Hope that helps?

  301. John Vols Says:

    Just seen the aviation game the first time. Good work ppl and keep it up! Is this a free download? or I can buy this game from this site?

    John

    http://www.romplay.com

  302. SteveProXNA Says:

    Hey Sharky, great to see another kiwi on the XNA web site! I went to review Air Legends game but it seems the Review is now closed (1/1/09). The trailer looks awesome however, well done

  303. Sharky Says:

    Hey thanks. Sweet, another Kiwi!

  304. Sharky Says:

    Thanks John.
    There is a free download of a VERY old build available on the blog.

    The Xbox 360 version is published as of today.

    So now I’ll be able to focus on tweaking the Windows version and putting up a free Demo on the blog. At this stage I’m expecting to put up the full Windows version for those that donate.

  305. Spongeloaf Says:

    I just bought Air Legends on the Xbox marketplace and loved it. Great work! I like how simple yet fun it is, and how you cartoonized the plane models just a bit. Also, the air show mode was surprisingly fun. I know you’re probably very busy, but new content would be appreciated as well. Keep up the good work.

    -Spongeloaf

  306. Pieter Says:

    whoohoooooo!

    Congratulations!

  307. David H Says:

    hey thanks for this tutorial the bounding sphere stuff really helped. i created some mouse collision detection with just one sphere, and found it to be insufficient because i could click on air and hit the object. so i looked around for a more accurate method and this seems to be it :D . i do have one question tho, for the model subdivision Vector4 objects how will i know when i have the right scaling factors? i havent looked at the sample code yet so if there is a way to draw the boundingspheres that would be a good way to test the subdivisions, but it just seems like guess and check to me. Any suggestions?

  308. GrafixGuerilla Says:

    It was refreshing to see a Community game that was something other than a space shooters or platformer. After playing the demo, I bought the game immediately. I absolutely love the aircraft modeling and look of the game. I posted a thread on our private gaming site, vgrefugees.com and suggested that our members check out the game.

    I know you are probably quite relieved to get Air Legends on Marketplace. I appreciate the 200 pts price tag, but I’d be willing to pay more for some additional content. More aircraft: Mustang and Corsair vs. Zero? I’d also like to see some added depth. How about a mode where you have to shoot down as many bombers as you can from incoming waves? I’d also love to see a divebombing mode on Japanese ships, complete with anti-aircraft fire.

    Keep up the great work! I love this game!

  309. Sharky Says:

    Thanks dude!

  310. Pete Says:

    Kudos for you!

  311. Simon (Darkside) Jackson Says:

    Fantastic stuff M8.
    As one of the other original crowd, I’ve been watching with keen interest since day 1. Glad you managed to finally get it out there.
    Now I finally have a reason to spend some MS points :-) (other than a few select others)

  312. ZMan Says:

    COgnrats man – nice to see a properly polished game up on CG and I hope you make lots of money!

  313. John Says:

    Congratulations!!

  314. Sharky Says:

    Thanks everyone.

    xD

  315. Sharky Says:

    Thanks so much Spongeloaf & GrafixGuerilla.

    I’m contemplating what my next update will be, but yes I’d definitely like to add just a little more before diving into game #2.

    I had hoped to have a P-51 Mustang in there, but ran out of time. It’s highly likely that I will add one, and perhaps some others.

    As for game modes, I have a stack of ideas I’d hoped to add (the bomber one included). I’d also always wanted to add an actual ground but it just never eventuated. There comes a point where you have to bake in the final features, and defer others till another day. Perhaps an update or even an Air Legends 2 one day. :)

    The great thing is I have the knowledge now to make an even better Air Legends. Plus I have the same models and visual style to make a speedier start.

    Thanks again.

  316. Sharky Says:

    Thanks David H.

    Glad it helped. I really must update it for XNA 3.0.

    Yes, it is very much tweak -> test -> repeat till happy.

    The sample app will render the model for you with the sphere’s visible. I tend to change the sphere color of the model part I’m tweaking to something distinctive – so that I can see what I’m doing better.

    I have an updated app in the works, but it’s just not ready to share yet. It’s a lot tidier for a start, with the layout of the spheres in an XML file instead of C# arrays. Also XNA 3.0.

    I reckon I could even make the tool so they can be tweaked on the fly – visually, and xml saved when you’re happy.

    Stay tuned. No promises on when though, sorry.

  317. RON Says:

    Congrates on making it to the Xbox marketplace and I just wanted to say the game looks great !!! I myself just started to learn how to do this whole XNA thing and I can appreciate all the work and time you put into this game! Keep up the good work!

  318. Sharky Says:

    Thanks! :D

  319. Stu Says:

    Nice one Sharky!

    It’s available in the UK you say?

    I’m going to grab it as soon as I get some more MS points – spent all mine on Rock Band songs.

  320. Sharky Says:

    Hey Stu.

    Great to hear from you, and thanks!

    I wish we had Rock Band 2 in NZ. Only just got RB1 :(

  321. Shtivo Says:

    Is this Sharky an architect tutor from Oxford Brookes??????????

  322. DFA2006 Says:

    Not sure why that would have been a problem. To me it was the they symbol that kills people. It was the leaders and the people that followed the leaders that kill people. They symbol is just a symbol and that is that. Oh well. I would have played it either way, but I do like the look.

  323. Michael Says:

    Nice work, i’ve always found collision quite tricky, this will be a great help.

    lol at Lerp being cooler then the Fonz

  324. Chris Says:

    Hi Sharky,

    Firstly, congratulations on publishing Air Legends. Awesome work, and I wish you lots of success! It looks like you spent a lot of time perfecting your game, and I hope your users appreciate and enjoy that.

    I want to let you know that, for us aspiring XNA developers, your experiences post-launch are as fascinating and interesting as those leading up to launch. So keep the posts coming!

    Cheers,
    Chris

  325. Sharky Says:

    Thanks so much, I’ll keep blogging for sure. Just going through another busy patch. :)

    Hey, good luck with your own game. It’s great you’ve set yourself a goal and just stick with it. It can take a while, and if you’re like me you’ll go through solid patches of doing nothing at all on it. But stick with it, and keep it simple so you don’t get bogged down and demotivated. If a grand feature proves too hard, take a step back and try something easier. You’ll learn more in the end, and can save the grand feature for the sequel.

    :P

  326. Zenfar Says:

    Cool, why did the German insignia have to be nerfed for the XBox version? Is it for sale in Germany? Why can Call of Duty and other WWII games do this and not you? I think this is unfair, especially considering it is a historical game, it seems morally wrong to alter history even in games (expect alternate reality of course).

    Good luck, I hope you have a major hit on your hands!

  327. Tin Says:

    how to generate _modelBoundingPartSubdivisions array.??

  328. Chris Says:

    Way to go, Sharky. Great to see you leveraging multiple channels for your game.

    Have you looked into Windows distribution channels other than your own website? I’d be very interested to know whether distribution channels such as Steam or Stardock would consider hosting a well polished XNA game like yours. Judging from the author’s correspondence on his blog, Valve didn’t seem interested in XBLA game Braid until it became a hit.

  329. Sharky Says:

    Thanks Zenfar, and Chris.

    With regards to the nazi insignia, I’m not sure what Call of Duty did, but I do remember Battlefield 1942 had some other symbols instead of swastikas. I remember a Mod came out that corrected all the textures to be more historically correct.

    Chris, I haven’t looked into other channels for the windows version distribution. Just haven’t had time to be honest. If you find out, please do let me know!

    :)

  330. Jeff Says:

    Looking awesome man! Whens the new website coming? Any new games cooking in the Sharky control centre? :)

  331. Sharky Says:

    Chur bro!

    Well I have the http://bionicshark.com/ domain, but no website yet.

    Some things I want to update on the game. Really easy things, that’ll help people “get” it better.

    Trouble is I sit down in front of the computer and get writers block, or is that coders block? Or perhaps cant-be-arsed block.

    A few ideas for new games too – but the same problem. ;)

    Looking forward to your game dude. Bring it on!

  332. Chris Says:

    How about a Combat (Atari 2600) skin? :)

  333. Sharky Says:

    LOL. Funny you should mention that though.

    I’ve got a modernized retro visual style in my head that I’d quite like to experiment with – for a different game.

  334. bullyx Says:

    Really like the look of this game, but can’t find it on market place

  335. Sharky Says:

    Hi there.

    Yeah the Community Games section of the dashboard is easily missed.
    It should be there (if you are US, UK, Canada, Italy, France or Spain), but if you can’t find it you can queue your xbox to download it via the marketplace on the web…

    Try this link…

    http://marketplace.xbox.com/en-GB/games/offers/00000000-0000-4000-8000-000058550162?cid=SLink

    …then click the “Download to Xbox 360″ button.

    Next time you log on to your Xbox it should start downloading.

  336. Scotty Says:

    This looks really good, i’d be so keen to try it out, i’m also from New Zealand, it sucks how we don’t get the Community Games channel =(.

  337. Sharky Says:

    Thanks Scotty.
    Yeah, it’s annoying, but I’m relieved it hasn’t stopped me being able to publish.

    In the meantime, there’s always the windows version…

    http://sharky.bluecog.co.nz/?page_id=244

  338. Stan Says:

    I have problem getting the code loaded on Visual Studio C# 2005 express edition.
    I installed XNA 1.0, XNA 2.0, XNA 3.0 and still when i loaded, i got this error that says the project installation is not supported.

    Any idea please?

  339. Sharky Says:

    Hi Stan.

    I’m not sure the exact problem, but you’ve prompted me to finally update the sample to work with XNA v3.0. Something I’ve had mostly done, but unreleased for a while.

    The code in this version will be quite out of synch with the tutorial, but the principal is the same.

    Take another look at this page, as I have appended an update and link to the new source.

  340. Jeff Says:

    Sounds great man, looking forward to the new version. What’s the theory behind limiting updates to bugfixes only?

  341. Sharky Says:

    Thanks bro.

    I think it’s more about not wanting people to get lazy and release half finished games. You can see how that would get out of hand.

    Your peers in the community review the games – so as a creator you should play fair and put some quality control into it before you release/update.

    How’s NFS going then?

  342. Music Says:

    Hi Sharky,

    Very good work! Congratulations!
    I want to know how about the music track!
    You needed license for the music track? Im not sure about to license or make on my own…
    …for my indie project. tipilot.blogspot.com ;)

    Thanks in advanced!

  343. Sharky Says:

    A good friend made the music for Air Legends especially. I reckon the http://creators.xna.com forums will probably have info on finding royalty free music, or even people willing to do game music.

  344. samron Says:

    a nice game!!!very interesting

  345. rodier Says:

    hi , your game is great, there is just one reason why Im not gonna buy it on xbox – no multiplayer on Live :-(

    Please make multiplayer at least with 4-6 people via Internet. It will be great :)

  346. Sharky Says:

    Thanks so much Rodier.

    I aggree, it’d be awesome with online Multiplayer. I hope to learn how to build online multiplayer soon, and definitely plan to have online multiplayer in an Air Legends sequel one day (not necessarily my 2nd game).

    It would be extremely difficult (and risky) to shoehorn online multiplayer into Air Legends (1). It was quite a learning experience building it, and it would be far quicker and easier to start fresh.

  347. Lance Says:

    Oh very nice, this is your first published game? I am learning XNA as well, and hope to publish my own game. I just started working on my first game this week. Very nice touch, you even have the icon for the windows install exe file. I hope to see more nice work from you!

  348. Lance Says:

    A few requests for the updated windows game, should not be difficult. Could you add window mode play? Make it so you can kill the music? Otherwise, awesome game!

  349. Sharky Says:

    Thanks Lance.

    Yes, it’s my first!

    Actually, I think you can make it run in Windowed mode. It’s been a long time since I tried it but there’s a True setting in the games settings.xml file. Try setting it to False and see what happens. From memory it’ll be something like 800×600 resolution, because I really only used it for debugging occasionally.

    I’ll keep the music thing in mind.

  350. Lance Says:

    That sounds similar to me, only for me it was the Commodore 64! I loved that computer until about 1988, when I upgraded to an Amiga 500, that I still have, then later to a PC because of my job. I been a programing hobbiest sense then. Playing with VB, then VB.NET, tried DarkBasic.NET GDK for VB.NET, but it was buggy, and performed not so well. Sure it was only $30, but it then did not work right on newer OSes like Vista and W7. So I could see lots of issues of making games using it. Then I found out about XNA and was I excited! I started my first game this week, a 2D arcade game I thought up.
    Well, just wanted to share, take care.

  351. Lance Says:

    Sad to hear you had to get rid of that, what may be a collectible computer from the 80s now. I never even heard of it. You could have donated it to one of those 80s computer places. I still have my Amiga 500! :D My Commodore 64 stopped functioning, so I got rid of it. The SID died. Long live Amiga! Great work on your part, I hope my endeavor does not take so long. Good luck to you!

  352. Lance Says:

    What amuses me is that the Nazi Swastika does not even belong to them. They stole it from another culture, and ruined it. It use to stand for long life and good luck! This idiocy is annoying.
    He only mirrored the original symbol and made a few small changes.
    http://en.wikipedia.org/wiki/Swastika
    Just a thought on ignorance. How people are offended by there own ignorance.

  353. Lance Says:

    Sorry for the update, just found another link you may want to read.
    http://swastika-info.com/en/startpage/iran/1112223833.html

  354. Elbows Says:

    It surely helped me, i was looking for some kind of idea into this problem, thanks for the grant help, although it was out of the blue that i found this, it really gives me a leg up

  355. Elbows Says:

    Looks good man,

  356. WiseOne Says:

    Hey Sharky…i had set up a simple game using the ship model provided in the XNA Tutorial here http://msdn.microsoft.com/en-us/library/bb203897.aspx, and was having trouble

    i tried copying my files into the proper place, and because im inexperienced with XMLs, i just copied yours and renamed it.

    When i ran the program, i saw my ship, but no bounding spheres anywhere!

    i tried commenting out the mesh.draw line in the model drawing code to see if my ship was covering up the boundingspheres, but they simply werent there. im not sure what i did wrong…

    can anyone help me out? im looking to keep this ship model because it looks cool and i dont want to rework my game.

  357. Sharky Says:

    Hi WiseOne. I’m not sure how this reply will format in the blog but here goes…

    So my viewer code makes a few assumptions:

    I’ll get onto the spheres later, but…

    Assumption 1:
    It loads a Texture file independent of any Texture files referenced inside the FBX model. Meaning, I load my texture in code, rather than rely on XNA loading it based on the content of the FBX model. (these would be loaded automatically by XNA as part of the Model load).
    However, I like to keep my choice of texture separate from the model for flexibility in my games. i.e. I might want player selectable skins for a given model.

    Now I see the RelativeFilename in the FBX file just happens to be correct for where you’ll have placed the wedge_p1_diff_v1.tga file in the viewer source. (Otherwise you’d get an error compiling)

    Assumption 2:
    My viewer code assumes the texture file loaded will always match the model name, so besides changing that behaviour in the code you’d want to rename the wedge_p1_diff_v1.tga file to p1_wedge.tga.

    Here’s are the steps I did to get it working in my viewer code.

    - create a p1_wedge.xml file into the MeshInfo folder (copying one of the others).
    - add the p1_wedge.fbx file to the Content\Meshes
    - add the wedge_p1_diff_v1.tga texture into the Content\Textures
    - BUT, then rename it to p1_wedge.tga (to match the model name).

    Renaming it however will make the Model not compile because of the texture references inside the FBX file, so I comment those out as follows:

    - Fortunately the Microsoft’s FBX model has been exported in ASCII format so you can open the FBX file and search for any “Filename:” & “RelativeFilename:” bits. (There might be several)

    - comment them out by putting a “;” at the beginning of the lines.

    e.g.
    ;Filename: “C:/Documents and Settings/a-mdudl/My Documents/maya/projects/default//textures/spacewars/tga/renamed/wedge_p1_diff_v1.tga”
    ;RelativeFilename: “..\textures\wedge_p1_diff_v1.tga”

    Now the model should render, with the texture.

    Now to fix the BoundingSpheres edit the p1_wedge.xml file as follows.

    - there needs to be a “MeshPart” element in the Xml file for each mesh you find in the FBX model and the id is used to find the right one, so these need to be named correctly.

    To get the correct names of these MeshPart’s search the FBX file for “Model::”

    e.g. finds lines something like this…

    Model: “Model::p1_wedge_geo1″, “Mesh” {

    so you’d give your MeshPart id=”p1_wedge_geo1″

    In that FBX file I can only see one “Model::” that seems to be some kind of Mesh. The others seem to be some kind of “Camera” type. (I’m not familiar with the FBX format at all. Just a guess)

    Here’s my quick hack at an arrangement of spheres…
    The blog wouldn’t let me post the p1_wedge.xml here as a comment, so download it instead from here

    Like I said, I don’t really know the FBX format at all, but it’s interesting that for Microsoft’s model seems to have 3 MeshParts if you break point in the DrawModel() method. Each with the same Name. Not sure why. Perhaps something to do with different Materials defined also in the FBX file?

    Hope that works for you.
    All that stuff about the textures is really for my viewer logic. In your game you can do whatever you want, but the BoundingSpheres is what you’re really after right?

  358. WiseOne Says:

    Thanks a lot for the help…i understood most of what you said, and i did place the files thae way you had stated…however, i cant find any .FBX files..they are all .XNB(both models and textures)…i will try to copy your fbx and see what happens.

    for now i am going to use your .xml and run with it to see how it goes.

  359. WiseOne Says:

    ok well i never really figured out how to get it to work (although i did eventually get at least the spheres visible!) so i am just using your .xml for now..

    thanks for your help though, even your quick version is a lot more effective than the singular sphere i was using before

  360. Sharky Says:

    Hi WiseOne.

    I think you might be getting confused between your compiled output files and the actual source files.

    If you’re seeing .XNB files you must be looking at the compiled output, not the source Content.

    When you compile Game Studio takes your source Content like your models (.FBX, .x, etc….), and textures (.jpg, .bmp, .tga, .dds, etc….) and puts them in a propriatory .XNB format along with your compiled application.

    (I’m pretty sure you can’t take an .XNB file and put it in another games source.)

    You must have already copied the p1_wedge.FBX model from the Microsoft sample into the viewer source Content\Meshes. This is the one you’d edit as I described above. NOT, the compiled XNB file under \bin\x86\Debug\Content\Meshes.

  361. “Air Legends” price drop – now only 80 pts! | Sharky’s Blog Says:

    [...] Legends” has been a big success for me since it launched in Jan 2009. Now with game #2 under way (and feeling great), it just feels right to give a little [...]

  362. “Air Legends” price drop – now only 80 pts! | Sharky’s Blog Says:

    [...] also like to remind you that in May 2009 the game was Updated with significant gameplay improvements. Be sure to give it another try, and please do Rate it either on the Dashboard or the web [...]

  363. Ben Says:

    Hi,

    I’m in the process of putting together my first game, I was wondering if you had an idea or knowledge on a simple way to give an object pool table type physics movement. What i’d like to do is let someone shoot an object and when it hits something it changes direction in much the same way pool ball would.

    Nice games I’d like to add, care to give us an idea on how much money you made from it?

  364. Sharky Says:

    Hi Ben.

    I’m afraid I know very little about implementing real physics in a game. I asked a friend who does and he reckoned its probably easier for realistic movement to use a physics engine. jiglibx or even one of the several 2d xna phyics engines perhaps.

    About my game and how much it made, I don’t really want to announce that. I will say though that it is not enough to quit my day job, but has been enough to pay off some bills, debts, and really make life a lot easier. With my first game done, it’ll be much easier to make future games since I’ve learned so much in the process. Definitely working on future games.

  365. Eduardo Hulshof Says:

    Exactly the information I was looking for. I’m a bit worried with the garbage collecting on my XNA projects as I’ll be creating several objects of the same type so recycling them is a good idea. Cheers.

  366. Pete Says:

    Kudos for you! Maybe it’s time for you to bring “Air Legends II” to XBLIG :)

  367. DP Says:

    Hi Sharky,

    Love your game, just wondering whether it’s possible to add achievements to your game? As me and my buds plays alot on splitscreen but don’t get that sense of achievements after all the kills…

    Would like to suggest maybe you can add a bomber raid/protect or sort.. then it will be awesome… Don’t mind paying another 80 points for it.

    DP

  368. Sharky Says:

    Thanks DP. Great to have your feedback.

    Unfortunately games on the Indie games marketplace can not have *real* achievements – ala Xbox LIVE achievements.

    However a number of games have been designed with their own version of achievements. I love the idea of adding achievments, but I don’t plan on making further changes to Air Legends now.

    However I do have a new game in development, so adding achievements of some sort is not out of the question. Taking the best bits of Air Legends, but still a significantly different game, and different era of aircraft.

    Thanks again,

    Lawrence (aka. Sharky)

  369. elliot Says:

    this game is awsome, although maybe you could add more planes such as the p-51D mustang, A6M zero, Hawker Hurricane. Thnaks

  370. Sharky Says:

    Thanks Elliot.
    Yeah, I’d love to add those exact planes. In fact I always intended to.

    Modelling the planes is very time consuming though. Especially when I’m a one man development shop!

    One day perhaps. But right now I’m focussing on a new game. Still with legendary planes, but not WWII this time.

  371. Jeff Says:

    Glad to see you blogging again mate! Keep up the good work and post some screenshots of the new game :)

  372. Sharky Says:

    Thanks. Oh man, I can’t wait to do the big unveil. I will once I’ve 3D modeled the games namesake first. Sounds backwards I know, but all will become clear.

    ;)

  373. pixelrimes Says:

    Hi Sharky, I was looking for some reference on Hawker Tempest and found your blog :) Congratulations on your success with Air Legends and it’s great to know you’re busy with the 2nd one!

    Just thought I should share my Tempest MK V here and thank you for inspiring me!

    [IMG]http://i42.tinypic.com/hs3v4l.jpg[/IMG]

  374. Sharky Says:

    Wow, nice work. I’m a totally amateur 3D modeler really. Looks like your a pro.
    :)

  375. mike rothery Says:

    just been introduced to xna coding through uni, i am more of a graphics man.

    currently working on a version of the classic ‘asteroids’ though in mine you shoot at russian sats lol. Anyhow my boundingsphere code is pinched from the tutorial ‘Make a game in 60 mins’ > http://msdn.microsoft.com/en-us/library/bb975644.aspx <

    i am having trouble as they seem to happen at random rather than as expected can you possibly give me some pointers (well more pointers) as to make these collisions more reliable

    would be much appreciated

  376. mike rothery Says:

    infact i must say… most my code is from that tutorial … man thats a weight off my chest … just with additions such as a timing system and ways to reward objectives within the game

  377. Sharky Says:

    Hi Mike.

    This is the first time I’ve actually looked at the “60 mins” tutorial, but here’s a thought to consider…

    Do you scale you models when you draw them at all?

    In the their tutorial they don’t appear to be scaling their model when it draws. So their mesh’s BoundingSphere.Radius will be correct.
    However, if you are scaling your models, you need to make sure you factor that into the BoundingSphere size as well.

    So, if you Draw your models at 3 times the size, remember to triple the mesh’s BoundingSphere.Radius as well.
    Likewise if you are making things smaller.

  378. mike rothery Says:

    thanks for the swift reply,
    unfortunately i am not scaling all of that is done within maya before exporting it as a suitable fbx file, quite the ball ache as it’s a case of trial and error lol, if you have any other ideas would be great however thanks for even taking the time, glad to see masters of xna willing to help us beginners.

    take care

  379. Sharky Says:

    LOL.

    Hmmmm…. puzzling.

    Best bet is being able to visualize what these BoundingSpheres look like.
    If you look at my sample I have a code for rendering the spheres.
    See you if you can hack that into your code. It might give you a clue as to what’s going wrong. Like, are they too big? in the wrong place? etc…

    Debug rendering stuff is great when you’ve got it working. But while I was debugging that I was not always sure if it was my debug rendering code at fault, or truly the Spheres. I got it working in the end, so perhaps you could try that too.

  380. mike rothery Says:

    can i also offer my graphics to you (free of charge),

    would be great to have such a chance, though if thats your own plane not only hats off; as i think its cool, but can understand why you don’t want mine :P

    again take care my man

  381. Sharky Says:

    the other possibility is the exported model could be at fault. XNA ContentPipeline is simply deriving the BoundingSphere from the exported model.

    So with Debug rendering of the spheres you could check the sphere represents the extent of your model’s geometry, and is not wildly different.

    The modeling tool/export you use may be exporting Camera/lighting objects etc… as part of the FBX and confusing things perhaps?

  382. mike rothery Says:

    … your reply hadn’t come up when was typing lol

    cheers for input

  383. Sharky Says:

    no problem.

    Actually to test the exported model itself you could just take my sample, and substitute your FBX model into it to see the spheres.

    • Add it to the Content\Meshes
    • Add a texture file with a matching name in Content\Textures.
    • Add a really simple XML file with matching name into the MeshInfo folder. something with just one BoundingPart with xyz’s=0.5, 0.5, 0.5 and w=1.0
    • Change the line of code that defines which model it loads. private string _modelContentName = "TutorialPlane";

    … and voila, you should see what XNA’s derived sphere looks like.

  384. Lance Zimmerman Says:

    Hey, I would have liked to see this tutor you were going to make a few years ago. Are you still going to make it, or was it not done? Is it some where else? I’m trying to figure it out, while I’m still making my game.

  385. Lance Zimmerman Says:

    I’m sad you stopped developing it for Windows. Ah well.

  386. Sharky Says:

    Yeah, sorry.
    It takes all my time to get a polished 360 version. And it’s so much harder to do the same for a Windows version.

  387. Sharky Says:

    Hehe. Oops, I really should stop making promises and predictions on my blog. :)
    Never enough time in the day, aye.

    Hopefully this helps…

    http://www.nuclex.org/blog/announcements/57-wix-xna-installer-31

    (I’ve not tried it, but could be exactly what you’re after)

  388. M3hdi Says:

    Hi guys !!
    this might be a dumb question (i’m an XNA novice and i’m trying to set up my first xna game as a project for my c++ class ) any way, i’m having some issues concerning the building of the project you provided here :http://sharky.bluecog.co.nz/uploads/code/Sharky.3DCollisionDetection.Tutorial_v1.3.0.0.zip
    whenever i try to run the project i get an exception in the MeshInfo.Load() method when it reaches this particular line:

    float x0 = float.Parse(subdivisionNode.Attributes["x"].Value);

    it says that “the input string format is incorrect” (i tried my best to translate the error text cause i’m from france and the interface language of my IDE is set to french :p )

    i’ve tried to modify the xml file, changed its location and its path, and several other code modification but without success.
    so please sharky, can you help me fix this problem ?

    Ps : sorry for my lame english, my command of it still not perfect yet :)

  389. Sharky Says:

    Hey M3hdi.

    Your english is great – I really wouldnt have known.

    I think I know what the problem might be. The clue was that you said your IDE is set to french. I remember Air Legends failing Peer Review once because when played on Xboxes in the France & Italy regions it did weird things. Giant Models to be specific.
    It turned out to be a problem with similar Parse/Convert code. If I remember correctly France & Italy use a comma character (”,”) to delimit the fractional part of a number. In most english language locales we use a period, or decimal point character (”.”).

    The solution was to add an extra parameter to all the Parse & Convert statements that dealt with numbers.

    for instance, I changed….

    float x0 = float.Parse(subdivisionNode.Attributes["x"].Value);

    to…

    float x0 = float.Parse(subdivisionNode.Attributes["x"].Value, CultureInfo.InvariantCulture.NumberFormat);

    (CultureInfo can be found in System.Globalization)

    I hope this solves it for you. Let me know how you go.

    Cheers,

    Sharky

  390. M3hdi Says:

    hey Sharky, that was it , the solution you gave me was just perfect. can’t thank you enough for the solution and the quick response, you have made my day sir.
    thanks again, and keep up the good work !!

    M3hdi

  391. Dave Says:

    Great.
    This work fine, I’m never using bounding boxes again, until I absolutly need them. Using bounding spheres is far quicker and if used correctly, accurate for collisions between round objects and straight objects.
    Keep up the good work!

  392. Sharky Says:

    Thanks Dave. :)

  393. Stephen Says:

    Hi Sharky,
    Stumbled across your website – always good to find more game devs in NZ. There is a reasonably active community of devs online at http://www.playmaker.org.nz – come and tell us about your projects.

    I run the Auckland Game Dev Meetup, which is going from strength to strength. Some of the guys on playmaker held a Wellington Meetup last month.

    We’ve also held a few Game Dev Workshops in the weekends, similar to your afterwork sessions. Odd how in this internet-age having collaborators around physically helps get projects done.

  394. Cupido Says:

    Hi, Great tutorial here for boundingsphere. Do u have a simple way to create a boundingbox for a model? Any example codes for it? Please help me as I already spent 1 full week on this topic. Thanks. :)

  395. Sharky Says:

    Hi, and thanks.

    I’m not sure, but I did notice the creators.xna.com site now has a sample on collision that includes an OrientedBoundingBox (i.e. not axis-aligned like the standed BoundingBox).

    Take a look at it here. It’s for XNA 4.0, but if it’s XNA 3.1 your after, perhaps the BoundingOrientedBox.cs class could be ported over easily?

    Otherwise google for terms like non-axis alligned bounding box, oriented bounding box etc…

  396. Dan Says:

    If you’re looking for help on shaders, I’ve written some pretty basic tutorials for things such as ambient light, diffuse light, specular light, rim lighting, texturing, etc.

    I break them down to the very smallest detail so it should help out!

  397. Dan Says:

    The website is http://www.digitseven.com by the way.

  398. Sharky Says:

    Thanks for that. Good to know.

  399. Jeff Says:

    This is shaping up to be a huge improvement on the original :) Threat indicator FTW!

  400. I make indie xbox 360 games Says:

    Thanks for the tutorial, im new to 3D game development and I must say that I’m still clueless to many aspects, I couldn’t even begin to imagine 3d physics *cry*.

    Anyways I wanted to mention to Banzai that you do not need to use a bounding box to check ground collision, the only way I know of that is “easier” is getting all the Y points of the models height points and then check that vs the y point of your model, if that makes sense.

  401. Sharky Says:

    Thanks. I’m glad the tutorial is still helping people. I really should update it for XNA 4.0.

    In my own projects I have also changed the MeshInfo xml files to a content type loaded with the Content Manager.

  402. Jonathoin Gohan Says:

    Thanks Sharky . thank u so much………

    Really this tutorial is like a helping hand in our project where we thought collision detection would be of great difficulty…..

    thank u so much ……….

    if u don’t mind can we have ur mail id please.

    thanks sharky

  403. Tyson Zangetsu Says:

    Thanks a lot Sharky………i was able to complete the collision detection easily with ur help.

    arigatho

  404. Jegan Srinivas Ram Says:

    i was working with collision detection with the source code u have uploaded and the tutorial u have posted in the site to make collision detection in my game….but when i was following i felt that the source code was advanced than that u have posted in the site………so could u please mail me the old source code or please update the site……or help me abt how to create a proximity sphere for my model…………..help me pls

  405. Sharky Says:

    Hi Jegan.

    The old source code that matches the tutorial text is here…

    http://sharky.bluecog.co.nz/uploads/code/Sharky.3DCollisionDetection.Tutorial_v1.0.0.2.zip

    It’s so long ago that I don’t remember what version of XNA Game Studio you would need to open the project.

    I’m sorry I can’t update the tutorial text right now, as I’m right in the middle of completing my second game for publishing. I certainly would like to update it one day, but I have no idea when that would be.

  406. Playfa Says:

    hi Sharky,
    i really need updated version (XNA 4.0),
    did you develop it for xna 4.0?

  407. Sharky Says:

    Hey there.

    I can’t remember if the version I’m using at home is XNA 4 yet. I’ll have a look.
    There is a XNA v3 version on my blog however.

    here…
    http://sharky.bluecog.co.nz/?p=311

    Hopefully not too difficult to upgrade.

    cheers,

    Lawrence.