Jump to content

Home

Feel like a dufus... Coding question!


babywax

Recommended Posts

Probably helpful to mention why that looks the way it does...

 

Take, for example, increasing an integer variable called 'number' by 3. You can write it two ways in C...

 

number = number + 3;

 

...or you can write it as...

 

number += 3;

 

Both do the same thing.

 

The same applies for the bitwise-OR (|) operator which your dealing with.

NOTE: this is the bitwise OR (|) as opposed to the logical OR (||).

 

You can write:

 

number = number | 3;

 

...or you can write...

 

number |= 3;

 

Again, both achieve the same result. Although the second variation is usually used because it's cleaner and easier to read.

 

Anyway, I would suggest you buy and study a C book if you wish to delve much deeper into the code. (Or find some on-line tutorials at least...)

 

Good luck :)

Link to comment
Share on other sites

Basically it's performing a bitwise OR operation. It goes thru and bitwise ORs the two input varibles and inputs it to the output varible.

 

Example:

 

Bitwise OR

-------------------

|=; |

 

Logic:

0 | 0 = 0

1 | 1 = 1

0 | 1 = 1

1 | 0 = 1

 

Examples:

Example 1:

X = 00010101

I = 00101101

Y = I | X;

Y = 00111101

 

Example 2:

X = 00010101

Y(pre) = 00100000

Y |= X;

Y(post) = 00110101

 

Bitwise AND

---------------

&=; &

 

Logic:

0 & 0 = 0

0 & 1 = 0

1 & 0 = 0

1 & 1 = 1

 

Examples:

 

Example 1:

X = 00010101

I = 00101101

Y = I & X;

Y = 00000101

 

Example 2:

X = 00010101

Y(pre) = 00100000

Y &= X;

Y(post) = 00000000

Link to comment
Share on other sites

Wudan School of Fighting Motto: "Get in there and Rip it Up!"

 

ie, I just have a book for C, I haven't studied it, but I've talked to programmers around town and I can follow along with them pretty well in conversations about code.

 

I've looked in to studying C at my college, but that's not until the SECOND YEAR in the CIS program at most colleges ...

 

I don't want to learn Java, Perl, or some little crappolla that doesn't "Get in there and Rip it Up!", although those languages are all valuable tools to have in the 'knowledge toolbox' and eventually, like Bruce Lee, I will want to learn other coding (martial) arts.

 

My Kung Fu is progressing.

Link to comment
Share on other sites

lol - well spotted Commodus

 

You forgot to unlock your AND gate there Razor - nothings getting through that! :)

 

And just a C reference book - one which doesn't try and teach you C but just lists all the keywords, syntax etc. - doesn't cost that much. You can get one for £5 or so here in the UK.

 

Also, try searching for 'C' in google :)

Here's one example I've just found:

C tutorials

 

...and there are loads of other sites too. Although of course the downside to sites like this is that you have to trust the person who wrote it knows their elbow from their arsehole! lol

 

You can still learn stuff without a reference, but you'll learn a lot faster with one!

 

Mirko,

 

As well as knowing C, you also need to get to grips with the QIII / JKII game engine. What gets called when, how the game, cgame and ui dll's interact etc.

Well, for simple mods you don't nessesarily need to I guess, but once you try and delve to a certain level your gonna hit these kind of issues.

 

I started by looking at QIII tutorials here:

 

Code3Arena

 

I believe there are also specific JKII tutorials knocking around somewhere...

 

Also, although you can compile and run the code without an IDE like Visual Studio, I think it really does help. So if you can somehow get access to one, by all means do.

The main advantage is that you can debug the app, which really does help you work out what the hell is going on! You can stick in breakpoints, look at the call stack and see where the function your investigating is getting called from, examine the values of variables etc. etc.

...very handy indeed...

Link to comment
Share on other sites

Yeah, i thought that i would need to get a feel for the Game(code) and engine, but what i wanted to know is, if the C i'm learning right now (Ansi-C, not C++) is enough to do the coding. Or is the source code written in C++?

I asked about simple mods, because I want to start with something easy...

Link to comment
Share on other sites

You don't need to know C++, JKII is written in C.

(Although saying that, some parts of the QIII engine are written in quite an Object Orientated way sometimes, so knowing at least a bit about OO can't hurt.. :) )

 

And ANSI is just to do with the standard C library's - right? (I'm not actually sure - my main programming enviromnent is VC++ MFC...!)

 

I think it's just C you need to worry about. I don't think you need to worry about the ANSI bit for game coding...

 

So in answer to your question, yes - what your learning right now is good enough :)

Link to comment
Share on other sites

Also you might try stopping by the NRG forums. I'd recommend here, but it's a smaller group there and there's a dedicated coding forum. Our gracious master, AB_Legion treats us well.

 

The link is in the sig.

 

I mean ... it's me, razorace, JediStone should be back soon, Commodus has been known to appear there ... you know.

 

Come to think of it, I don't recall seeing a certain Renegade ever there ... maybe he's chicken?

Link to comment
Share on other sites

Originally posted by Commodus

Ahem. 1 & 1 = 1, not 0. There wouldn't be much point using it otherwise, would there?

 

Also, do you think we will be able to edit GLAs in JA (Jedi Academy)?

oops! Sorry about that. Typo. I just fixed it.

 

Anyway, no, I don't think we'll be able to edit GLAs in JA. If Raven's not willing to give us the model now, there's no reason they'd change their mind for some time (IE years).

Link to comment
Share on other sites

Raven's comments thusfar have indicated 2 disappointing facts:

 

1) No SP SDK. (not that I care about SP as it is)

2) to make new animations, you'd still need Raven's copy of the XSI used to make the _humanoid.GLA file, and you'd need XSI (the skeletal hierarchy in Raven's XSI is not compatible with 3dsm, from what I understand, 3dsm would have a hard time dealling with the 46 children of thoracic.

 

The reason for both of these is because Raven has never had a good history of their games being hard-modded (sounds sick ...), ie no CS like mod has come out for a Raven game.

 

You might say that's because they don't release enough tools, but I'd have to counter and say that they have a very reasonable argument. If we are able to make our own tools and have questions about them for Raven to answer, my experience has been, "If you want the right answers, you've got to ask the right questions."

Link to comment
Share on other sites

I tend to agree. I'm not sure we really have the modeller/animator manpower to do large amounts of new animations even with the correct software/skeleton. Animations aren't a cakewalk, especially without the motion capture equipment. A dedicated tool that makes it easy, like the animator program you're working on, might do the trick thou. :)

Link to comment
Share on other sites

And your last comment is probably correct. There's no reason for Raven to go to the effort of releasing the tools if noone will/can use them. I think they underestimated our resolve but they should have provided the tools once the interest was shown.

 

However, I tend to believe that the suits don't want to risk people make better games with their software than they can. Ghoul2 is VERY powerful, most default engines don't even approach the level of collision detection that ghoul2 provides. And I for one wouldn't want people using my kickass software without a piece of the pie either...

Link to comment
Share on other sites

Well.... if we know the structure of GLM and GLA files then it would be possible to make a program for viewing them and editing them. I would even go so far as to suggest using Quake 2 or Quake 1 (or some other open source thingy for doing it).

Link to comment
Share on other sites

Noticing all this code speak makes me wonder.....how old were most of you when you began coding? Because I'm going into Computer Science at college next year and it's quite obvious i know not even a fraction of what you guys know......so i'm wondering how much catch-up I might be in store for next year......:(

Link to comment
Share on other sites

1) Get a book

2) Get the source

3) Start screwing with the code.

4) Possibly, to get in to the flow of changing code around, follow a few tutorials, like the ones at code3arena (which are for the most part, easy to port to JK2)

5) You can use notepad or wordpad, but I use Syn - http://syn.sourceforge.net - it does syntax highlighting, and it's very straightforward to create a new project (ie, the jk2mp code).

 

It's a lot of fun, and the coding community for JK2 are very friendly and helpful, provided you ask the right questions (such as "what the heck does function X do?")

 

There's an IRC channel, there's this forum and some dedicated coding forums (hint: check the sig) around, you can even find worthwhile discussions at some Quake3 community forums (you might even notice that Q3, though going on 4 years old, has roughly 5 times as many coders than jk2 does.)

 

Anyway, you don't have to code, you can just ... do some of those other things ... that people do ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...