Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Doh004
Apr 22, 2007

Mmmmm Donuts...
How viable is C# for game development? I imagine XNA plays a big part in this. I just started a full time job where I develop C# and Silverlight stuff, so I'd hope I get good enough at this stuff to be able to make games with it.

(Awesome, new page with a stupid question)

Adbot
ADBOT LOVES YOU

Physical
Sep 26, 2007

by T. Finninho
C# is very viable. XNA is great but also you can do vid card stuff like you could with directX (I think) without having to worry about stupid memory management.

more falafel please
Feb 26, 2005

forums poster

Doh004 posted:

How viable is C# for game development? I imagine XNA plays a big part in this. I just started a full time job where I develop C# and Silverlight stuff, so I'd hope I get good enough at this stuff to be able to make games with it.

(Awesome, new page with a stupid question)

It's perfectly viable, XNA is pretty powerful. It's also pretty easy to get up and running, especially for 2D stuff.

Gerblyn
Apr 4, 2007

"TO BATTLE!"
Fun Shoe

roomforthetuna posted:

That's a good point and a question I probably should have gone with first - is there a system that's not overly complicated that's significantly better than octrees for my particular purpose? What I have is a 3D space into which many immobile convex shapes are added (rarely removed, but more added on-the-fly) and a small number of moving objects that can collide with the immobile shapes. For moving object to moving object collision I'm just going to do a flat "all against all" comparison because there won't be more than 16 of those. Some (many?) of the immobile shapes will be long and thin, which may not suit octrees very well.

There's a modification you can make to the octree algorithm to alleviate the problem:

1) Only ever add objects to the leaves of the tree, never to the other nodes.
2) In situations where objects cross node/leaf boundaries, add your object to multiple leaves.
3) Each object needs to have a "Checked" flag that's initialized to false
4) When scanning the tree, set the Checked flag of objects to true as you do tests with them, if the flag is already set to true, then don't retest the object
5) As you scan, maintain a list of all objects that have been checked. When the scan ends, go through the list and set the flags back to false for the next scan.

You'll avoid a lot of unnecessary checks for borderline objects, in exchange for the cost of maintaining/clearing all the checked flags.

I have to admit, I've never actually tried this, it was just an idea I had when I was working on a similar problem once. I'm pretty sure it'll work, though if you have very few border line objects I'd imagine it would be slightly slower than a regular octree.

Also, depending on how many things you have in your octree, it may not actually be as much of a problem as you imagine. If it really is "some" (i.e. 10-20%) of the objects that don't make it as far as the leaves, it probably won't be too bad, especially if you put AABBs around your convex hulls for a pre-test before doing the more complex checks.

Gerblyn fucked around with this message at 22:41 on Aug 15, 2011

Randel Candygram
Jun 21, 2008

College Slice

Doh004 posted:

How viable is C# for game development? I imagine XNA plays a big part in this. I just started a full time job where I develop C# and Silverlight stuff, so I'd hope I get good enough at this stuff to be able to make games with it.

(Awesome, new page with a stupid question)

Very viable.

XNA by itself is fantastic, but there are also a bunch of higher-level engines. Unity in particular is great. I'm doing some pretty processor intensive stuff on the Xbox 360 with it right now, and it's been just criminally easy getting it up and running. The performance is good, too.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Gerblyn posted:

There's a modification you can make to the octree algorithm to alleviate the problem:

1) Only ever add objects to the leaves of the tree, never to the nodes.
2) In situations where objects cross node/leaf boundaries, add your object to multiple leaves.
Yeah, that's approximately what I did in another game where I was mostly checking point collisions against things - that way I'd only ever need to check in one leaf. Of course at that point there's not much point in it being a tree at all, it might as well just be a grid of nothing but 'leaves' (which is what I did).

quote:

Also, depending on how many things you have in your octree, it may not actually be as much of a problem as you imagine. If it really is "some" (i.e. 10-20%) of the objects that don't make it as far as the leaves, it probably won't be too bad, especially if you put AABBs around your convex hulls for a pre-test before doing the more complex checks.
And yeah, I wasn't really imagining it was going to be a particularly huge problem, just wanted to check that there wasn't something vastly better that I should be using - I thought there might be something because of the "mostly immobile objects" thing. I should just not worry about it because I'm sure an octree will perform just fine - with only <16 moving objects being checked, and the checks being very primitive (basically line segment distance to another line segment) I could probably even just about get away with always checking against everything. It's only the fact that the number of immobile objects can get almost arbitrarily large that makes me concerned enough to octree it.

But even so it'd still only be 16*n, not the usual n*n that makes optimization really important.

roomforthetuna fucked around with this message at 22:33 on Aug 15, 2011

Gerblyn
Apr 4, 2007

"TO BATTLE!"
Fun Shoe
Well, the octree still helps you to quickly identify which sections in the grid you need to look in, but with a lot of applications I guess you may be right.

I think in your situation, I would go for a vanilla octree regardless. It's pretty much guaranteed to be faster than a brute-force-everything approach, and will give you a bit of peace of mind if you suddenly start wondering what would happen if you dropped 5,000 extra collision blocks into the world.

ambushsabre
Sep 1, 2009

It's...it's not shutting down!

This Post Sucks posted:

I'm an Actionscript coder but have mostly only done Flex apps and the like. I've done very little work in Flash itself. What would be the best route to start in to game development?

I've looked in to Flixel and it seemed pretty straight forward and it works with straight AS3 and had good documentation to get started with? Is it a good choice to look in to?

Flixel owns, but the flash IDE sucks for it so either use Flexbuilder (very not free) or FlashDevelop (very free). It's very easy to get started with, even if you're a non-coder (which you aren't). It's the same thing Stencyl uses, but I vastly prefer to work in FlashDevelop then with Stencyl.

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

roomforthetuna posted:

I could probably even just about get away with always checking against everything. It's only the fact that the number of immobile objects can get almost arbitrarily large that makes me concerned enough to octree it.

If you don't know that you'll need an octree or some other fancy structure, I'd suggest just coming up with some generic collision system interface and implementing the code behind the interface using the simplest possible thing you can think of. If you find that the simple solution isn't fast enough you can re-work it without affecting the rest of your code so long as the interface stays the same.

Off the top of my head the interface might include AddObject, RemoveObject, RemoveAllObjects and CheckCollision methods. Start the implementation with a simple list of stuff the mobile parts can collide into and if that's not fast enough then start looking at octrees or whatever.

You might be overthinking a problem that doesn't exist, and I can sympathize with that because I do it too. I've found that the 'just design the interface for now' trick along with some kind of on-screen performance monitor is usually enough to quiet my inner sperg and keep me from wasting days searching for the magical perfect algorithm that will cut my CPU usage from 3.54% down to 3.50%. :)

Doh004 posted:

How viable is C# for game development? I imagine XNA plays a big part in this. I just started a full time job where I develop C# and Silverlight stuff, so I'd hope I get good enough at this stuff to be able to make games with it.

(Awesome, new page with a stupid question)

C# works very well for games, and as others have mentioned XNA is a pretty nice system to work with too. If for whatever reason XNA isn't your cup of tea you can also use SlimDX to talk directly to DirectX.

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

roomforthetuna posted:

That's a good point and a question I probably should have gone with first - is there a system that's not overly complicated that's significantly better than octrees for my particular purpose? What I have is a 3D space into which many immobile convex shapes are added (rarely removed, but more added on-the-fly) and a small number of moving objects that can collide with the immobile shapes. For moving object to moving object collision I'm just going to do a flat "all against all" comparison because there won't be more than 16 of those. Some (many?) of the immobile shapes will be long and thin, which may not suit octrees very well.

Bounding Volume Hierarchy -- think of it like an octree (or a KD tree) where you arbitrarily choose which dimension to split on and where to place the partition based on what's in the parent node.

This Post Sucks
Dec 27, 2004

It Gave Me Splinters!

ambushsabre posted:

Flixel owns, but the flash IDE sucks for it so either use Flexbuilder (very not free) or FlashDevelop (very free). It's very easy to get started with, even if you're a non-coder (which you aren't). It's the same thing Stencyl uses, but I vastly prefer to work in FlashDevelop then with Stencyl.

Cool, good to know.

I've got a copy of Flash Builder 4.5 (what Flex Builder is called now), so I've got a nice IDE to work in.

Working through some docs and examples now!

Edit: Oh, hey, I guess this would be as good as place as any to post this, and it may be helpful to some folks in here.

Stanford University is offering a free Artificial Intelligence class online. You can sign up here: http://www.ai-class.com/

It's actually what got me to start thinking about game development again.

This Post Sucks fucked around with this message at 23:57 on Aug 15, 2011

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

PDP-1 posted:

Off the top of my head the interface might include AddObject, RemoveObject, RemoveAllObjects and CheckCollision methods. Start the implementation with a simple list of stuff the mobile parts can collide into and if that's not fast enough then start looking at octrees or whatever.
What I've done is knocked together a simple octree template, which simply implements insert (given an object and its bounding box) and search (given a bounding box) - the search template forms its own distinct object that then implements 'next', which returns the next object in the list that needs checking. So individual collision checks aren't even linked to the octree at all, it basically works like an iterator through the contents of all the octree cells that overlap with the bounding box. (I got tired of trying to figure out how to make it an actual iterator, and figured I only wanted the one behaviour out of it anyway.)

So if I wanted to change it from an octree now it would be pretty simple to switch that out for a different structure (other than the whole "implementing a different structure" part). Would probably be even easier to switch out if it was an actual iterator.

quote:

You might be overthinking a problem that doesn't exist, and I can sympathize with that because I do it too. I've found that the 'just design the interface for now' trick along with some kind of on-screen performance monitor is usually enough to quiet my inner sperg and keep me from wasting days searching for the magical perfect algorithm that will cut my CPU usage from 3.54% down to 3.50%. :)
Yeah, I kind of had a mix of "don't want to waste time implementing a thing that isn't what I end up using" and "don't want to implement *nothing* as optimization", but it turned out that an octree is so incredibly loving simple if you break it out into a template like that rather than trying to fully tie it into the game's interactions/physics. Less than 5K of code. So it would have been quicker to just do that than to spend time thinking about it!

The Saddest Robot
Apr 17, 2007
The main drawback with C# for game development is that you can't count on your source code being secure. It's pretty easy (much more so than other languages) to reverse-compile the files. There's some obfuscators but that just makes it a tiny bit more involved.

If that doesn't bother you too much it's a great language.

The Fool
Oct 16, 2003


The Saddest Robot posted:

The main drawback with C# for game development is that you can't count on your source code being secure. It's pretty easy (much more so than other languages) to reverse-compile the files. There's some obfuscators but that just makes it a tiny bit more involved.

If that doesn't bother you too much it's a great language.


Isn't that also an issue with java? And any other language that uses "virtualized" machine code?

(i'm not 100% certain i'm using the correct words, or even understanding the technology)

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice

The Fool posted:

Isn't that also an issue with java? And any other language that uses "virtualized" machine code?

(i'm not 100% certain i'm using the correct words, or even understanding the technology)

You are correct.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
It's also probably not a major issue for anyone looking to get into hobby game development. I think as developers we have too much fear over people stealing our ideas or code. Look at Notch and Minecraft -- Java application, somewhat obfuscated. People get into the code, and generally use that to build mods and suggest improvements.

Wolfsbane
Jul 29, 2009

What time is it, Eccles?

Yep. Like piracy, it's one of those problems that are nice to have. If people care about your game to try reverse engineering it then congratulations, you've already won.

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Wolfsbane posted:

Yep. Like piracy, it's one of those problems that are nice to have. If people care about your game to try reverse engineering it then congratulations, you've already won.
Unless it's a server based game where cheating might be an issue. Well, it's still nice to reach that point, but it's also nice to have thought about it beforehand and made it not cause horrible problems.

Paniolo
Oct 9, 2007

Heads will roll.

The Saddest Robot posted:

The main drawback with C# for game development is that you can't count on your source code being secure. It's pretty easy (much more so than other languages) to reverse-compile the files. There's some obfuscators but that just makes it a tiny bit more involved.

If that doesn't bother you too much it's a great language.

That isn't even close to the main issue with C# for game development. Lack of platform support, no fine control over memory management, lack of middleware, frame rate stuttering during garbage collection - those are real issues. Nobody cares about reverse engineering except for maybe the drm module.

Unormal
Nov 16, 2004

Mod sass? This evening?! But the cakes aren't ready! THE CAKES!
Fun Shoe

Paniolo posted:

That isn't even close to the main issue with C# for game development. Lack of platform support, no fine control over memory management, lack of middleware, frame rate stuttering during garbage collection - those are real issues. Nobody cares about reverse engineering except for maybe the drm module.

As long as you know what the garbage collector is doing, or want to learn a bit of interop (which is easy), you can easily do whatever you want with memory in areas that have problems if garbage collection is used naively, by allocating object pools and managing those yourself, or just using windows memory allocation via interop. Both are far easier than managing C++ memory. It's certainly no more work than managing memory with C++, and profoundly less error prone.

Platform support is a true issue, however.

If you're happy with windows only (and maybe mono if you do some work), C# is a really excellent language, and for a skilled programmer can be multiples more productive than writing the exact same code in C++. Far less time is spent writing infrastructure and running down crashes, and can instead be spent writing actual game code.

Many pieces of middleware now have C# interop layers, or have DLLs that you can interop with yourself, however your selection is more limited than if you use C++. I'm not a professional game developer, though, so my experience with game middleware is limited.

Unormal fucked around with this message at 05:06 on Aug 17, 2011

Paniolo
Oct 9, 2007

Heads will roll.
Oh, I'd agree that C# is perfectly viable for basically anyone posting in this thread. The issues I listed are more reasons why C# hasn't taken off for AAA game development especially on consoles.

I could be wrong but I believe C# is actually an option for XBLA games (not XBLIG where it is mandatory) but most are still written in C++ for some of the reasons I mentioned.

Paniolo fucked around with this message at 06:07 on Aug 17, 2011

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Pfhreak posted:

It's also probably not a major issue for anyone looking to get into hobby game development. I think as developers we have too much fear over people stealing our ideas or code. Look at Notch and Minecraft -- Java application, somewhat obfuscated. People get into the code, and generally use that to build mods and suggest improvements.
Anyone worried about people STEALING code is out of their mind. Ask the obvious question: What is the worst they could do with it that wouldn't get them in trouble for copyright violation?


There are really only two threats from easily-reversible source code: Multiplayer hacks and piracy.

Physical
Sep 26, 2007

by T. Finninho

Paniolo posted:

Oh, I'd agree that C# is perfectly viable for basically anyone posting in this thread. The issues I listed are more reasons why C# hasn't taken off for AAA game development especially on consoles.

I could be wrong but I believe C# is actually an option for XBLA games (not XBLIG where it is mandatory) but most are still written in C++ for some of the reasons I mentioned.
To add to this, from what I read XBLA is like the "Big Time" market. You have to have the XBox SDK and they don't hand that out to just anyone. I read this article about a guy who was a professor at a university who wanted it but they wouldn't release it to him. I also read Microsoft's "Mission Statement" and they say that it is a portfolio they are building and they want high quality downloadable games on there. So established companies and and games (like Q3 Arena) can get on XBLA but not my game written in C#. An interesting case would be Minecraft. Minecraft 2 years ago wouldn't have gotten the SDK but now I think they could (and have probably).

Basically Microsoft don't wanna gently caress around with anyone who isn't going to sell thousands of units. XBLA is for serious poo poo.

Gerblyn
Apr 4, 2007

"TO BATTLE!"
Fun Shoe
I haven't really looked into it, but I thought XBLA had an indy section where it was fairly easy to publish games?

Sephiroth_IRA
Mar 31, 2010
Newbie question: :tinfoil:

I'm going through "Starting out with C++" (2004 Edition, was cheap on amazon) so far I understand everything I've learned without a mild amount of effort. I'm currently at the first chapter on arrays (past functions/loops) but I have one concern.

I usually look over the code before I attempt to copy/compile it and try to understand how it works. This gets a bit tricky with loops and it takes some effort (sometimes a few diagrams) to understand the flow. I'm wondering if there comes a point where it becomes second nature to understand the flow of a loop. Will it eventually become second nature to come up with the logic to code my own loops when I start making my own programs?


Also, I've found arrays to be the most interesting chapter I've encountered so far. I remembered that the graphics within an NES game were just 8 x 8 blocks or arrays of color. I'm assuming that a game with such hardware limitations would have to recycle a few arrays (if you consider hundreds a few) all the time. Am I on the right track with that assumption? If so do modern (ex: Mega Man 9/10) 2D games still do that? Or would they simply load the graphics from a file?

Sephiroth_IRA fucked around with this message at 17:54 on Aug 17, 2011

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Orange Lazarus: Loops are only the beginning, but yes, in time they will become second nature. I recommend reading This.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

Gerblyn posted:

I haven't really looked into it, but I thought XBLA had an indy section where it was fairly easy to publish games?
That's what they were talking about previously - Xbox Indie, which requires all games to use C#/XNA.

By contrast, you really don't want to use C#/XNA for XBLA, though I believe there are a few games that have done so. If your target is XBLA as an indie, you're better off either doing C/C++ or picking an engine with a known portability vector to Xbox 360 (like UE3/UDK, etc).

Gerblyn
Apr 4, 2007

"TO BATTLE!"
Fun Shoe
Ah, sorry. I skipped half the conversation.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Shalinor posted:

By contrast, you really don't want to use C#/XNA for XBLA, though I believe there are a few games that have done so. If your target is XBLA as an indie, you're better off either doing C/C++ or picking an engine with a known portability vector to Xbox 360 (like UE3/UDK, etc).
I keep thinking that there has to be a market for a low-cost engine bolt-on for XNA. I'd be all over making one if I wasn't busy with a C++ project that is of course completely unportable to it.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

OneEightHundred posted:

I keep thinking that there has to be a market for a low-cost engine bolt-on for XNA. I'd be all over making one if I wasn't busy with a C++ project that is of course completely unportable to it.
I don't know - I'm kind of thinking that stuff like the Flixel support for XNA/Xbox Indie is really the right way to go, there.

Paniolo
Oct 9, 2007

Heads will roll.

OneEightHundred posted:

I keep thinking that there has to be a market for a low-cost engine bolt-on for XNA. I'd be all over making one if I wasn't busy with a C++ project that is of course completely unportable to it.

I'm waiting for a killer Javascript engine to come out that can run either in a web browser or in a specialized native environment on a mobile or console, with a completely unified interface. I've already seen something similar that can run on iOS and Android, but the first company who can produce a killer engine with great documentation and tools which runs on any conceivable platform is going to be in a great position.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Paniolo posted:

I'm waiting for a killer Javascript engine to come out that can run either in a web browser or in a specialized native environment on a mobile or console, with a completely unified interface. I've already seen something similar that can run on iOS and Android, but the first company who can produce a killer engine with great documentation and tools which runs on any conceivable platform is going to be in a great position.

Unity is pretty close, isn't it?

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Paniolo posted:

I'm waiting for a killer Javascript engine to come out that can run either in a web browser or in a specialized native environment on a mobile or console, with a completely unified interface. I've already seen something similar that can run on iOS and Android, but the first company who can produce a killer engine with great documentation and tools which runs on any conceivable platform is going to be in a great position.
I think there are still practical issues, mainly with input and sound.

Shalinor posted:

I don't know - I'm kind of thinking that stuff like the Flixel support for XNA/Xbox Indie is really the right way to go, there.
Well, I mean if you wanted to scale XNA up to the quality of game on XBLA there really isn't anything about XNA that's stopping you. It has a very high capability ceiling. What stops anyone is the lack of a good platform for it, i.e. a decent asset pipeline, physics boilerplate, etc.

xopods
Oct 26, 2010

Orange_Lazarus posted:

Also, I've found arrays to be the most interesting chapter I've encountered so far. I remembered that the graphics within an NES game were just 8 x 8 blocks or arrays of color. I'm assuming that a game with such hardware limitations would have to recycle a few arrays (if you consider hundreds a few) all the time. Am I on the right track with that assumption? If so do modern (ex: Mega Man 9/10) 2D games still do that? Or would they simply load the graphics from a file?

You'll be using graphics libraries for that kind of stuff, rather than creating your own data structures. At the lowest level, bitmap data is still always going to be held in some kind of (possibly compressed/encoded) array-like format, but you're going to be accessing it through functions that do things like loading an image from a file, or copying pixels from a specified rectangle in a source image and putting them into another image at a specified point. You're not going to be manually setting the color of every god drat pixel individually, if that's what you're worried about (though you certainly can set the color of individual pixels if that's what you want to do).

more falafel please
Feb 26, 2005

forums poster

OneEightHundred posted:

I think there are still practical issues, mainly with input and sound.

Well, I mean if you wanted to scale XNA up to the quality of game on XBLA there really isn't anything about XNA that's stopping you. It has a very high capability ceiling. What stops anyone is the lack of a good platform for it, i.e. a decent asset pipeline, physics boilerplate, etc.

The asset pipeline does leave a lot to be desired, but for physics, BEPU isn't bad.

ShinAli
May 2, 2003

The Kid better watch his step.

OneEightHundred posted:

Well, I mean if you wanted to scale XNA up to the quality of game on XBLA there really isn't anything about XNA that's stopping you.

A big source of inspiration would be Bastion, which I've recently found out from the PC demo that it uses XNA/.NET. I didn't expect that but it makes sense given their rapid development time from just two programmers.

The Fool
Oct 16, 2003


ShinAli posted:

A big source of inspiration would be Bastion, which I've recently found out from the PC demo that it uses XNA/.NET. I didn't expect that but it makes sense given their rapid development time from just two programmers.


You mean 7 people over two years?
http://supergiantgames.com/?page_id=2

However, the use of XNA is pretty incredible, also, it's apparently all 2d and painted. Gorgeous looking game.


Edit: re-reading your post, I realize that you're not implying that the entire team is 2 people, just that there are two programmers, sorry

The Fool fucked around with this message at 18:11 on Aug 20, 2011

Hughlander
May 11, 2005

The Fool posted:

You mean 7 people over two years?
http://supergiantgames.com/?page_id=2

However, the use of XNA is pretty incredible, also, it's apparently all 2d and painted. Gorgeous looking game.

Of which two are listed as engineers.

Doh004
Apr 22, 2007

Mmmmm Donuts...
I have another potentially stupid question: How is Silverlight for game development?

Adbot
ADBOT LOVES YOU

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Doh004 posted:

I have another potentially stupid question: How is Silverlight for game development?
There aren't very many compelling reasons to use it instead of Flash at the moment.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply