Pages: 1 [2] 3 4
|
|
|
Author
|
Topic: Programming (Read 7665 times)
|
|
|
|
Novus
Enlightened
Offline
Gender:
Posts: 1938
Fot or not?
|
Dude this is the Off Topic section. You're question doesn't have to relate to Star Control in any way. Feel free to ask any unrelated stuff about coding or penguins or anything really.
That said, it would be nice if the programming stuff were in the 'Programming' thread and the penguins in a 'Penguin' thread or suchlike, just in case someone, for example, is interested in programming but scared to death of penguins.
It has SOMETHING to do with SC but its just one question so far but I was working hard on this because there was a bug - for some reason, if I have an if or else statement and under it I put more than one cout>> it won't work but I fixed it and I am so happy I made it in C++ with Dev-C++. As for your program, one of the reasons I prefer Java as a teaching language is that I can easily run students' code with zero or limited access to file systems, networks and so on, rather than trust them not to do something undesirable either intentionally or unintentionally. Another is that porting Java code from e.g. Windows to Linux is no work at all if it's properly written. Furthermore, class files are often small enough that I can easily disassemble them to figure out what they do even if source code is not provided. Since examining your program is impractical in all three ways mentioned above, I can't say much about it. Source code would help.
"It won't work" is a bit vague. That said, I suspect you forgot the curly brackets.
|
|
|
Logged
|
|
|
|
|
|
superbutcherx
*Many bubbles*
Offline
Posts: 116
|
I've found www.cplusplus.com/doc/tutorial/ useful at learning new things and rehearsing the old.
Even though it's for C++, the first parts of the tutorial (Basics of C++, Introduction, Control Structures, Compound Data Types) hold true for C since these parts are essentially the same for both languages.
The best way to learn how UQM works is to read and re-read the source files like crazy It also helps a lot, if you have finished the game hundreds of times and played it a gazillion times. It works wonders on understanding what the functions in the source code really do.
Also, always, if you modify something in the code, add a comment with your own unique identifier at the end of the line like // ZXZ. It will save you a lot of time hunting down what you've done, especially if you leave the code alone for a couple of weeks and return to it after that. When the mod keeps growing it's not a bad idea to make a list of files that you've tinkered with and add a short summary of mods you've done to that file.
|
|
|
Logged
|
|
|
|
|
|
TiLT
*Smell* controller
Offline
Gender:
Posts: 260
To boldly go where no Spathi has dared go before
|
I'm interested in learning how to start modding the UQM code - starting with simple stuff like editing the dialogue etc - and learning the C programming language. Those of you who know how to mod or know C...how did you learn? How did you start off? I'd appreciate knowing how you did it so I'd know how I should do it.
My advice: drop the idea and learn to code in an easier language first. I'd recommend Java with either NetBeans or Eclipse as the IDE. Try writing some easy console apps, then write a simple game using Java + JOGL (NetBeans has a nice JOGL plugin, including a few good templates to get you started easily). Once done, rewrite parts of the game to use the fewest amount of classes possible, store data in byte arrays, and write your own implementations of a few functionalities you're using from the Java standard libraries. Once done with that, you should have enough knowledge to start the transition to C, which would allow you to mod UQM somewhat. Very slightly related, but still worth the read nonetheless: http://cube.wikispaces.com/How+not+to+start+a+mod I'll second this, but for different reasons. Try learning a strict object oriented language first, such as C# or Java, even if you don't intend to use them much later (though stuff like C# is probably going to inspire you if you're a Windows user). Starting with C or C++ teaches you bad habits since the two languages allow you to do just about anything you like, including stuff that isn't smart to do at all. It's easier to transition down from a high-level language than to move up from a low-level language (the first time). Trust me. I've been there. It nearly messed up my ability to get through computer science classes.
|
|
|
Logged
|
|
|
|
ziper1221
*Many bubbles*
Offline
Posts: 124
|
On, the same note, how useful is python and Java? both of them are classes offered at my school next year.
|
|
|
Logged
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
Java is widely used. Knowing how to use it will be useful.
Python is a very different beast. One serious mode is just to enter commands one line at a time! It too is widely used. I can't say which is better, really. If you really want to be a serious programmer, Java might be better. If you just want to get the idea of programming, python might be better? I'm not familiar enough with python to be sure.
|
|
|
Logged
|
|
|
|
onpon4
Enlightened
Offline
Gender:
Posts: 709
Sharing is good.
|
Java is widely used. Knowing how to use it will be useful.
Python is a very different beast. One serious mode is just to enter commands one line at a time! It too is widely used. I can't say which is better, really. If you really want to be a serious programmer, Java might be better. If you just want to get the idea of programming, python might be better? I'm not familiar enough with python to be sure.
Python is an excellent language, IMHO. Its biggest advantages are ease-of-use, cleanliness of code (due to its unusual use of whitespace for code blocks), and that it's dynamically typed. There are also a large amount of 3rd party libraries, making it useful for a huge number of tasks, including graphical programs (i.e. games) and GUIs. Finally, it is an interpreted language, meaning you don't have to compile it; you just run it.
Of course, there is one disadvantage: Python scripts can only be run if you have Python installed. However, besides the fact that most Linux distributions come with some form of Python already, there are 3rd party modules which can "freeze", i.e. compile, scripts along with necessary Python and 3rd party components (such as py2exe, py2app, and cxFreeze), allowing people who don't have Python installed to run your program.
Not knowing much about Java, I can't say which class you should pick, if you have to choose one. I would take both if possible.
|
|
|
Logged
|
|
|
|
Gekko
*Many bubbles*
Offline
Gender:
Posts: 199
Arena regular
|
Java programming probably gets you a job. At least here you end up doing GUIs with Netbeans if you know Java. I'm not sure where Python is used in the market, but I like Python more than Java. If you know C/C++, then a huge load of various doors to even extraordinary places open.
If you are considering employment, then it's also important to learn the development on other platforms. It's highly different to make a program on Windows/Linux/OS X
|
|
|
Logged
|
|
|
|
Novus
Enlightened
Offline
Gender:
Posts: 1938
Fot or not?
|
First of all, I would like to point out that Java and Python are quite similar languages in many ways and share the same ALGOL/C origins; if you learn one, picking up the other won't be hard. Both require a separate runtime environment that is available as free software and often included in Linux distributions but not in, for example, Windows. Although they are both general-purpose platform-independent languages, they target different uses: Python tends to see lots of use as a quick and convenient language to control or extend other programs (e.g. web servers, 3D animation software, games), while Java tends to show up in user-facing software more (applets, desktop applications).
My impression of how these two languages are developing is that Java has a stronger emphasis on building and maintaining systems (corporate priorities), while Python focuses on being clean and straightforward to write in (hacker priorities). If you're writing something to get a job done for yourself, Python may be less work, but I wouldn't want to base a major corporate infrastructure on it quite yet.
As far as learning goes, Python is probably the better bet as a first programming language (mostly because of its cleaner syntax and lack of clutter in small programs), although Java isn't much worse.
|
|
|
Logged
|
|
|
|
Pages: 1 [2] 3 4
|
|
|
|
|