• 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.

thefollower

Members
  • Content count

    268
  • Joined

  • Last visited

Community Reputation

354 Neutral

About thefollower

  • Rank
    Member
  1. Hello I am learning networking at the moment and just in the middle of sending client positions to the server every x amount of milliseconds. But this is a fair bit of bytes to send quite a lot. So i wondered about sending just keyboard and mouse inputs to the server instead of the position updates, since this would be a lot less bytes. Yet it seems most games don't use this method, they tend to send position updates instead. I am curious what pros and cons there are between these 2 options? I feel like i might be over looking something here because sending the keyboard and mouse inputs seem to be at first glance a simpler approach and less bandwidth too. The game is an FPS so it needs to be real time aswell. So is there some issue with just sending keyboard/mouse inputs rather than positions that i am not fully grasping due to lack of experience with this?
  2.   Physics2D.OverlapBox has an angle parameter for rotation. But writing it from scratch for educational purposes is perfectly respectable imo.     Would the angle parameter be for the box you are applying on top of existing colliders? The colliders would need to be rotated and then do a point overlap rather than a box for raycasting no?
  3.   The physics system is very efficient, especially if you user layer masks intelligently. The size of your environment shouldn't matter much. And the Physics2D library essentially mirrors its 3D counterpart, so you can just use Physics2D.OverlapBox. If you're insistent on not using the physics system (I tend to avoid it but in the case of pure raycasting and intersection checks I find it's very useful), I guess you'll just have to write your own OBB logic     Yeah thats the best way to learn :) Plus even if i did use their system. It would be of no use for rotated objects anyway unless i use 3D colliders.
  4.   Unity's raycasting handles rotated boxes fine as far as I know, so why is detecting a mouse ray a problem? And for collision detection, what's wrong with Physics.OverlapBox? https://docs.unity3d.com/ScriptReference/Physics.OverlapBox.html I might just not be understanding the problem correctly, but based on the image you posted it shouldn't be an issue in Unity.     Well i am not using colliders and even if i do, 2D colliders are not rotated they are axis aligned so they would be like the second example in the image when i need the third example. I just have a bounds type and a general ray casting method currently. If the object is rotated the bounds isn't accurate to the object as per the image i posted (the second one is where the issue lies) so i get issues. The hit point may be in the bounds but not in the actual segment. Hope that makes sense. Since the objects are static on the x:z plane and non moving theres no point in 3D colliders or even 2D colliders, using the physics engine is wasted performance and my environment is pretty big it won't be feasible for me to use it.. I was hoping to make it more optimised by checking if the point hits the bounds but making sure the bounds was accurate to the segment (the third example in the image).
  5. Yes, but it reduces the problem from N*N tests to a few interesting cases, and it's bloody fast. If a single test doesn't seem feasible, find another way, for example, by splitting the problem. First try to eliminate all cases that are obviously non-overlapping, then for a few cases that might overlap, do a second test in some way. I find this the most rewarding part of programming, figuring out a way to solve a problem that looks impossible at first. If you split the problem, for the first test, bounding box works nicely, it's fast enough for large quantities of areas, and it doesn't yield false negatives. It ends with a bunch of 2 particular shapes that might match. That problem is much simpler than matching zillions of shapes with each other. That's progress!! (If an idea doesn't solve the entire problem, don't discard it and stare yourself blind at its failure, it may be tweaked or used as building block in a larger context.) Likely that second test depends on the shape of the two areas. If you have a lot of boxy shapes, you may want to make a dedicated test for that (your bounding box could be made to fit exactly if you exclude the triangles that are not covered). One other possible direction is to repeat the bounding box trick, but with several smaller boxes (several sub-boxes together make up the shape). You can perhaps try some line segment test too. Likely there is prior art in resolving collisions between exactly 2 shapes.     Well i can understand the quad tree is useful, but i am confused why unity bounds has to be axis aligned and not related to the rotation of the transform - it seems to be world space not local space which i find really strange. It doesn't seem like an easy calculation to check if the ray hits the two triangles outside the segment.  If i can get it like the second example in the previous image it would solve all the problems pretty easily.
  6. The problem is using bounds is axis aligned. If the segment is not travelling along the axis' then the bounds is not accurate.   See image below:   So the middle one, which is what Unity does with bounding boxes is wrong for what i need. And thats the problem i am having.   So i cannot accurately detect when a mouse ray hits the segment, or when it collides with another segment because the bounds are not tightly wrapped around the segment shape, does that make sense? How do i solve this problem, so it is more like the 3rd example in the image?
  7. Hi I have a setup of connected nodes via segments - these segments travel in any direction (think of like a connected road network). My problem is how to accurately do collision checks for these segments and nodes. Additionally some segments are curved via bezier curves which adds to the complexity of collision detection.  There are 2 types of issues i do not know how to solve: 1) User clicking with the mouse and detecting a node or a segment (for example adding a new road branching off an existing node or segment). Since adding a branch to a segment, would need to insert a new node and split the selected segment.  2) Detecting if a segment collides with another segment when trying to add a new one at run time. My code setup is: public struct Node { public Vector3 Position { private set; get; } //list of segments node is connected to public Segment?[] Connections_Segments { private set; get; } //max 4 size //list of nodes connected to - useful for pathfinder public Node?[] Connections_Nodes { private set; get; } //max 4 size //constructor etc etc } public struct Segment { public Node[] Nodes { private set; get; } //maximum of 2 nodes public int Thickness { set; get; } //thickness of the road i.e 2 lane, 4 lane etc public Vector3 AnchorPoint {private set; get; } //TODO bezier curve //constructor etc etc }  Some things i thought about and tried but didn't work: I added bounds to both nodes and segments, but soon realised this made no sense. In Unity bounds are axis aligned, this is no good for roads that do not follow along an axis (curved roads or roads going diagonally). I also thought about using quad tree which only makes sense if the roads are straight, but they are obviously curved. And again using bounds is axis aligned so it won't be able to accurate represent roads that do not follow an axis (such as curved segments and diagonal segments). So i am bit lost now what else to try. Hoping some one who has experience with design problems may have some suggestions that I can try.
  8.   You're right i am an idiot! I have solved it now i realised that mistake ! oops :P
  9. Hi    I have a line segment intersection method which i translated from JavaScript to C#. But it seems to be hit or miss on success rate on whether it detects an intersection of two lines. I don't know why this is. This is my method: public static bool LineSegementsIntersect(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, out Vector3 intersection) { intersection = Vector3.zero; float A1 = p1.z - p0.z; float B1 = p0.x - p1.x; float C1 = A1 * p0.x + B1 * p0.z; float A2 = p3.z - p2.z; float B2 = p2.x - p3.x; float C2 = A2 * p2.x + B2 * p2.z; float denominator = A1 * B2 - A2 * B1; if (Mathf.Approximately(denominator, 0)) { return false; } intersection = new Vector3((B2 * C1 - B1 * C2)/denominator,0f,(A1*C2 - A2*C1)/denominator); return true; } And my test data has:   if (Maths.LineSegementsIntersect(start,end, A.Position, B.Position, out intersectingPoint)) { Debug.Log(start+":"+end+" intersects "+A.Position+":"+B.Position+ " at: "+intersectingPoint); return true; } And my console gives me true for: This is clearly incorrect. Yet i get true and i have no idea why that is.
  10.   Oh so i test from the higher leaf downwards rather than the specific ones the area covers, that makes much more sense albeit slightly slower but it solves the issue! I'll work on it tomorrow! Thanks ! :)
  11.   Right, but then how do you search for such an object since as far as the search is concerned it doesn't find the object since its position is out of the boundary that i searched for. Either that or maybe my code is wrong ?
  12. Hi   I have a quad tree to make finding object collisions easier since my objects vary in sizes on my tiled map and the map is reasonably large. My problem is i think i might either have misunderstood quad trees, or, its not suitable for my needs.   So here is a visual demonstration of the issue i have: So the red square is some object in my quad tree, the blue dot represents its position.  The green shape is the area i am searching, since this is where i want to place my next object.  The problem is the area i search is just the green rectangle. And it won't detect the red object since it's position (the blue dot) is outside the range, even though visually we can see it is clearly colliding. But my quad tree search won't find any objects in the way and thus i  get no collision detection. So, am i misunderstanding how to use a quad tree, or am i using the wrong thing for what i am trying to do here?
  13. You are correct they only go 45 degrees. Beyond that is probably too complex for a level editor in a game and not much return in terms of visual results. I am not sure i understand the half tile suggestion, it seems that the sims (see the image in previous post) sub divided their main tiles to 4 smaller tiles, but even then the smaller tiles are still "shared" on a dividing wall.    I am curious about your first suggestion, namely how that kind of data would be setup in a Tile Class.   For example would it be something like: Tile Class¬          //cannot be null          Zone zoneA;          Zone zoneB = null // if not null which way is the wall going?          Vector2 position; But i would need to also find a good way to define which direction the wall travels - since there are four possible directions involved here. 
  14. @FrankEnCode, i never mentioned anything about corners? Not sure what you were meaning with your question there? :) @kylotan perhaps this image might help explain better:   So each zone, or lets say rooms, can have diagonal walls, but they also share the tiles underneath, since a wall separates two rooms.  And thats why i made the thread in the first place, because my current data setup does not really allow tile sharing per zone/room. So i need to change the way i have it setup, but i don't know how. Even if the tile does share 2 zones/rooms, how do i check the neighbours correctly so i know the wall between them travels say NW -> SE or NE->SW and so on for when the time comes to place the wall meshes.
  15. Hi   I have my data setup where by each zone is a collection of tiles, and so my walls separate each zone by the edges of the grids. So pseudo data setup i have: Class: Zone¬          List<Tile> tiles; Class: Tile¬          Vector2 gridPosition Zone zone; My problem is - for diagonal walls separating 2 zones, two different zones share the same tile, half each. Which kind of complicates how the setup works. If a tile can be part of both zones, I then can't tell what zone an NPC is in, since I check the zone the NPC is in via checking the tile's zone reference.   Plus if the zones do have a dividing diagonal wall, how do i represent which direction, whether the wall is SW to NE " // " or " \\ " NW to SE etc. I need some way to check this by checking it's neighbours.