tag:blogger.com,1999:blog-5439941893980599296.post4614082670434901313..comments2023-09-24T07:49:19.084-04:00Comments on Games By Design Has Moved!: Optimizing 30,000+ Ships In Realtime In C#Christopher M. Parkhttp://www.blogger.com/profile/16719365007524426389noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-5439941893980599296.post-17573685839136341732009-08-20T20:38:31.661-04:002009-08-20T20:38:31.661-04:00Ah, well. So it goes!Ah, well. So it goes!Christopher M. Parkhttps://www.blogger.com/profile/16719365007524426389noreply@blogger.comtag:blogger.com,1999:blog-5439941893980599296.post-26714723667528486432009-08-20T18:48:16.222-04:002009-08-20T18:48:16.222-04:00just installed AI Wars myself. I was also surprise...just installed AI Wars myself. I was also surprised for a second at the prerequisites. But I figure, #1 this is an indie game from a small shop, and #2 a .net update is pretty understandable.<br /><br />You would think that a magazine focused on independent games would have a similar kind of sympathy.etherjoehttps://www.blogger.com/profile/06049685162484753922noreply@blogger.comtag:blogger.com,1999:blog-5439941893980599296.post-18153468418195571012009-08-06T19:59:49.132-04:002009-08-06T19:59:49.132-04:00Kevin,
Believe it or not, I didn't think of t...Kevin,<br /><br />Believe it or not, I didn't think of that -- I've tried that out in a few specific places, and it really helps a lot! The main thing that is problematic with it is that because of the huge scale of distances in AI War, I need to use int64s instead of int32s, but the performance of that is still superior to even the distance approximation method. So as of version 1.014A, AI War will have three different methods of calculating distance -- one very precise, one precise-enough-for-all-but-close-ranges, and then your suggestion for precision comparisons.<br /><br />Thanks very much for the note!Christopher M. Parkhttps://www.blogger.com/profile/16719365007524426389noreply@blogger.comtag:blogger.com,1999:blog-5439941893980599296.post-42324973527064059162009-08-01T10:55:47.608-04:002009-08-01T10:55:47.608-04:00depending on exactly how you're using the dist...depending on exactly how you're using the distance-between-objects, a lot of times it's easier to simply compare the squares, so instead of:<br /><br />dx = x1-x2;<br />dy = y1-y2;<br />if (sqrt(dx*dx + dy*dy) < dist)<br /><br />do:<br /><br />if (dx*dx + dy*dy < dist*dist)<br /><br />I'm sure you've thought of that, but I'm just giving a suggestion.Unknownhttps://www.blogger.com/profile/11879864484575585398noreply@blogger.comtag:blogger.com,1999:blog-5439941893980599296.post-7738670597231812992009-07-30T16:05:39.016-04:002009-07-30T16:05:39.016-04:00I actually had not heard of that, but the fact tha...I actually had not heard of that, but the fact that I am using fixed-int math instead of floating-point math probably complicates that. I took at look at some examples of that method, but I'm not comfortable enough with them to try translating them to fixed-in style. The distance approximation method that I'm linking to above does fewer overall multiplies and divides to get the result I need, anyway, though. But thanks for the links, those were very interesting!Christopher M. Parkhttps://www.blogger.com/profile/16719365007524426389noreply@blogger.comtag:blogger.com,1999:blog-5439941893980599296.post-15781936814310213552009-07-30T03:01:17.649-04:002009-07-30T03:01:17.649-04:00Had fun reading.
Have you considered "Fast i...Had fun reading.<br /><br />Have you considered "Fast inverse square root" from Quake III in your distance approximation? How do you think would it affect the performance?<br /><br />References here: <br />http://en.wikipedia.org/wiki/Fast_inverse_square_root<br />http://www.codemaestro.com/reviews/9Anonymoushttps://www.blogger.com/profile/05812234026577788152noreply@blogger.comtag:blogger.com,1999:blog-5439941893980599296.post-77143136569593487802009-07-19T10:18:52.483-04:002009-07-19T10:18:52.483-04:00Hi E,
Glad you enjoyed the article! Here's a...Hi E,<br /><br />Glad you enjoyed the article! Here's another one that looks at distance approximation: <a href="http://christophermpark.blogspot.com/2009/07/range-checks-approximation-vs-accurate.html" rel="nofollow">Range Checks - Approximation vs Accurate</a>Christopher M. Parkhttps://www.blogger.com/profile/16719365007524426389noreply@blogger.comtag:blogger.com,1999:blog-5439941893980599296.post-68832833369472220782009-07-19T01:41:03.332-04:002009-07-19T01:41:03.332-04:00Great article!
I'm interested in the distance ...Great article!<br />I'm interested in the distance approximation method you used, could you possibly find it and post?<br /><br />Cheers :)Enoreply@blogger.com