Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

196 Neutral

About MrMark

  • Rank
  1. Hi guys I'm looking to buy a good, theory heavy, reference book on the fundamentals of computer graphics and the common algorithms used in 2D and 3D graphics programming. Any recommendations really appreciated.
  2. It works XD, Thanks for your help.
  3. Hi guys I've been spending an embarrassing amount of time on a fairly simple problem. In my 2D world each entity has an orientation (theta) which represents the direction it is facing. Given its current orientation and a target orientation, I want to find out: The change in theta required to achieve the target orientation, rotating clockwise. The change in theta required to acheive the target orientation, rotating counter clockwise. the closest I got was abs(current - target) for clockwise rotations, and -abs(current - target), for counter clockwise rotations. But that falls apart when you go past 0. This should be simple, but i can't seem to work it out. Please help
  4. Thanks for an awesomely detailed post haegarr. I was able to follow the maths (which is rare =P). Quick question, why are scene graphs deprecated ?
  5. Hi all I'm getting myself confused with rotations in 2D when rotating about a point about another point. I'm using a simple tree as my scene graph. Each node knows its position relative to its parent, and there is a root node that is the ancestor of all nodes. So when I move a node all of its children move with it. Rotations of a node about its parent are simple. But how do I rotate a node about another node ? What I could find on the internet talks about translating the origin to the node being rotated around, rotating it, then translating back. So based on that, I came up with: From the node to be rotated walk up the tree to the root node building a translation matrix (1) From the origin node walk up the tree to the root node building a translation matrix (2) inverse the origin node's translation (2) matrix Form the origin translation matrix by multiplying matrix (1) by matrix (2), forming matrix (3) Multiply the node to be rotated by matrix (3). It's now a vector relative to the rotation origin apply rotation matrix multiply the node by the inverse of matrix (3), its now a vector relative to its parent again. But that seems somewhat over complicated, which makes me think I'm either doing it wrong, or have found a convoluted way of doing something simple. Any help greatly appreciated.
  6. MrMark

    Java or C++?

    Personally I'd stick with the language you know Java and learn how to program games without getting tripped up by all of C++'s gotchas. A 5 second google came up with which looks like a fairly full featured game engine. Good C++ code might be faster, but great art makes a game look good; without an AAA budget for an army of artists the speed benefits of C++ become academic. Another option is learning the scripting language built into a game engine. Like the unreal engine:
  7. Hi guys Working on a game engine in 2d C# and currently working on the animation and entity classes. An entity has a set of animations can play and I'm tossing up between using enums or using strings as the key, ie Entity player = new Entity();"playerWalk") vs Entity player = new Entity();; the latter would ensure at compile time that the call to play always contains a valid animation, while the former is far simpler to implement. Using the later, each different entity type would need its own enum, but that's not too bad as I can easily parse my sprite's xml metadata and add a bit of code generation as a pre compile step. I'm leaning towards the enum approach as it would eliminate one potential source of fauilts at run-time, but I feel like i'm abusing the concept of an enum, so other peoples opinions would be welcome. Here's my code if it helps visualise things Entity class: public class Entity { private Dictionary<int, Animation> AnimationSet; public Enum Animations; public Entity(Enum animations) { AnimationSet = new Dictionary<int,Animation>(); Animations = animations; } public void AddAnimation(Enum id, Animation a ) { if (id.GetType() == Animations.GetType()) { int idint = Convert.ToInt32(id); AnimationSet.Add(idint, a); } else { throw new ArgumentException(String.Format("Incorrect Enum used, this entity uses '{0}' but passed in ' {1}'", Animations.GetType(), id.GetType())); } } Here's my unit tests - Shows the class in practice. [Test] public void EntityConstruct() { Entity myPC = new Entity(new PlayerAnimations()); myPC.AddAnimation(PlayerAnimations.die, new Animation("afd", null, 1, 1, 1, 1, 1, 1, 1)); } [Test] public void EntityConstructFail() { Entity myPC = new Entity(new PlayerAnimations()); Assert.Throws(typeof(ArgumentException), delegate() { myPC.AddAnimation(TankAnimations.die, new Animation("afd", null, 1, 1, 1, 1, 1, 1, 1)); }); } enum PlayerAnimations { walk, run, die } // auto generated enum TankAnimations { roll, shoot, die } // auto generated
  8. Thanks for your reply The server needs to spinup each game instance as required. When players first connect they are given a list of games to pick from, they select one and if there isn't a game already waiting for players the server creates a new instance of that game and adds that player to it. When a second player comes along that also wants to play that game he is added the existing game instance, and the game begins. The game instances don't know or care they are on a server, all they need to do is respond to events such piece X to position Y, ensuring the rules of the game are followed. If each game instance was its own server, each instance would need its own port and have much more overhead. Hope that makes more sense.
  9. Hi guys I'm writing a multi-player server for web based flash games. Each game instance has 2-4 players, and each instance is completely independent of other instances. Different game types (ie chess and poker) can be run on the same server. Server uses a worker thread pool that uses application instances for locking; ie only one worker thread may access an instance at a time. In one project I have the server code that handles networking, scheduling, all the common low level stuff a game instance needs. It provides an abstract Application class that provides the interface* to the low level stuff that I want each different game type to inherent. *declared abstract application, not interface application as I wanted to put in some utility functions in there. This works fine if each game lives in the same project as the server, but when I tried to refactor a game out into its own separate project I run into circular dependencies, since: Server needs to be able to construct instances of a particular game type. Each game type needs to be able to inherent Application. I've been doing some googling, and it seems the 'standard' solution involves creating a third project that has an interface that both projects use...but that seems kinda hacky to that really the best way to do what I'm trying to do ? Like if this was C++ I'd just make each game instance a static lib and link it in. Inversion of Control also comes up alot, but it seems very overcomplicated for what I'm trying to do. I don't need to be able to swap out server implementations, I just want each different game to live in its own project. Thanks for any help, Hope I gave enough detail.
  10. Quote:Original post by ernow #include in C++ is merely using the same header file in several projects To do the same in C# you place the file in one project and add the file to the other project by clicking the down-arrow on the Add button in the Add existing item dialog and choosing Link... That said: you might pick one of the two routes when using Silverlight and a (WCF?) service: 1. Perhaps Silverlight RIA Services might do this job for you or 2. Put the POCOs in a separate dll and refer to the dll in both projects An other consideration: if you are sharing a lot of code across client and service your design might be wrong... Thanks, adding as a link worked. You're right about code reuse being a sign of things going wrong. But in this case I'm sharing things my custom network protocol class (takes in raw data off the line and generates the proper internal messages), which needs to be in both projects.
  11. I'm developing a server that talks to a Silverlight client written in C#. The server and the client are separate projects, but I want to be able to share code between them. I've created a shared project, put all 3 projects in the same namespace, and added a reference to shared in both the client and server projects. But if I move a bunch of classes that were originally in the server project and try to access them in the server project it complains about 'ClassX is inaccessible due to its protection level'. Now I can resolve this by making ClassX a public class, but that means I have to expose all of its internals, which isnt something i want to do. Shared itself compiles fine, and if I place all those files back into the server project everything compiles and runs fine. I'm trying to achieve the same effect as #include in C++, and as all classes are in the same namespace I don't see why this isn't working. Am I approaching this the wrong way ? All I'm trying to do is make a bunch of utility classes accessible between two projects without copy and pasting them.
  12. Okay thanks, I skipped over that bit as i wasn't interested in addition. So it looks like its a odd design feature of .net maybe to subtly push you towards using int to avoid over/underflow bugs. But it still doesn't make sense for bitwise or. byte | byte is always going to be another byte. So why would the | operator return a int ??? or to put it another way: int operator | (byte a, byte b) {...} vs byte operator | (byte a, byte b) {...} Anyone know why its way it is ? It's not a biggy, but it's odd and annoying.
  13. Hey guys I'm confused as to whats going on here. Byte a = 1; Byte b = 2; a = a | b; // compiler error, Cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?) adding a type cast fixes it fine: a = (byte)(a | b); However in the documentation: "There is a predefined implicit conversion from byte to short, ushort, int, uint, long, ulong, float, double, or decimal." So it should be doing the type cast automagically. BUT the bigger question is why would bitwise OR between two bytes return anything other than a byte ???
  14. I'm in the process of adding exception handlers to my existing codebase. When I mouseover the names of function calls it tells me the names of any exceptions that may arise, but doing that gets annoying after a while. Is there a way to tell the compiler to warn me about unhanded exceptions, or should I just be wrapping whole methods in try/catch blocks and deal with things that way. Using visual studio 2010 & .net 4
  15. MrMark

    Graphics Cards for GNU/Linux

    We are sliding off topic, but what the hey. One thing I've always been curious about is the push to make only software, not hardware 'free and open source'. Why not hardware too ? You could build your own computer completely from scratch, optimize it for the task at hand, and learn how your system operates right down to the circuity - hardware raid controllers are far superior to software raid.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!