- Home /
From C# to C for the S2 game engine
Hello everyone, I have a problem, or let me put it this way, a question. This has absolutely nothing to do with Unity 3d but I figured that there are very intelligent people in this forum and that I just might as well ask it here. I have been studying C# from weeks (maybe month, I lost track) now because I wanted it to use in an engine called "S2 engine." I also thought by studying C# I could use it Unity 3d. But now it turned out that the S2 engine is using C instead of C#. So my questions are:
Will I be able to use my knowledge of C#?
Why would you use C? (strength and weaknesses?)
Could someone give me a link to a good tutorial?(I prefer video tutorials)
Is it hard to learn C?
Why do some people refer to it as C/C++?
I know this as nothing to do with Unity 3d, but would really appreciate your help.
Thank you very much in advance
Link: http://www.profenix.com/eng/aiHD.html One of the passages says something about the script languages. Maybe it will help you.
This isn't a forum, it's a database of Q&A for the Unity engine. Posting off-topic questions is very poor form.
Answer by Statement · Apr 01, 2011 at 08:37 PM
The S2 ENGINE HD script language has been completely reprogrammed too. Compared with the previous one, the new script performs all the arithmetic and logic operations of a professional programming language with a syntax similar to C.
You can't take much of C# into C. C is not even object orientated. You can however make use of class concepts by having each function explicitly accept a "this" pointer, with a pointer to a structure describing the instance. I don't know how that engine performs or how their "C-like language" handle references. C doesn't have the luxuary of garbage collection and you have to know very much about memory allocation, deallocation, memory leaks, dangling pointers and much much more. In a nutshell: C# is easy. C is hard.
Will I be able to use my knowledge of C#?
Some, but not all. Variables, functions, loops, branches and so on - they should be pretty much the same. Forget classes, memory management, coroutines etc.
Why would you use C?
C have very good compilers producing fast code with little overhead. However, it require you to really know how to drive the muscle car or you will crash hard.
Could someone give me a link to a good tutorial?
You gotta be kidding me? (1st of April?)
Is it hard to learn C?
Not really, but hard to master.
Why do some people refer to it as C/C++?
C++ is a superset of C, meaning that C++ support all that C support, and then some. The languages are so similar you often say "I know C/C++" in common speak.
Bottom line
Since it's not C, it's a scripting language similar to C (thus not C) I suggest that you learn their scripting language (The S2 ENGINE HD script language) instead of learning C.
Look, you need to know what to learn. You previously started learning Java when you wanted to learn Unitys JavaScript. Don't do the same mistake again. http://answers.unity3d.com/questions/43209/java-or-javascript
Oh my god, Statement.. you just made my day xD first Java in s$$anonymous$$d of JS and then C# in s$$anonymous$$d of C xD
Statement, this post and its comments are pure gold: you should retag it as "funniest-post-on-unityanswers" and keep it here forever xD And many thanks to $$anonymous$$ for the laugh :)
I think we don't need to draw more attention to this :) I am sure the author would agree.
Answer by Peter G · Apr 01, 2011 at 08:43 PM
Well for starters; why not use Unity? You already know C#.
Learning C:
Your knowledge of C# will help you understand the concepts of programming in C++ and to an extent with C. But, despite the similarity in names, C# is not that close to C. C# is object-oriented. C has pointer types (C# handles pointers through reference types). C# is also much more advanced when it comes to memory allocation.
The advantage to C is that it can be very fast. A good programmer can write very fast C code compared to other languages. Some modern compilers eliminate this advantage to an extent, but the handful of people who can write perfect C will still see some speed increases. Being an early language, it also has a large user base.
The disadvantage is that it makes grown men cry. Without OOP and the added stress of pointer types, C becomes a hassle more than a gift. The old adage comes to mind "With great power comes great responsibility"
People often refer to C/C++ as such because they are very similar. C++ is C with syntax for creating objects basically laid on top of it. C++ is usually a little easier to program.
Is it hard to learn? Not to hard to learn. It's not much harder than any other language to learn. Its probably easier than this (April Fools), but harder than something like javascript. Becoming good at it is a whole different story.
Note: C# also support pointer types. Unity3D doesn't since it doesn't allow unsafe code. You can still call C libraries from C# and Unity3D, to speed up critical sections.
I would say that C# is more advanced with memory management. I don't know about the allocation part :) I think C is way more advanced with that.
Answer by Riva · Apr 01, 2011 at 09:08 PM
Im not sure if you are refering to using C for scripting levels (A) in S2 or actually writing a game based on S2 in 'hard' C (B). Im not that familiar with S2 and theyr pages dont say much.
Will I be able to use my knowledge of C#?
Basicaly C# is for coding newbies compared to Ansi C. If you'll have write a game code in C as part of S2 source code, then C# knowledge will help you little. Its whole different level of programming, with by-hand dynamic memory allocation, pointers - referencing etc. etc.
Why would you use C? (strength and weaknesses?)
I wouldnt. Its too complicated for me to write anything bigger in it. Im mainly not coder though. Its strenht, if used skilfuly, is speed and small resource footprint. Its a language OS-es are witten in.
Could someone give me a link to a good tutorial?
Google can.
(I prefer video tutorials)
Are there any coding video tuts ? Seems to me like nonsense :)
Is it hard to learn C?
To learn it well ? Yes!
Why do some people refer to it as C/C++?
(Ansi) C is older, basic, version. C++ or 'Object C' (not Objective-C!) is an extension of definition of C language and has whole new part of syntax and mainly a different programming plilosophy.
More about this on teh internet. = Not here.
Answer by yusuf1994 · Feb 13, 2013 at 03:18 PM
Hi i know it's an old post, i'm s2enigne user , s2 is easiest way to make AAA games , here the link : http://www.moddb.com/engines/s2engine-hd
and if you want to know about scripting here you go : http://www.s2powered.com/MEDIAWIKI/mediawiki-1.16.0/index.php?title=Script_Reference_Manual
i suggest you using s2enigne HD because the rendering & it's made in italy :) .
Your answer
Follow this Question
Related Questions
unity web player startup 0 Answers
how do you make anime charictures on unity 2 Answers
Playing a video? 1 Answer
How to make a character move for some time and stand for some time? 1 Answer
blender animation tutorial? 1 Answer