• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Mybowlcut

Members
  • Content count

    790
  • Joined

  • Last visited

Community Reputation

176 Neutral

About Mybowlcut

  • Rank
    Advanced Member
  1. Yeah, you're right in that I am thin on steering experience. I knew how it would come across just throwing up a skeleton project, but I was quite honest from the start with regards to that. I do not at all feel confident writing this from the ground up, so I'll try to get it working in my game first in whatever hacky way that ends up being, and if it seems like it works well enough to form it into a proper API, I'll do that. After all, my aim for the project was always just to get something that works. Even that is better than what I have now - something that barely functions at all. :p
  2. To recap the main points I mentioned earlier: C++ 2D (I'm not sure if this is really a hard requirement, but I think it would simplify things) Should be flexible enough to work with most physics and graphics libraries In terms of what it should achieve, I was thinking just basically "move to this position, avoiding obstacles along the way". I think that that in itself is sufficient for most simple 2D games. From that, you can probably implement more complex behaviour - things like hiding behind cover and staying out of an enemy's line of sight can be achieved by combining that behaviour with some ray casts, right?   I have ideas about how the API should look, but nothing concrete. An example of usage as it stands at the moment is available in the examples/qml-box2d directory.
  3. Hello.   I'm trying to create an extremely simple steering library in C++ for 2D games:   https://github.com/mitchcurtis/SimpleSteer   My motivation is to get a basic, yet useful library out in the open, as there doesn't seem to be any simple steering library out there.   I've just started yesterday, and I don't have much yet, but I've got Box2D to handle physics and Qt Quick to get something on-screen for the one example that does exist.  I'm trying to keep the library itself independent of any physics or graphics library.   I (and likely many others who find AI a bit daunting) would be extremely grateful to anyone who is interested in collaborating on this project, whether it's hundreds of lines or a one-liner. I don't know how else to get something like this started other than just creating it and seeing what happens...   Cheers.
  4. Some pseudocode for those of us that suck at maths would complete this article quite nicely.
  5. I'm also curious to know what type of game this is. Just from skimming through the text here and looking at the screenshots, it reminds me of Mount and Blade, sorta.   Also, did you literally spend hours "just flying the camera through the clouds"? :D
  6. So is the code cross platform? Is it just the Unity editor that only runs on Windows?     I would love to have something like this for my game, but at 500 euro, it's too much for me.
  7. I'm making a 2D game where the I want the world to be freely navigable by AI - specifically, the game is based on an island and there will be animals running around, following (preferably) random paths. I've implemented A* for grid-based 2D games, but am not sure what the best approach would be in this scenario. From what I've read, navigation meshes would be my best bet. I think Recast would do the trick, but am not sure... are nagivation meshes what I want? How can I create a mesh for a 2D world to pass into a tool like Recast? What do I do for collidable objects that are dynamically placed in the world (like a hut built by the player)? Oh, and some additional info: the game is being developed in Java. I thought I'd mention this in case any suggestions require an API in some other language to be used instead of some tool that you'd use outside of the game's execution. Edit: [url="https://code.google.com/p/straightedge/"]This[/url] looks promising. Cheers.
  8. Very cool. I have had a similar idea for a while now - except in mine you could build traps to capture animals, use basic tools to hunt etc. Also, mine wasn't planned to be 3d. Which technologies are you using for this? Also, I notice that your names are Scandinavian? Where are you guys from?
  9. [quote name='alvaro' timestamp='1320700538' post='4881528'] [quote name='Mybowlcut' timestamp='1320699810' post='4881524'] [quote name='alvaro' timestamp='1320699318' post='4881523'] In other words, your expectation of not losing precision in that process is unreasonable. Now, if the rest of your code is robust enough, whether you get 0 of -1.5308086E-15 shouldn't make much of a difference.[/quote] How would I ensure that it is? I'm assuming it's something to do with what haegarr said: [quote][color="#1C2837"][size="2"]Notice that small errors may become a problem when being accumulated. E.g. concatenating many rotations will yield in a non-uniform scaling deformation because the small errors summed up will leave you with a non-pure rotation. If you have a situation like that you need to be up against it. Another situation is where precision plays a role, e.g. at marginal cases in point in polygon tests. In such cases you need to use precise data types and functions.[/size][/color] [/quote] [/quote] In the case of a rotation matrix that ends up not being orthogonal, you can re-orthogonalize it every few frames. If you use a quaternion it's actually easier to do. Point-in-polygon tests are tricky. Ideally it should be the case that for a point on the border of the polygon it doesn't matter much whether you classify it as inside or outside. Anyway, you didn't say what you will do with the result, so it's hard to tell if you'll run into trouble. You should educate yourself about how floating-point numbers work. There's just no way around it. [/quote]The function in question will be used for entity movement throughout a level. The 'What Every Computer Scientist Should Know About Floating-Point Arithmetic' is beyond my knowledge of math. I'm satisfied with the result of this thread anyway - it seems that it's inescapable so I'll let it be until it actually affects the game.
  10. [quote name='alvaro' timestamp='1320699318' post='4881523'] Values directly along the x axis do return 0 if you measure along the y axis. The problem is that you cannot represent pi/4 exactly as a floating-point value, and you don't get something that is directly along an axis if you take another axis and rotate it by an amount that is close to pi/4 but not quite pi/4.[/quote] Oh, ok. Probably had a lot to do with the fact that I thought the value I was getting was larger than it was, as well. :s [quote name='alvaro' timestamp='1320699318' post='4881523'] In other words, your expectation of not losing precision in that process is unreasonable. Now, if the rest of your code is robust enough, whether you get 0 of -1.5308086E-15 shouldn't make much of a difference.[/quote] How would I ensure that it is? I'm assuming it's something to do with what haegarr said: [quote][color="#1C2837"][size="2"]Notice that small errors may become a problem when being accumulated. E.g. concatenating many rotations will yield in a non-uniform scaling deformation because the small errors summed up will leave you with a non-pure rotation. If you have a situation like that you need to be up against it. Another situation is where precision plays a role, e.g. at marginal cases in point in polygon tests. In such cases you need to use precise data types and functions.[/size][/color] [/quote]
  11. [quote name='alvaro' timestamp='1320668588' post='4881371'] Looking at the bit pattern makes sense if you are checking something like a relative error. If you want to compare to zero, checking if the absolute value is less than epsilon is actually much more reasonable. What is it you are trying to do that requires checking if the number is 0? [/quote] If you look at the original post, I want to make sure that the method returns 0 and not [color="#1C2837"][size="2"]-1.5308086E-15 for the y axis when an angle of 90 degrees is passed in. Everyone is saying it involves floating point comparison, so that's why we're discussing how to go about it.[/size][/color] [color="#1C2837"][size="2"]Edit: A similar value results from an angle of 270 degrees ([/size][/color][size="2"][color="#1c2837"]4.5924254E-15). What I want is for values directly along the x axis to return 0 during a calculation only involving movement along the y axis, as seen in my original post.[/color][/size]
  12. [quote name='haegarr' timestamp='1320657474' post='4881323'] Java has a build-in function to get the bit pattern of floats: [url="http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Float.html#floatToIntBits(float)"]Float.floatToIntBits(float)[/url], so that int aInt = *(int*)&A; will become int aInt = Float.floatToIntBits(A); [/quote] Ah, thanks for that. Now I've got: [code]public static float getYDistanceMovedBy(float amount, float rotation) { return Math.abs(amount) * (float) -Math.cos(Math.toRadians(rotation)); } public void testGetYDistanceMovedBy2() { float amount = 25.0f; float rotation = 90.0f; float distance = Geometry.getYDistanceMovedBy(amount, rotation); int maxUlps = 10; assertTrue(almostEqual2sComplement(0.0f, distance, maxUlps)); } boolean almostEqual2sComplement(float a, float b, int maxUlps) { // Make sure maxUlps is non-negative and small enough that the // default NAN won't compare as equal to anything. assert(maxUlps > 0 && maxUlps < 4 * 1024 * 1024); int aInt = Float.floatToIntBits(a); // Make aInt lexicographically ordered as a twos-complement int if (aInt < 0) aInt = 0x80000000 - aInt; // Make bInt lexicographically ordered as a twos-complement int int bInt = Float.floatToIntBits(b); if (bInt < 0) bInt = 0x80000000 - bInt; int intDiff = Math.abs(aInt - bInt); if (intDiff <= maxUlps) return true; return false; }[/code] That article says: [quote]maxUlps cannot be arbitrarily large. If maxUlps is four million or greater then there is a risk of finding large negative floats equal to NANs. If maxUlps is sixteen million or greater then the largest positive floats will compare as equal to the largest negative floats. As a practical matter such large maxUlps values should not be needed. A maxUlps of sixteen million means that numbers 100% larger and 50% smaller should count as equal. A maxUlps of four million means that numbers 25% larger and 12.5% smaller should count as equal. If these large maxUlps values are needed then separate checking for wrap-around above infinity to NANs or numbers of the opposite sign will be needed. To prevent accidental usage of huge maxUlps values the comparison routines assert that maxUlps is in a safe range.[/quote] Is the maxUlps going to be variable or can I use a fixed value? How do I determine it in either scenario?
  13. [quote name='haegarr' timestamp='1320654669' post='4881311'] [quote name='Mybowlcut' timestamp='1320652023' post='4881304'] ...Ok, so basically clamp to 0 if it's an acceptable margin of error? [/quote] It depends on the circumstances: The value you're computing is a distance. If it is measured in meters and express the distance between 2 atoms then you shouldn't clamp it. But if it is a distance in meters between 2 people meeting at the streets a resolution of 0.001 is good enough. You actually do a comparison by invoking assertEquals(0.0f, distance). For this you should use an Epsilon expression. For sub-sequent uses as transformation parameter you'll usually need not clamp the distance but use it as is. Notice that small errors may become a problem when being accumulated. E.g. concatenating many rotations will yield in a non-uniform scaling deformation because the small errors summed up will leave you with a non-pure rotation. If you have a situation like that you need to be up against it. Another situation is where precision plays a role, e.g. at marginal cases in point in polygon tests. In such cases you need to use precise data types and functions. [/quote] Hmm. I've been doing a bit of reading (I appreciate the links given, but I'm not mathematically minded and so opted for something with simpler examples) and it seems that my idea of using a fixed value for the epsilon wouldn't be a good idea. I'd like to use something like [url="http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm"]AlmostEqual2sComplement[/url], but am not sure about two things: [list=1][*]How to do the same thing in Java (in terms of the dereferencing etc.)[*]What to use for maxUlps[/list] Here is the [font="Courier New"]AlmostEqual2sComplement[/font] mentioned in the article: [code]bool AlmostEqual2sComplement(float A, float B, int maxUlps) { // Make sure maxUlps is non-negative and small enough that the // default NAN won't compare as equal to anything. assert(maxUlps > 0 && maxUlps < 4 * 1024 * 1024); int aInt = *(int*)&A; // Make aInt lexicographically ordered as a twos-complement int if (aInt < 0) aInt = 0x80000000 - aInt; // Make bInt lexicographically ordered as a twos-complement int int bInt = *(int*)&B; if (bInt < 0) bInt = 0x80000000 - bInt; int intDiff = abs(aInt - bInt); if (intDiff <= maxUlps) return true; return false; }[/code]
  14. [quote name='MajorTom' timestamp='1320651996' post='4881303'] [quote name='Mybowlcut' timestamp='1320651463' post='4881301'] I'm roughly familiar with epsilon comparison, but I was under the impression that it was a far smaller threshold than -1.5 (the value in question)? I'm also a bit confused as to how comparison relates to my problem when there are none taking place. If it was a smaller number (ie < 1), I'd understand... [/quote] The value [color="#1C2837"][size="2"]-1.5308086E-15 actually represents something like -0.0000000000000153 - which is rather close to 0.[/size][/color] [size="2"] [color="#1C2837"][left]You can think of the "E-15" as a shift of the decimal point. Its a short hand notation for extremely large or small numbers.[/left][/color] [color="#1C2837"][left]The previous posters have linked some nice resources, especially rip-off's post.[/left][/color][/size] [/quote] Thank you for taking the time to explain it without being condescending, unlike certain people in other threads I've made... very helpful.
  15. [quote name='haegarr' timestamp='1320651862' post='4881302'] [quote name='Mybowlcut' timestamp='1320564695' post='4881003'] If I pass in amount=25 rotation=90 to the method below, the result is a weird -1.5308086E-15 instead of (what I [i]thought[/i]) should be 0. Why is this? ... [/quote] [quote name='Mybowlcut' timestamp='1320651463' post='4881301'] I'm roughly familiar with epsilon comparison, but I was under the impression that it was a far smaller threshold than -1.5 (the value in question)? [/quote] The value in question seems me -1.5*10[sup]-15[/sup], what is -0.0000000000000015 (if I've counted correctly). That [i]is[/i] somewhat close to 0, and definitely less than 1 ;) [/quote] Why is it that the one time someone responds quickly on GameDev, I make a really stupid post? I tried deleting it, but you're just too quick. Haha. Ok, so basically clamp to 0 if it's an acceptable margin of error?