Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 243 244 [245] 246 247 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 907064 times)

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3660 on: January 19, 2013, 03:35:01 am »

I don't understand why C is still taught and used,
can't C++ do everything C can do plus more,
I mean, can't you type C code in a C++ program?
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3661 on: January 19, 2013, 05:44:53 am »

I don't understand why C is still taught and used,
can't C++ do everything C can do plus more,
I mean, can't you type C code in a C++ program?
Wait, article, let me find it...

There you go: http://damienkatz.net/2013/01/the_unreasonable_effectiveness_of_c.html

TBH, I dislike C and love C++, but I don't have to program databases from scratch.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Immortal

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3662 on: January 19, 2013, 08:57:51 am »

Galen, do you have any sources I could read up on?
I've done, connect4(perfect), several other board games, and have done a few competitive robotics competitions (First Robotics). I am currently taking on a 2d space game though and I am kind of lost on how to approach it.
Logged

GalenEvil

  • Bay Watcher
    • View Profile
    • Mac-Man Games
Re: if self.isCoder(): post() #Programming Thread
« Reply #3663 on: January 19, 2013, 11:26:50 am »

Immortal: One book that has helped me a lot and is my general reference resource is "Artificial Intelligence for Games: 2nd Edition" by Millington and Funge. It explains various AI development techniques and different modules to make use of. A few, which you will no doubt need, are Steering Behaviours, Finite State Machines, and other decision making methods. All can be be added to modularly which gives a lot of flexibility in their usages. The Linear Theory of Battleship is also a fun read :D

Hope that helps :D I bought the Millington book a while back so not sure how much it currently costs but an Amazon search will tell you :D It's worth buying. If you can't afford it then you can *cough* get it through other means */cough* if you look for it.
Logged
Fun is Fun......Done is Done... or is that Done is !!FUN!!?
Quote from: Mr Frog
Digging's a lot like surgery, see -- you grab the sharp thing and then drive the sharp end of the sharp thing in as hard as you can and then stuff goes flying and then stuff falls out and then there's a big hole and you're done. I kinda wish there was more screaming, but rocks don't hurt so I guess it can't be helped.

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3664 on: January 19, 2013, 12:00:48 pm »

I don't understand why C is still taught and used,
can't C++ do everything C can do plus more,
I mean, can't you type C code in a C++ program?


Using C++ pulls in all kind of crap from the standard library and adds memory overhead. That doesn't matter much for a PC, but when you're strapped for space, like on an integrated device, C gives you most of what C++ need without gobbling up your limited memory. Sure, C++ Can be made as efficient as C, but that requires a good compiler, so early on, C compilers for new architectures are better than C++ compilers.
« Last Edit: January 19, 2013, 12:02:21 pm by Virex »
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3665 on: January 19, 2013, 03:32:12 pm »

The main reason my professor gave is because it's a Computer Architecture and Organization class, so we'll be looking at what the actual assembly instructions do, and how the C code becomes assembly. C++ name-mangles during compilation to support overloading and other OOP features, so C is actually a better choice here.

Immortal

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3666 on: January 19, 2013, 04:15:50 pm »

Thanks Galen. Edit: Been looking up the topics you mentioned. Great help so far.

To the above, C is used because it is the fastest. Hands down. It is the lowest level, high level programming language.
« Last Edit: January 19, 2013, 09:08:03 pm by Immortal »
Logged

GreatJustice

  • Bay Watcher
  • ☭The adventure continues (refresh)☭
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3667 on: January 19, 2013, 06:49:02 pm »

Made a game in AS3, and it's finally finished. It's a basic maze game, but it functions reasonably well so far as I can tell. However, I suspect my code is a bit messy and could have been cut down at spots. If anyone wants to critique it, provide suggestions, etc, it's right here.
Logged
The person supporting regenerating health, when asked why you can see when shot in the eye justified it as 'you put on an eyepatch'. When asked what happens when you are then shot in the other eye, he said that you put an eyepatch on that eye. When asked how you'd be able to see, he said that your first eye would have healed by then.

Professional Bridge Toll Collector?

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3668 on: January 20, 2013, 12:49:45 am »

Galen, do you have any sources I could read up on?
I've done, connect4(perfect), several other board games, and have done a few competitive robotics competitions (First Robotics). I am currently taking on a 2d space game though and I am kind of lost on how to approach it.
There's a bunch of different AI approaches.

The first is used in games, and is the most easy. It uses simple logic, state machines, and a variety of other primarily deterministic algorithms, with a bit of fuzzy logic mixed in. IMO, the boring crap which is more 'programmer common sense' than anything else.

The second is the connectionism approach. Neural networks and similar. They will probably do what you want most of the time if you do it right, but you probably won't know how or why. Good for pattern recognition.

The third is the evolutionary approach. Genetic algorithms. You pretty much give it a goal, then it tries to get as close to the goal as possible, even if the problem isn't well defined. Good if you know what you want, but not how you want it. Good for occasionally creative solutions.

The most recent and most successful variation is mixing in Bayesian Reasoning. Markov models, bayesian networks, and a few others. Based very heavily in statistics. They can be used on their own or in combination with subsystems consisting of other AI techniques; if you want to learn more about these, go here:

https://www.ai-class.com/home/

Seriously, it deserves that size. It's the online course that pretty much started the whole 'coursera' thing, and basically will take you from beginner level AI all the way up to the level where you could probably code a self-driving car. The course part is over, and so there aren't the homeworks or exam problems, but those don't really add anything anyway. It also has comprehension check questions scattered throughout, with explanations if you didn't understand the concept.

The guys teaching it are as good as it gets. Peter Norvig literally wrote the book on AI; "Artificial Intelligence: A Modern Approach," which is pretty much the book on AI. Sebastian Thrun was the head of the team that created Stanford's self driving car, the first to complete the DARPA Grand Challenge, before moving on to Google to create the Google self driving car. So yeah; basically the top guys in the field.
« Last Edit: January 20, 2013, 12:51:19 am by alway »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3669 on: January 20, 2013, 01:45:08 am »

To the above, C is used because it is the fastest. Hands down. It is the lowest level, high level programming language.
That's just not true. C can and usually isthe fastest, but it isn't hands-down fastest. You can write fast C++ or slow C as easy as anything. :/ Depending on usage, C and C++ have near identical speeds. I remember one person benchmarking a certain program and finding that C++ was slower solely due to the compilers having different optimizations for the identical function (something to do with memory allocation...). Fixing it solved the problem.

... Though I guess that means C does tend to be faster, if only due to compiler differences... >_<

I have to motivate myself to do stuff! But I keep doing other things instead of codjng. >.>
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3670 on: January 20, 2013, 04:20:12 am »

Idk, I see what you guys are saying, but those are dumb reasons.  yeah it may compile faster, but i don't mind waiting another 1 second - 1 hour(or longer) for something to compile. 
and things like one of the reasons listed in that article
Quote
It's not that OO type systems force fractal complexity to happen, but they encourage it, they make it easier to do the wrong thing. C doesn't make it impossible, but it makes it harder. C tends to breed simpler, shallower types with fewer dependencies that are easier to understand and debug.
I agree that OO type systems encourage fractal complexity, but it doesn't have to be that way,
You can program C++ in a non OO way if you want.
and C++ has cool / helpful things like classes, and things like stringstreams (which I much prefer over the C way of doing strings) and C++ style strings in general, and not to mention it can still do C-style strings if thats your fancy.
maybe I'm just pigheaded, maybe I just love c++ But I still favor it over C,

and the things about it having a bigger community, and compilers working better for it, and stuff, thats because it's been around longer, and people refuse to move on.
C++ is the future. . .
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3671 on: January 20, 2013, 04:24:21 am »

I think I was talking about runtime fastness, not compiletime fastness...
Compiling speed is fastest is scripting languages, due to lack of compiling! xD

I like C++, but it's not the future. :P It's pretty much in its prime (especially in the game industry) or almost past it.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3672 on: January 20, 2013, 04:48:18 am »

yeah, I know scripting languages don't have to compile, but we were comparing C and C++.
if you think C++ is almost past its prime for the game industry, what do you think is going to replace it?
and don't say Java,.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3673 on: January 20, 2013, 04:54:00 am »

Well, obviously I have no idea, because it's still going to be 'in' for a long time. :/
And I don't like Java.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3674 on: January 20, 2013, 04:59:49 am »

I have a feeling Java is going to be coming up in the world here soon though,
what with Android games being Java,
and that dumb box, Ouya or whatever it's called, that indie game console, is going to be Java only,
and Nvidia's new game console is going to be mainly Java based.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.
Pages: 1 ... 243 244 [245] 246 247 ... 796