Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Jan 2011
Offline Last Active Oct 02 2016 02:27 AM

#5093881 Start learning C# togheter with XNA?

Posted by on 13 September 2013 - 03:27 PM

Yes, C# is by many considered an easier language for beginners. But in my opinion you should make sure you understand the basic concepts of programming before jumping into XNA, otherwise it might be hard to grasp the XNA tutorials. Unfortunately I don't know any good C# tutorials, but a google search should bring up a dozen at least

When you feel ready to jump into XNA I recommend this site: http://www.riemers.net/ 

(and don't listen if anyone posts an "XNA is dead" comment, although it's no longer supported by Microsoft, it's still a great learning tool and can still be used to make games)

#5023496 Target bounce away from wall

Posted by on 20 January 2013 - 08:17 AM

If target.Velocity is a C# Property then you won't be able to modify its members, since a Point in C# is of the struct data type. What this means is that target.velocity returns a temporary copy of your data, so modifying that has little meaning. The solution is to either just make velocity public, without any get:ers and set:ers, or create a method that allow you to set velocity, like so


public void SetVelocity(int velX, int velY)
      velocity.X = velX;
      velocity.Y = velY;


Why are you using Points by the way? I would suggest using Vector2 for things like speed and velocity. It's better suited for that kind of stuff



Hope that helps smile.png

#5006288 Best language to start programming in?

Posted by on 02 December 2012 - 08:39 AM

C#, Java or Python. Do not go any deeper than that in the beginning. Both C and C++ has quirks that's too easy to run into, and both of those languages has a tendency to spit out cryptic error messages that might as well be some evil summoning spell for all a beginner knows.

Start out with an easy langauge to learn the basic concepts of programming, then if you realize that you'd rather sit and make your own lists and memory managers and what-not instead of making games, then you can try out C or C++

I want a language I can stay with so I don't have to keep switching around

Don't be afraid to switch programming language. It's something most programmers do alot ,and as others already have said: it's easy to make the transition once you have learned the basic concepts of programming. Last week, at my work, I had to switch between C#, C++ and lua....

#5005659 Does anyone else struggle with problem solving?

Posted by on 30 November 2012 - 05:39 AM

For example, the Tic Tac Toe game, I keep trying to do it the exact way that the other guy does it, and I get stuck, and constantly refer back to his code to see what I am doing wrong. Not to mention whenever I try doing it by myself, I constantly think about that persons code. So I can never try it myself.

Then forbid yourself from looking at anyone else's code until you've completed your own. It's just like playing a game. You can play with a strategy guide your first time through, but you're just cheating yourself out of the accomplishment. Finish it once yourself and then look at the guide to see what you missed.

^ This

When I was a beginner I did this too. I constantly looked at others code and thought "But this guy does it this way, isn't that a better solution..?" Well, maybe it is a better solution, but it's not your solution. As I realized that, I also realized how ugly my own code was, but it didn't matter, as long as I was the one who came up with the solution. The ugliness of the code goes away with practice. I'm not saying you shouldn't look at other peoples code, only that it's bad for your problem solving skills to do so.

#4986725 Handling a 2D procedural world

Posted by on 04 October 2012 - 05:27 AM

You can make enums be byte-sized by doing the following:

That's... brilliant. Why have I never seen this before Posted Image

When doing chunks, do you then Deserialize small amounts on the run? Or how is it handled?

Naah, the easiest way should be to load the whole chunk at once. Just make sure you don't use too large chunks and load them in the background to not freeze the game, then it should be fine Posted Image Streaming sometimes has a tendency to become a bit complicated if you're not careful though, so if you're just starting out you might want to keep it simple and, if possible, use areas instead, showing a loading screen as the player walks from one area to the next.

Good luck!

#4986210 Handling a 2D procedural world

Posted by on 02 October 2012 - 04:04 PM

I do not have an answer to all your questions, but I can say this: From my experience, serialization is quite terrible when it comes to file size. This is due to the fact that most data you serialize will need some header information so that it can be properly deserialized later. If you are concerned about file size, I would suggest that you write your own Serialize and Deserialize method for the tile class and simply use a BinaryReader/Writer to read/write the data you care about.

Seems odd to run out of memory on 305Mb... Something's wrong with the De/Serialization, but it's hard to tell what that may be. I usually get those types of crashes when I expect to read an array but read something else instead... but the serializer should make sure that doesn't happen (right..? Posted Image )

Chunks is indeed the way to go for such a large world, and having them in many small files should not be a problem at all. Then you can begin to stream new chunks directly from the files as the player gets close to them.

As for that last question: Properties makes no significant difference to the size of the class, so use them as much as you want. Posted Image

#4981273 C# List<T>.Find

Posted by on 18 September 2012 - 09:10 AM

Oops, sorry.. didn't know you had to have premium membership to do that :)

Anyway... Here's a random wild guess: what happens if you write it like this:
[source lang="csharp"]Predicate<EngineObject> pred = i => i.ID == objectId;EngineObject obj = objectList.Find( pred );[/source]
Is the errors still with the Find() function, or is it with the predicate?

This surely is weird.. My last advice is to create a new project, isolate your ObjectManager and EngineObject, copy those to the new project and try compiling. If it works, add stuff until it stops working. If it still doesn't work it should be small enough to post the code in code tags here.

#4980537 Confused about QuadTrees

Posted by on 15 September 2012 - 09:03 PM

Welcome to GameDev Posted Image

Now, I might not be too helpful since I'm very tired, and I hope someone else comes by and give you more detailed help, but I can say this: you don't subdivide a quadtree until the size of your nodes reach 0. A quadtree node could be seen as a bounding box that is able to store the objects you want the quadtree to store. There are many different implementations of quadtrees but usually, in a simple implementation you stop subdividing when you reach a set minimum node size (above 0).

If you subdivide each node into four children of equal size there should be no point inside the root node that doesn't have a node, and the only difference between the leaf nodes and the rest of the nodes is that the leaf has no children (again, I'm talking about the most basic implementation here...)

If you place an object in such a way that it is inside more than one leaf node, then you usually either split the object between the nodes or place it at a higher level. When inserting an object in the tree, you supply the position of the object, and the tree find out which leaf node contains that position (by going down through each level of the tree and checking the position against the bounds of each node) and insert the object there.

I *think* i should be seeing a circle in the center of each square since those are the positions I want to store (I guess), and i could make it so BUT my math would be off. I'd be drawing centers at half steps, ie, (4.5,4.5) or (7.5,7.5). Which sounds strange for some reason so I think I'm doing something wrong.

If your smallest node size is 1 and you store the middle position of the node, then you're right, you should see a circle in the center of each square, and that would mean you'd get positions like (0.5; 0.5) and (7.5 7.5). Right now the positions of those smallest circles seems strange to me (there's not even an equal number of circles as there is squares. This should be the case if each square equals one node)

Hope that helps at least a little Posted Image

#4980521 C++ Alternative to Unity?

Posted by on 15 September 2012 - 07:16 PM

C#, used by Unity, is a fully fledged OO language that has far more features than C++ and is therefore more complicated

Number of features of a language != how complicated said language is...

I personally find it a little peculiar that the OP says he hasn't done any work with a game engine, but still wants one "programmable in C++". If he hasn't done any work with a game engine before he should start by writing scripts for one, even if he himself might not be a beginner programmer. Otherwise, diving into the C++ code of the actual engine would feel more like drowning...

#4966640 Should I go with XNA or UDK for an Indie action game

Posted by on 06 August 2012 - 05:55 AM

. If I started using UDK and then applied for jobs wouldn't it seem odd for a programmer to be using a tool some other programmer developed, i.e. won't the HR people think, "if you can program while not just make your own engine?"

Rather the opposite: "Why did he make an engine, when all he wanted to do was a game?" Make games, not engines. Especially if you want to be a gameplay programmer Posted Image

With UDK I would pump out games faster, but I won't learn as much. Should I sacrifice knowledge for the sake of speed?

Wont't learn as much? In both cases you learn programming, and I would say that is a skill you can apply whatever engine/framework you choose to work with Posted Image

My general advice would be to focus on implementing interesting gameplay rather than writing engines. In that case, using existing tools or engines is far superior than spending alot of time writing your own.

Good luck!