QuakeC learning diary - Witness the artist n00b

QuakeC learning diary - Witness the artist n00b

Postby Julius » 24 Aug 2010, 11:06

Hello world (explanation: programming insider joke ;) )

I have become finally upset that all my game development was ultimately extremely limited due to my lack of coding knowledge :(

So welcome to my learning diary of an interpreted game scripting language!

First of why a interpreted game scripting language and why QuakeC (and not C++ or something more general like that)?
Well programming isn't easy and all I want to do is a bit of game "modding" so anything beyond a game scripting language would probably be too much anyway. Furthermore is is supposed to be relatively easy, there are plenty of code samples and tutorials available, and for QuakeC there is a lively community and a good FOSS game engine ( http://icculus.org/twilight/darkplaces/ ).

An alternative would have been CubeScript for the Engine of Sauerbraten (Cube2), but I have heard it is more limited and there are by far not as many tutorials, code-sample and helpful people around. Furthermore I am not such a bit fan of editing the Cube2 engine (the in-game editor is neat, but ultimately too limited compared to Quake's Radiant).

Ok so much to the reasoning. Why this post? Well maybe someone is also interested in learning, and if I just document how I did it, it will be for sure easier for others too. No promises how far I will get though... I quickly loose interest and my free time is very limited ;) But as a motivation I would like to have as a final goal an updated version of Transfusion ( http://www.transfusion-game.com/ ) which works with the newest Darkplaces release and can be played in multiplayer matches (it's more or less there, so that isn't an overly ambitious goal).
Last edited by Julius on 24 Aug 2010, 15:07, edited 2 times in total.
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC lerning diary - Witness the Artist n00b

Postby Julius » 24 Aug 2010, 11:07

Ok first step: Some links ;)

http://forums.inside3d.com/viewtopic.php?t=1892

This is a good starting point, and I will try to work with these three tutorials first:

QuakeC for beginners 1, 2, 3

http://www.electronicliberationfront.co ... s/tut1.htm
http://www.electronicliberationfront.co ... s/tut2.htm
http://www.electronicliberationfront.co ... s/tut3.htm

Next step will likely be something from here:
http://www.inside3d.com/tutorials.php
But I will keep you hopefully updated.

Oh and I will be using exclusively the Darkplaces engine, as it adds also client side QuakeC (CSQC) which is a really usefull thing for HUDs and special effects etc.
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC lerning diary - Witness the Artist n00b

Postby Julius » 24 Aug 2010, 13:27

Hmm ok this might also be helpful:
http://ouns.nexuizninjaz.com/dev:progra ... troduction

Still trying to set up the dev. environment with Darkplaces... will keep you updated.
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC lerning diary - Witness the Artist n00b

Postby Julius » 24 Aug 2010, 13:38

Ok first you need a QuakeC compiler. The recommended one is FTE QCC: http://sourceforge.net/projects/fteqw/files/QCC/3343/
For windows it includes a GUI/IDE which probably speeds up development. get it here: http://sourceforge.net/projects/fteqw/f ... p/download
There is also Qcide: http://tremor.quakedev.com/qcide.html which is based on the Linux IDE SciTE, but it also only has a window version :(

But since I am doing this on a Ubuntu 32bit OS I will be looking for another IDE that can be used with QuakeC.

Ok there is a quakeC syntax highlighting plugin for Code::Blocks (available though the ubuntu repository): http://svn.icculus.org/*checkout*/nexui ... blocks.zip (detailed instructions in the link I posted before: http://ouns.nexuizninjaz.com/dev:progra ... troduction )

You might also need the Quake1 shareware data for developing: http://www.quakedev.com/files/quake1/quake106.zip
As well as the Quake1 cleaned up QC sourcecode: http://tremor.quakedev.com/Clean_v106qc.zip
I will try to switch directly to Transfusion if that is possible however.
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC learning diary - Witness the artist n00b

Postby Julius » 24 Aug 2010, 20:07

Ok I think I got a working dev setup now:

Code::Blocks with added qc syntax highlighting
Darkplaces with the clean quake source and a shareware pak0.pak (had to boot into windows to extract that, but probably dosbox would work too).
Seems to compile more or less fine with FTEQCC also.
And I already modified it to display "Hello world" (e.g. completed n00b tutorial 1 as linked above).

Happy! :cool:

Ok completed tutorial 2 also... you have to check the capital letters and the " in the example, as those are not accepted by the compiler.

I think thats enough for today... I will be happy playing with my plasma launcher now!
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC learning diary - Witness the artist n00b

Postby Julius » 01 Sep 2010, 00:33

woot, completed third n00b tutorial. had to improvise a bit on the data, as the provided link is long dead, but some stuff ripped from a quake mod did actually work ;)

Lets see what tutorial I will do next...

Ahh health backpacks:
http://www.inside3d.com/showtutorial.php?id=164
Ermm... no explaination and I am not sure if it actually worked :(
Well let's try another: Jumppads
http://www.inside3d.com/showtutorial.php?id=124

Ermmpff... got it to compile, but somehow it doesn't work. maybe because the shareware version doesn't have the entity? gives this error:
"droptofloor at 0.000000 0.000000 6.000000 - COULD NOT FIX BADLY PLACED ENTITY"

Arrg... after initial success I call this a steep learning curve... I can fix compile errors, but it still doesn't work :(
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC learning diary - Witness the artist n00b

Postby andrewj » 01 Sep 2010, 04:10

What's wrong is the coordinates where the jumppad is spawned, it should be not be (0,0,6) but where the player is.

I suspect the origin is not being set correctly by create_jumppad(). Try adding 'pad.origin = self.origin' after the line 'pad = spawn()' and see if that helps.
User avatar
andrewj
 
Posts: 194
Joined: 15 Dec 2009, 16:32
Location: Tasmania

Re: QuakeC learning diary - Witness the artist n00b

Postby Julius » 01 Sep 2010, 09:51

Ahh thanks that actually worked. Strange though that it has a "setorigin(self, self.origin)" function in the item_jumppad function already. Maybe that only works if you place it as a map item? Ahh probably that's the problem.

Thanks again ;) You have programmed QuakeC before? Or was that regular C knowledge?
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC learning diary - Witness the artist n00b

Postby Julius » 01 Sep 2010, 12:27

Found a nice reference manual:
http://pages.cs.wisc.edu/~jeremyp/quake ... quakec.pdf

Lets see what to do next ;)
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC learning diary - Witness the artist n00b

Postby andrewj » 01 Sep 2010, 12:48

Well two things about that code:

1. 'self' refers the current entity, so when create_jumppad() is called it is the player, but when the item_jumppad's think function runs then it is the jumppad entity.

2. setorigin() is a built-in Quake function which does more than just set the 'origin' field, it also links the entity into the map so that it can be seen and interacted with.

I have done a little QuakeC programming, but I'm very familiar with how QuakeC is compiled and executed, since I've used the compiler and execution code as a basis for my own scripting system.
User avatar
andrewj
 
Posts: 194
Joined: 15 Dec 2009, 16:32
Location: Tasmania

Re: QuakeC learning diary - Witness the artist n00b

Postby Julius » 01 Sep 2010, 13:17

Ahh nice to know who to pester with questions in the future then :p

This is a very good introduction to data types in QC:
http://www.inside3d.com/showtutorial.php?id=157
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC learning diary - Witness the artist n00b

Postby Julius » 14 Oct 2010, 07:53

Due to some current limitation's in QuakeC's CSQC implemetation I have decided that it will be more worth to lear Lua for Cubecreate and Löve. Expect a I learn Lua thread here soon ;)
Last edited by Julius on 14 Oct 2010, 12:38, edited 1 time in total.
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Re: QuakeC learning diary - Witness the artist n00b

Postby andrewj » 14 Oct 2010, 09:44

I'm very familiar with Lua programming too, will be glad to help out :)
User avatar
andrewj
 
Posts: 194
Joined: 15 Dec 2009, 16:32
Location: Tasmania

Re: QuakeC learning diary - Witness the artist n00b

Postby Julius » 20 Dec 2011, 20:44

I might get back into this ;)

Recently Xonotic implemented client-side player movement, which was the biggest downfall I had with darkplaces back then (if I remember correctly) and I also really like the way you can run a almost server side mod in Xonotic like done with Overkill right now. Really nice to get people to try and play early development versions of a mod/game.

Besides that... the entire Cube-create Octaforge thing seems not finished enough and there isn't as much sample code as with QC (as well as a similarly big community) so it is rather cumbersome to start with that as a programming noob like me.
“Reality is that which, when you stop believing in it, doesn’t go away.” - Philip K. Dick
User avatar
Julius
Community Moderator
 
Posts: 2913
Joined: 06 Dec 2009, 14:02

Who is online

Users browsing this forum: No registered users and 1 guest