Dev Diary 008: 3D Buzz Rocks

Matt Barton's picture

Just a quick update, mostly to put to rest concerns that I've given up. First off, I have to thank TripHamer for pointing me to a series of videos on Unity called 3D Buzz. My initial impression of the site wasn't good; there are a LOT of videos there; so much, in fact, that it's easy simply to get overwhelmed and leave immediately. Eventually, though, I took the time to explore the site a bit, and found a series there called creating a simple 2D shooter in Unity with C#. I figured that project didn't sound too bad, and if I couldn't even figure out how to create a 2D shooter in Unity (something I can do in my sleep with Gamemaker), I was out of my league.

Fortunately, this video series has been terrific, not just for providing good information but also for restoring my confidence. The hosts have a great chemistry and are very clear about what they're doing and why. I've been watching them slowly, maybe one or two per day, and taking copious notes, which I review before and after the sessions. I haven't tried to apply it yet (I'm going to wait until I finish the series to get in and try to create my own simple shooter), but I have to say I'm not sure my resolve will hold out--I'm itching to get back into it.

At first I was concerned about the C#; I had made up my mind earlier that Javascript would be an easier way to go and C# would be an unnecessary complication. After seeing the code in these videos though, I think that was unfounded. At least from what I've seen so far, it's not more difficult at all, though there are a few extra things to remember. I have some experience with C and C++, so a lot of it is familiar (if still poorly understood), but I haven't seen any direct references to the all-mighty classes, pointers, and references that still make me dizzy. Now that I'm thinking about it, though, I realize that I've really been working with a lot of this stuff all along in Gamemaker, though there it's called "ID." In fact, as I get more familiar with Unity, I see that a lot of stuff overlaps or is almost identical, though it seems Unity requires a lot more "real" scripting to get anything done--Gamemaker, of course, has plenty of drag'n drop coding tools.

These guys didn't talk much about why they preferred C# over JS, but they do use Microsoft Visual Studio for their coding--seems like a great practice to me. I have Express on my machine (it's free), so I'm going to try the same thing once I get into it. I might even see if I can find a good book on C# just to refresh my memory and see how and where it differs from C and C++. I doubt I'll need anything too sophisticated, but I'd at least like to be clear on the fundamentals. IIRC, C# has automatic "garbage collection" and a few other things to make scripts less prone to crashing a system. You guys with more familiarity--what's your view?

I'm up to the video about creating the projectile, and so far have understood everything they've done. I hope that this will continue as we go on.

One thing that's curious is the "has trigger" function on the colliders. They say that you only need one object involved in a collision to have a rigidbody. I'm sure they'll explain this later on, but I'm not clear on why you need a rigidbody component for a collision since you already have a collider. In my (naive) view, a collider component should be able to tell when it's colliding with something else, right? If not, why is it called a collider? Come to think of it, why would you even need a "rigidbody" if you don't want to use the physics? (They turned off kinematics on their bullet so they could control its movement with their own functions).

I hope they cover this, but if anybody here can explain to me the difference between a "collider" component and a "rigidbody" component, and why you apparently need both to do a collision, please fill me in.

Comments

Jacob (not verified)
rigidbody and a collider

This is just a guess, but I'm thinking you need a rigidbody to tell if the component you've hit with the collider is a valid target. i.e. instead of stuffing the collider with information of everything it can interact with so it can pass through things like, I dunno, vapor or something, you tell the collider to wait until it hits something with a rigidbody.

gilgamesh (not verified)
C# and JavaScript depend by

C# and JavaScript depend by and large on the same concepts. Both have garbage collection, both have C-like syntax and both are object oriented for example.

Some things are solved differently, but which one you prefer is a matter of taste really.
C# is more explicit. You will have to type a bit more. That can be either helpful or tedious, according to your preferences and the problem at hand.

Have you ever used Java? C# is a lot like Java.

Hammer
Offline
Joined: 03/23/2008
C# is a Microsoft technology

But more importantly, C and C++ run directly on the machine and allow direct access to memory. C# runs in a virtual machine under the .NET framework. Therefore the framework can take care of some things for you such as garbage collection.

Ruthaniel (not verified)
Im on tablet in the train, so

Im on tablet in the train, so I need to be short in my expressions. C# is better for you because VS is simply best IDE. C++ is very tough for beginers, but still supported by VS. C# isnt used for games because is slower than C++, but its now changing, tools no need to be quick, we have enough horsepower and coding in C# is regarding my info 4 or 5 more effective. Documentation is much better for C#, Java is also good, but isnt to too much used, for games, but there were exception as Vampire masquerade Redemption or Minecraft. Lots of games have quick engine in C++ and gample in slow but easy to learn scripting lang as javascript or lua, in cauae of unreal is 20 times slower.

ruthan
ruthan's picture
Offline
Joined: 01/22/2012
Small fix

Few update, becase im by my awesome 10 dolars keyboard, i should fix my last sentence.

Lots of games have quick engine in C++ and for gameplay (non core code) is used slower but easy to learn scripting lang as lua, javascript etc.. in case of unreal is this scripting langueage up to 20 times slower than native C++, what is still enough for FPS genre game, if you need something more complex you have problem :)

But worst magic, is how split native and scripted part of code for best efectivity.

Who: Brujah Zealot, the pimp of babylons bitch. / Location: Scorched heart of Europe. // Sorry for my moldavian sort of english, i have 2 possibilities, to be silent or try to say something +look like idiot..

gilgamesh (not verified)
Speed is not an issue.

Vampire was done with Java? Cool.

Matt could write his RPG all in HTML5 with JavaScript and probably would not have any speed issues.
If you want to squeeze two more frames per second out of your hardware, that's a different matter.

Anyway I vote for C#. C# and Python are the most popular beginner's languages atm.

ruthan
ruthan's picture
Offline
Joined: 01/22/2012
There is not much info about

There is not much info about Vampire nod engine, it looks very like Quake 2/3 engin, using same BSP technology for maps, console etc. This core part is probably in C++, but for all rpg system, game mechanics, spells, events etc is used Java, i tried to do mod for this game.

More information you can find here, nice guy Javokis, made realy great stuff for this old game.

Who: Brujah Zealot, the pimp of babylons bitch. / Location: Scorched heart of Europe. // Sorry for my moldavian sort of english, i have 2 possibilities, to be silent or try to say something +look like idiot..

LachlanL (not verified)
Go with C#!

IMHO C# is probably the best option for your needs. It does require knowledge of some concepts like Object Oriented Programming, but that is also a plus as I find that using OOP practices make your code more modular and easier to maintain. If you're not completely up on OOP (classes, etc) I'd suggest finding a resource on that as otherwise you will struggle with it. The Visual Studio IDE is great (I use the Pro version at work) and think that Microsoft did a really great thing allowing the Express version to be used for free. C# is also the language most favored for APIs like Microsoft's XNA or SlimDX if you want to work more directly with DirectX on windows systems or XBox in the future.

C++ is commonly used in heavy-duty professional engines, but I don't think it is necessary in smaller projects that do not need to be "bleeding edge". If you go C++ you can generally expect your code development time to double due to having to clean up bugs. C++ is definitely a "know what you are doing" language as it allows you to do many tricks that a more strongly typed language like C# would not allow. However, it usually ends up being that those things end up causing bugs and hence headaches. Plus, with the processing power and memory available on modern systems, using fancy tricks to save on memory or instructions is not as relevant as it once was.

It is definitely true that one can make a blindingly fast and smooth product with almost any language and conversely a horrible and clunky one as well, but overall I think that C# is the best choice for beginners. It reduces gotchya's. You can work in a great IDE. It has wide industry adoption and so there are many online resources for learning and trouble-shooting (StackExchange is your friend).

ruthan
ruthan's picture
Offline
Joined: 01/22/2012
Coder needs own dungeon

You can also dual C# and C++ (for most important code from performance perspective) in the so-called unsaved mod.

But i thing that there is realy more important think to say. Its very hard to be programmer 4 or 6 hours in week, you need first dive into code and gain lots of knowledge in this in first big dive. You just need to lock yourself somewhere in basement, minimaly for 1 month and do nothing else than the write code, yeah there is another possibility be simply genius :)

Who: Brujah Zealot, the pimp of babylons bitch. / Location: Scorched heart of Europe. // Sorry for my moldavian sort of english, i have 2 possibilities, to be silent or try to say something +look like idiot..

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.