Ghost Clock

  • Content count

  • Joined

  • Last visited

Community Reputation

130 Neutral

About Ghost Clock

  • Rank
  1. I need to remove these interior lines.

    Sorry for the late response, busy weekend. [quote name='luca-deltodesco' timestamp='1354499753' post='5006465'] a) Identify a point on the exterior of the line set. b) Walk around the exterior of the line set till you get back to start. This identifies all the lines required to define the exterior; and then ones that you can remove are all those not belonging to the exterior. [/quote] I thought about that while in bed but wasn't sure what the best way of doing that would be but I think I can work with what you've given me and have it working tonight. [quote name='Paradigm Shifter' timestamp='1354488872' post='5006425'] Yeah, I am assuming he has a triangulation of the lines rather than arbitrary polygons, or just a list of lines. [/quote] Correct, I should have mentioned this. The data is coming to me triangulated and is for multiple purposes, "identifying the exterior lines" for my purposes would be a better way of putting what I wanted to do moreso than "removing these interior lines".
  2. I hope this is the right section for this. Here's what I have, if this isn't sufficient info let me know. I have a basic line struct, made up of two Vector2 coordinates, Start and End. Here is a visual representation of lines making triangles and then making a rectangle. [url=""][/url] What I would like to do is remove the lines that are interior to the outer part of the shape. Now obviously I have all the data making up the lines and it would be trivial to do it manually, but I need a formula that can handle this for me for the sake of time consumption it would take. To be clear, what I'm considering exterior and interior; if the outward most points were N,S,E,W, I want the lines connecting N to E & W, S to E & W. The two interior triangles making the smaller square, all of that can go. And yes the end result would be eight Line structs, with two touching lines between N to E and etc.
  3. [XNA] Texture2D Crop

    [quote name='lwm' timestamp='1346173274' post='4974168'] Ha, I knew I shouldn't have used the Rectangle. [img][/img] I fixed the code in my previous post. [/quote] Dead on accurate. Thank you, this method will get plenty of usage.
  4. [XNA] Texture2D Crop

    [quote name='lwm' timestamp='1346164394' post='4974124'][/quote] First off, thank you. This is definitely a good start. Here's the issues. Trying your code directly in a new project (1 update call, crop, exit, save as), my first image in the first post results in this. [img][/img] This happens to be the most dramatic example so far. Other examples show me getting the bottom and right edges cut off 1 row too much. I'm going to look at the math and see if I can't pin this down, if anyone else would take a look I'd appreciate it too. Thanks again, I think this is really really close to what I need.
  5. I need some kind of formula to crop down a Texture2D. The textures are not loading as assets nor saved to jpeg or png at any point, they're created on the fly by the game. [img][/img] to [img][/img] Not all of the white needs to be removed, just minimized down until the black shape is touched by the edges. I'm thinking it would look something like (but not necessarily exact) Texture2D Crop(Color excess) { // Forumula for cropping return resultingTexture; } I was thinking maybe something with a Color[] but I couldn't think of way to make that work.
  6. Opinions: Overlap vs Gap

    [quote name='Servant of the Lord' timestamp='1343506541' post='4964082'] In my opinion, the gap would be better, unless you are pushing blocks and seeing the block move with a gap between the thing pushing it and the block being pushed.[/quote] That's a really good point to think about. Not the case as it happens but I'll keep that in mind if I end up reusing this code for such a mechanic. [quote]Why not say, "If A is inside B, set A's left edge to be equal to B's right edge"? [/quote] I don't have a good short answer to that and would struggle to explain it in detail. I get what you're saying though, I've used such a method before but it wouldn't be ideal to make work with my current collision check methods.
  7. Opinions: Overlap vs Gap

    I'd like to get some opinions on something that I'm pretty sure is just me being an overly picky perfectionist. I have a tank and a block that are in real world terms, "touching". My collision code (which is not going to be altered unless it can't be helped) is pretty accurate most of the time but some innaccuracy is inevitable (floating point values and all that). So with that, which would be better in the rare instance where the accuracy isn't perfect? Overlap: [img][/img] or Gap: [img][/img] Remember, in both of these pictures, the block and tank are touching, right next to each other. With the extra gap data added to the collision data of each object, there shouldn't ever be any overlap but there will also always be a gap between objects 99% of the time. Without the gap data added, overlapping will happen some times but most of the time it'll look dead on. Getting the gap data is also a bit of extra work where as getting the default data is all but automated. I'm not making a game about rubbing tanks up against walls, so I have doubts anyone will even notice but that little voice in the back of my head won't shut up until I get a few opinions on what others think would be preferable. Personally, they both bug me equally.
  8. XNA Spritebatch question(s)

    [quote name='wiz3kid' timestamp='1341244861' post='4954943'] (btw, you can apply a transform matrix in SpriteBatch.Begin(...) to offset your coordinates) [/quote] Which I have done and so this will be my second question; what are my options with the translation Matrix I provide to Spritebatch? Would it be possible to flip the Y coordinates upside down? Can this be done without reversing the X? Would I have to flip all my textures to accomidate? The issue is, my game is mainly 3D but for [s]debugging[/s]* and level editing, I use a combination of both 3D and 2D. I can manipulate my 3D data to account for the Spritebatch, it's nothing hard to figure out but if it's possible, I'd much rather manipulate the Spritebatch to account for how my 3D is already working. *I mean designing and tweaking the game with my debug build. Nothing related to the spritebatch code is part of the Release build, which is why I feel It'd be better to make it work like the rest of the game.
  9. My second question may be more important but what that is depends on the answers to my first questions. That is, why is Spritebatch set up so that when drawing, Vector2.Zero refers to the upper left corner instead of the center of the screen and why are positive Y coordinates below this origin instead of above? Having it set up this way isn't a big deal in itself but it doesn't seem consistant with the way XNA does anything else by default, such as mesh drawing and the 360 pad thumbstick vector2s.
  10. I'll start reading into scripting and see what's been done before me, I'm sure there are much better examples of how to do this better than my own flying blind attempts to do this from scratch.
  11. I hope this is in the right section and I apologize if it's not. I am not a programmer by any professional definition but I have gotten myself fairly comfortable with the basics of C# and XNA over the last couple years and have actually managed to make a few amateur games on my own that I'm actually fairly proud of, each with a few moments of coding that "hey, that might just be how a professional would do this!" Unforutanetly, with my latest project I've hit a bit of a stump and I'm having trouble not only figuring out the best way to do what I want but putting it into words that I can look up. So here's what I want to do in lousy English. I have a class, let's call it "Scene" and it has an Update method that gets called every frame through the Game class Update (XNA terminologies, if not other). In my previous games, this would just be handing over control of my PlayerCharacter instance to the player and act out any AI for any Enemies or Helpers. This game though I have stories and [i]acting or "cutscenes", [/i]I suppose, and I sometimes I need the game to play out these scenes before giving control back to the player. So as an example in English, at each Update call the following steps would be played out by performing a series of functions, checking if requirements are satisfied to end the step on this call and then move to the next step for the next Update call when finished. Step 1: Move player and another character to designated spots. Step 2: Active a talk scene or anything else. Step 3: Give default control to Player and AI. I have found finding any simple examples or tutorials of how to do this to be a harder task than I would have thought. [b]I have to admit now that while I am getting better, I have a hard time following the logic of larger projects that I didn't write myself. [/b]This doesn't seem like it should be such a complicated thing on the other hand, so I'm hoping I'm just not seeing the obvious. The two things I have tried thus far are not very eloquent. First, I thought switch statements with an Act int variable. As an example Case 1: { p1Character.Move(destination); if (p1Character.Position == destination) {Act = 2} break;}; Of course, this would get really messy if I put in all the logic into one class. So my idea was to have an abstract Scene class and derive from that classes that would each override the Update method with their own switch statements. This didn't seem like a very good solution either and would still become hard to manage with so many classes, each for just one scene. Doesn't seem like how it would be done on a professional level at all, I assume not. The next idea was to load instructions from a file. This way I would have just one scene class that could load a variety of custom content files. This would be nice as well because it would allow me or others to easily add content to the game even after its released. This seems like to way to go but the problem is I really don't know how to do this well either. My first attempt was creating a StageDirection class that could call a variety of different methods like .MoveCharacter() based on what a string says to do. When an instruction file would load, it would add a StageDirection to a list with each string in the file. Then my Scene.Update() would call each active StageDirection in the List. I fiddled around with this and it does work but once again I can see this becoming a real mess. Making the StageDirection class accepting so many different stated instructions feels like I'm making a whole new language just to talk to my computer language, which I have not even mastered. Maybe this is what will be necessary but after working on this for just a couple days, I realized I missed just writting switch statements. So here's what I need to know. Is there a better way to do what I'm wanting to do that has flown over my head? How do real games execute these kind of "cutscenes" inside an update loop? Are they typically coded into the executable like my inherited class idea or more like my instruction file idea? Neither? Is there a coding concept I'm just not familiar with at this level? Help me out if you can. Examples are good if there's a more simple answer, I typically work this kind of thing out with a console application and an infinite while loop to simulate an XNA update. If there isn't a simple answer, I could be pointed to some reading material. Thanks in advance.