Regarding the lack of news

A place for all things OpenMoHAA

Moderator: OpenMoHAA developers

$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

There are tutorials out there. Fastest one (at least they claim so) is one where you should learn the absolute basics in 21 days. (please note that this isn't even complete basic, it'll take another month or 3 time learning the entire basics.)

Everything you should learn each day is planned out (url: http://newdata.box.sk/bx/c/htm/ch01.htm#Heading2) I don't know if this one is professional enough and good enough to teach someone the "basics"of c++

(Another one, more professional spots my eye: http://www.learncpp.com/ <-- better use this one, it's very descriptive, detailed, uses a lot of examples and does it step by step using windows visual studio (it's free don't worry))

c++ is merely an extension of C, meaning that c++ isn't a programming language itself but merely an addition to C (it add a lot of new ways and possibilities), but the last couple of years, people use c++ to refer to C with C++. But if OMoHAA doesn't use the c++ extension it'll be recommended using an C only tutorial.

Like mod hippy says, you need to know your math basics (basics, you ask? Well everything you learn from kindergarden up to your last year in highschool) and you need to be good at it, people who are good at languages (like myself) in other words, who are not so good at math, will have a more hard time at learning it.

Second you need to have a real Logical way of thinking (something I don't lack) meaning you can easily track an error or understand why there's an error, how things are put together, things could work...etc...

I don't want to discourage you (going well so far? lol) If you lack all these things you can still learn c++ but you will have a harder time doing so than the average person.

Advantages? Well if you can do some more than basic c++ and are unemployed...then you've just got a high paying job ;) People are begging for computer specialists, even non-programming related. (In most cases you need a diploma however)

There are a lot of free tutorials out there and free programs you can use to learn the language. I suspect when there are too many programmers, you need to pay for all of it lol.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
m0d hippY
Warrant Officer
Posts: 132
Joined: Tue Apr 27, 2004 3:58 am

Post by m0d hippY »

c++ is a language. It's a superset of c, or you can say c is a subset of c++.

Learning c++ isn't a waste of time if you want to program in c, because they are very closely related in syntax, the major difference between the 2 are that c++ has additional functions, but you can also use function from c in c++.

c uses functions like printf as does many gaming code
c++ uses cout & cin (although you CAN use printf, scanf as well)

I know alot of people that learn from ebooks as mentioned, personally I try but I think it helps out taking classes. Everyone is different so you just have to find your technique.
Math & logical thinking as mentioned also is very important. You would think wombat is a computer science major, and actually he's a math major and just picked up programming as a hobby. haha, go figure right, well whatever he's doing, he's doing a damn good job of it so keep going wombat! But it just shows you how much it helped him in programming and I know many others like him.
Image
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

None of these tuts address the fact that both C and C++ suck balls, though :)
Image
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

lol! Btw jv, I thought you knew a bit of c++, or do you know another programming language?
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

jv_map wrote:None of these tuts address the fact that both C and C++ suck balls, though :)
Hold it, Jv, you're blaspheming. C is by far the most efficient high-level programming language out there (quite often 1 line of C translates to 1 line of assembly code!), with ultra-clear and convenient syntax and semantics. There is a reason that so many scripting and programming languages are based off C (including the MoHAA scripting language). C++ includes more clutter because of the OOP (Object-Oriented Programming) design and artificial language constructs like references and exceptions.

What really sucks ass is the entire .net/# family of languages, plus Borland's dialects of C++ and Pascal (i.e. C++ Builder & Delphi). It's Bloatware with a capital B.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
211476
Captain
Posts: 273
Joined: Fri Feb 29, 2008 2:20 am
Location: Arizona, USA
Contact:

Post by 211476 »

ImageIt's Jv and Rookie's C, C++, syntax, semantics, programming small talk momentImage

Watch Conan it's great
Image
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Lmao 211476, nice one :)

Ok, now if you'll excuse me :P ...

You're absolutely right Rook. Except that I personally tend to put C in the low-level group (illustrated by the fact that 1 line C ~= 1 line asm), but this could be a matter of perspective.

I've worked for half a year on an industry grade fluid dynamics code written almost entirely in C, so I've had some exposure to the language. It's often relatively nice and clean but lacks any form of what they call 'polymorphism' which can be a tremendous time-saver. I had to rewrite simple linked-list methods several times just because I wanted a list of differently typed objects. Granted it could be done with void-pointers but then any kind of cleanliness/type checking would be gone. Or make a code generator. But in my opinion any language that encourages the use of a code generator is not truly a high level one.

The other drawback of C is that it is too easy to write a program that appears to work right but in actual fact is littered with subtle bugs. You see this all the time. On the other hand it is very difficult to write error free code and verify its correctness. Especially in the case of flow solvers, where computations may literally run weeks on high performance clusters, you want to be sure the end result is right.

For my master's thesis, which contains a write-a-combined-fluid-structural-solver component, I'm currently using Haskell. It's weird and sucks like any other language, but it has some very powerful features which allow very, very generic programming (this can be an enormous time-saver), extremely capable static type checking and referential transparency. That last thing is very useful indeed, it lets you check any function in your program separately from the rest, very useful for debugging (if necessary).

When I write a C program, which I do from time to time, even if I make a very good attempt, when I go test it I often still find 1 or 2 bugs. Ok allegedly maybe I suck rather than the language :oops: . I've only used Haskell for a month or so now, but any program/function I wrote that compiled successfully, also gave consistently correct results :)

It's difficult to learn though, being very different from C and much less intuitive. I'm still struggling with it tbh, but I much like its merits. Might not be very useful for a game, though it can boost your productivity compared to writing C. That's useful for a project that's low on manpower. In fact, I read a paper somewhere, about someone who single-handedly wrote a quake-like game (OpenGL), including the engine, in Haskell in only a few months time. Unfortunately the single threaded performance of a Haskell program trails that of an equivalent C program :(. Haskell scales very well to multi-CPU environments though, being almost implicitly parallel, something that C will never achieve.

Eek I sound like a grandpa telling war tales don't I :? . Well whatever. I take back that C and C++ suck. I'm just not smart enough to use them :)
Image
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Hmm, very interesting, which also explains why you like scripting in MoHAA, it's very exact, mohaa strokes out for every single error, you can easily find and notice mistakes, bugs...etc...

About Haskell, extremely impressive; writing a game engine in a few months, perhaps he's a genius but it sure shows what someone can do with that language.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Great, now I will look like I'm questioning Jv's intelligence. :roll: Let's make it clear - I'm not! ;)

Polymorphism? Of course you can do it in C, with a proper combination of structs and unions. I've made an entire UI widget hierarchy in C for my game engine before migrating to C++ using a scheme like this:

Code: Select all

typedef enum {
	WT_LABEL,
	WT_BUTTON,
	...
} widgetType_t;

#define WIDGET_COMMON_ELEMENTS	widgetType_t	type;	\
				colour_t	fg;	\
				colour_t	bg;	\
				...

typedef struct {
	WIDGET_COMMON_ELEMENTS
} widgetCommon_t;

typedef struct widgetButton_s {
	WIDGET_COMMON_ELEMENTS
	void (onMouseClick *)(struct widgetButton_s *b);
	...
} widgetButton_t;


typedef struct {
	WIDGET_COMMON_ELEMENTS
	char	*caption;
} widgetLabel_t;

...

typedef union {
	widgetCommon_t	common;
	widgetButton_t	button;
	widgetLabel_t	label;
} widget_t;
And so on, and so on. You can easily check what kind of object is it by casting its address to a widget_t pointer and querying widget->common.type.

I agree C code is more prone to bugs than other languages because you need to think about what you write more carefully. Most errors come down to logical mistakes. But increased error vulnerability is always a drawback of more control over your program, and personally, I am willing to pay this price.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Sorry for the double post.
$oldier Of Ra wrote:Hmm, very interesting, which also explains why you like scripting in MoHAA, it's very exact, mohaa strokes out for every single error, you can easily find and notice mistakes, bugs...etc...
I must disagree. The MoHAA scripting engine is actually extremely tolerant for coding errors. There is a number of reasons, starting from case insensitiveness (which doesn't help the code to appear clean and unambiguous) to treating every unknown, even unquoted token as a string, to the damn NIL value, which makes scripts such a pain to debug (unless you attempt to do something substantial with it, a NIL value can live a long life without even yielding an error message, not mentioning indicating what exactly is wrong, making logical mistakes and typos extremely difficult to track down). The typeless variables, their unregulated creation and destruction are a factor as well, but I can't blame the MoHAA script explicitly, as it's a "feature" of most scripting languages out there.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Nice :)

That looks like a rock solid data structure 8-).

Doesn't get anywhere near to the level of code reusal and abstraction you can achieve in Haskell though. For example, in Haskell you can pass functions, file input/output operations, whatever around like they were ints/doubles and have them type checked. You can also construct infinite trees and recursive data structures. What you want really.

Not intending to start a pro-Haskell lobby though. It's a very powerful language with at least one excellent implementation. It's main drawbacks are that library support and documentation seriously lag behind that available for C/C++ (although alleviated by the foreign function interface, which is relatively simple). And some, in my (newbie) opinion, unfortunate syntactic choices, perhaps in the impression that the average programmer will be unable to locate { } [ ] ; and , on their keyboard. These are replaced with the appropriate amount of whitespace. That sometimes tends to clutter up the code and causes the compiler to complain when there is merely a tab missing. Ok well that outright sucks. Guess you can't have everything :).

Both (all?) languages have their dis- and advantages, which to choose really depends on your application, experience and often what the rest of the team prefers.

You're absolutely right about your criticism of moh's scripting language: it encourages poor coding practices. It's great for learning though, and quite powerful indeed. I found it a great and enjoyable entry point for starting learning 'real' programming :)
Image
Post Reply