Jump to content

Home

Coding-Tutorials


way

Recommended Posts

Hi,

sry, if I'm the second or third who asks this Question,

but I want to know, if you know any Coding-Tutorials for JKA or JK-2 (I think it's almost equally)?

 

I do not know anything about Coding, and just want to ask what for things with coding goes?

like can I add new weapons?

 

thx for answers:)

Link to comment
Share on other sites

Well, we've seen enough folk interested in coding come around to know a thing or two about your question.

 

Are you serious about coding? It's just C, except without pretty much any of the standard library available. Read a few C tutorials, bone up on the syntax and structure, and go from there.

 

The hardest part, I'd say, for a beginner, is to get started coding. We don't know precisely what JA's setup will be, but it seems you'll need to be able to compile DLLs (which you can do in Windows, Mac, or Linux), as qvms don't seem to play a part in JA (for shame ... or joy?)

 

If there isn't any wacky-ness (and I don't think there will be), you can compile in Dev-C++, which uses MingW to compile.

 

It's free, so I'll write a tutorial for setting it up, as I think you'll need free tools in your conquest. A few people put up money to purchase big software packages to make software, and models, but I'd say free is my favorite f-word.

Link to comment
Share on other sites

Thank you for the answers:)

 

@Tchouky: I will read it, thx

 

@Wudan: Can you give me a URL, please? I would be thankfull, if you would write a Tutorial

 

@Razorace: I knew it would be difficult, but everything on my own?

I will try, but can't do more than that.

 

I think first I'm gonna buy a book about C (just C, not C++ ?) and learn the basic-things.

 

PS: thanks again. Nice Users, nice forum:)

Link to comment
Share on other sites

Perhaps the best place to start is with a tutorial I didn't find until later, but it's free, concise, and ... free!

 

http://cslibrary.stanford.edu/101/

 

The CS library at Stanford is free and open to the public - and it's good! This is the essential C one, but they have quite a few more.

 

I'd recommend getting Dev-C++, as it's free also, and you can start coding right away! :D

Link to comment
Share on other sites

Here are some functions that you might find useful once you learn some C and when the SDK comes out (I'm gambling that the functions and the source file names will be unchanged, since JKA and JO are similar)

 

in g_active.c:

ClientThink_real() - this function is called every client frame (a frame is a unit of time - so basically you can do things to clients every x seconds or x minutes, like poison)

 

in g_client.c:

ClientSpawn() - this function is called when the client spawns for the first time on the level/map. You can use this to change the client's state (e.g. make them faster, give them more health, give them different weapons etc.) or do other things.

 

ClientUserinfoChanged() - this function is called every time the userinfo of a player/client changes. For instance, if the player changes their model or changes their force powers. You can use this to set the player's model to a particular model you might want (e.g. if you're making a class based mod).

 

in g_missile.c:

CreateMissile() - creates a "missile" object, basically an entity that is the missile entity type and has a linear trajectory (travels in a straight line until it hits something, or until it reaches the end of its life variable). This function is used in the firing functions of some of the weapons - so when somebody fires, a "missile" is created that travels forward (unless the programmer changes some of its options).

 

in g_combat.c:

G_Damage() - handles damage, so you can put code in here that allows you to handle damage from different weapons differently (like adding knockback, or doing some other complicated thing), using the "mod" (Means/Method of Death) integer and checking it against the different MOD_ enums of different weapons.

 

I admit that it's been a while since I've coded for JK2 and some of this info might not apply to JKA, but I think most of it's correct. You will most probably want to check out some of the stuff in the cgame and ui modules and the other functions in the game module.

 

Hope this helps,

Nith

Link to comment
Share on other sites

Originally posted by way

I think first I'm gonna buy a book about C (just C, not C++ ?) and learn the basic-things.

 

it might be a good thing to start with C.

It will be a little easier and since quake 3 and jk2 are coded in plain C it's not necessary to code in c++.

 

 

but i suspect jka will be coded in c++ though :)

the dll only thingy and no qvm might be a sign =)

 

edit :

Nith Sahor im 100% sure that what you said will remain true in jka .

Link to comment
Share on other sites

but i suspect jka will be coded in c++ though

 

Nith Sahor im 100% sure that what you said will remain true in jka

 

Arent these two statements a bit contradictory? If they have indeed moved to C++ for JKA (which I seriously doubt btw), they will undoubtedly have re-arranged a significant chunk of the code base.

(...if they didn't, there would be no benefit from moving from C - would there...?)

 

...and so the filenames will almost certainly change. THe function names may not change in some cases, but the way they work will undoubedly change.

 

one quick example:

 

ClientSpawn() -> g_client.c

 

might become something like

 

CClient::Spawn() -> g_client.cpp

 

 

...but anyway, highly unlikely the JKA source code will turn out to be C++ imo.

 

...but we'll see I guess...

Link to comment
Share on other sites

I am also intrested in modding JK:JA, I have a firm background in the C programming language so if it is in C I can read it just fine :), but what I want to know, where to I get what .cpp files to mod the game? or is it not in .c or some other format? Just would like to know on that information so I can start familarizing myself with the functions and how stuff is set up.

Link to comment
Share on other sites

Originally posted by RenegadeOfPhunk

one quick example:

 

ClientSpawn() -> g_client.c

 

might become something like

 

CClient::Spawn() -> g_client.cpp

 

 

 

if they turn to c++ it's obvious that it will change a bit, and i agree with your example, but such a change is nothing.

 

the function will still be there and have the same role so it doesn't really change anything (except a small bit of syntax..) .

Link to comment
Share on other sites

the function will still be there and have the same role so it doesn't really change anything (except a small bit of syntax..) .

 

If the only difference between C and C++ was syntax, then there wouldn't be that much difference between them.

 

C is a procedural language

C++ is an Object-Orientated langiage

 

there is a world of difference not only in the syntax, but in the whole structure of the code. C++ allows far more organised, flexible and maintainable code.

 

I assure you - if it has been moved from C to C++, the structure of the code - in many if not most places -will be significantly different - enough that you will have to look in a different place to find the function you were looking for. In fact, in many cases, you will find many big functions split into various segments and split up between different classes.

 

One huge example would be the saber system. If the saber system had a nice OOP design this time round ... :drool:

 

...but anyway -I think this is all theoretical anyway. I'll put a 95% probability on the JKA source code still being in C. (Heh -how stupid am I going to look if I'm wrong...!)

Link to comment
Share on other sites

Objects are instances of classes, which are groups of data and functions. But that's only a part of it. Object-oriented programming is about encapsulation, polymorphism and inheritence.

 

This page can explain it better than I can.

 

Edit: Wudan, does that answer what you're asking? If I recall, you started programming not too long ago in C, and haven't done much C++, so I assumed you were being serious and all, so I don't mean to insult your intelligence if you weren't.

Link to comment
Share on other sites

OOP isn't a few specific keywords or collection of syntax - it's a design philosophy.

 

As such, any language can be approached in an object-orientated way. i.e. you CAN use OOP techniques when programming in C. And conversely, you can write in a procedural fashion in C++. (i.e. bad class structure design!)

 

The difference being that C++ gives you the specific syntax to handle OOP development in much more effecient and effective manner.

 

The whole point of OOP is that the resulting code is easier to work with. Because C doesn't have the OOP specific syntax, you would end up having to specifically code in the OOP structure yourself, making the code more complex and therefore defeating the point of using OOP in the first place.

 

 

Well, Quake 3 and JK2 were coded in a very object-oriented sort of way so the differences should not be too big...

 

QIII and JK2 were written SOMEWHAT in an object-orientated way - in certain areas. It's not COMPLETELY object orientated -and will never be if it's written in C...

 

It's probably more likely than 5%. Raven did EF in C++, and they switched to straight DLLs, so you never know.

 

...really? wasn't aware of that. OK, I guess there's more of a chance than I think then.

...if the JKA code IS indeed in C++, I'm gonna be a happy man - modding the code will become a far quicker and easier task...

 

Although I have a sneaking suspision that they possibly may have rushed the C -> C++ conversion process (just judging by all the other stuff they had to do in the same time as well...), which would mean the class structure may not be as good as it could be. But we'll see...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...