Inside3D!
     

Coding a scripting language in QC
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Fri Apr 11, 2008 1:46 pm    Post subject: Coding a scripting language in QC Reply with quote

I've recently had an idea that going to push my QC abilites pretty much to their max.

I want to code a scripting language in QC. Yes, a scripting language in a scripting language.

I want to make all of DiD2's units to be defined in external text files, read in by FRIK_FILE and made available ingame.

I've never really played around with FRIK_FILE much, is it up to the task or should I look at an alternate solution?
_________________
Apathy Now!
Back to top
View user's profile Send private message
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Fri Apr 11, 2008 2:18 pm    Post subject: Reply with quote

I'm thinking something along these lines:

The definition files will contain many lines, each with two "words" seperated by a space or other delinator.

An example file might look something like:

name trooper
model progs/trooper.mdl
type infantry
health 100
standframes 5
walkframes 5
shootframes 3
dieframes 6
weapontype direct
reloadtime 1
weapondamage 25

etc

I'd load the file a line at a time, then have a function to split each line into two strings at the deliniator. Then I'd do a switch/series of ifs on the left string, comparing it to various builtin names, and then set the appropriate flags/variables on an entity, with one entity for each unit type which is then used ingame as a template for creating the units.

Workable?
_________________
Apathy Now!
Back to top
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Fri Apr 11, 2008 3:03 pm    Post subject: Reply with quote

Doable.
Back to top
View user's profile Send private message Send e-mail
RenegadeC



Joined: 15 Oct 2004
Posts: 370
Location: The freezing hell; Canada

PostPosted: Fri Apr 11, 2008 11:09 pm    Post subject: Reply with quote

Reminds me of when leilei wanted me to take 2D Cam and allow plugin characters in a fighting game; essentially Mugen in Quake.
Back to top
View user's profile Send private message AIM Address MSN Messenger
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Fri Apr 11, 2008 11:44 pm    Post subject: Reply with quote

I've done a bit of work and got the basic parser working.

Now comes the hard part of linking the parser to the game. All the units types are currently hard coded, and so I'll need to rewrite quite a lot of the main code.

Once I'm done it'll be great though, because it'll be so easy to create new units. It'll be so easy to use the chasis to create a totally different style of RTS.
_________________
Apathy Now!
Back to top
View user's profile Send private message
RenegadeC



Joined: 15 Oct 2004
Posts: 370
Location: The freezing hell; Canada

PostPosted: Sat Apr 12, 2008 12:25 am    Post subject: Reply with quote

Consider me interested, I believe this'll lead to even greater mod potential; especially for newbies who simply like to tweak values instead of code.
Back to top
View user's profile Send private message AIM Address MSN Messenger
leileilol



Joined: 15 Oct 2004
Posts: 1321

PostPosted: Sat Apr 12, 2008 3:54 am    Post subject: Reply with quote

RenegadeC wrote:
Reminds me of when leilei wanted me to take 2D Cam and allow plugin characters in a fighting game; essentially Mugen in Quake.

I still think you should do this
_________________
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Sat Apr 12, 2008 4:46 am    Post subject: Reply with quote

MauveBib wrote:
I'm thinking something along these lines:

The definition files will contain many lines, each with two "words" seperated by a space or other delinator.

An example file might look something like:

name trooper
model progs/trooper.mdl
type infantry
health 100
standframes 5
walkframes 5
shootframes 3
dieframes 6
weapontype direct
reloadtime 1
weapondamage 25

etc

I'd load the file a line at a time, then have a function to split each line into two strings at the deliniator. Then I'd do a switch/series of ifs on the left string, comparing it to various builtin names, and then set the appropriate flags/variables on an entity, with one entity for each unit type which is then used ingame as a template for creating the units.

Workable?


Yay! Smells like LameScript!

http://fragmachine.quakedev.com/
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Error
Inside3D Staff


Joined: 05 Nov 2004
Posts: 558
Location: VA, USA

PostPosted: Sat Apr 12, 2008 9:45 am    Post subject: Reply with quote

already did with all of Elder vale's npc's Smile

although Elder Vale turned into Realms of Quake
_________________
Inside3D : Knowledge Is Power
Darkplaces Documentation Wiki
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
daemon



Joined: 07 Nov 2007
Posts: 62

PostPosted: Mon Apr 14, 2008 10:38 pm    Post subject: Reply with quote

i did this sort of thing in feral flesh. also made their menus/quests scriptable. everything editable in-game.

my only complaint is that I can't delete files that i no longer wish to use unless i do it manually... Razz
_________________
-daemon [ daemonforge.org ]
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Apr 14, 2008 10:47 pm    Post subject: Reply with quote

I made something somewhat similar in my test csqc mod - q3 animation.cfg parsing, for stealing q3 player models, so definitly workable.
Admittedly I used FTE_STRINGS too to simplify things, but its possible to work around that with FRIK_FILE, its just less efficient to do so. With a file layout of your own choosing, it should be much easier. Don't underestimate parts of KRIMZON_SV_PARSECLIENTCOMMAND either... Depending on how many extensions you want to use.
Really, the only issue with just FRIK_FILE you'll have is finding where to split the lines in an efficient maner. The other two extensions have features that can help make it easy.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Mon Apr 14, 2008 10:59 pm    Post subject: Reply with quote

That's why I decided to keep the format of the file simple, with 2 parts to each line with a space as a delineator. I used FRIK_FILE to go through each line a letter at a time and split it at the space.

It's working nicely, though I still need to link it into the menus etc. Currently the structure of the menus is hardcoded, just taking the unit stats from the external file, but I want to have the menus based on what units are in the external files.

Oh, and I chose .did as the file extension Smile
_________________
Apathy Now!
Back to top
View user's profile Send private message
Chris



Joined: 05 Aug 2006
Posts: 78

PostPosted: Mon Apr 14, 2008 11:57 pm    Post subject: Reply with quote

http://survivalhorrormaker.ru1337.com


same concept, it does indeed work, very simple concept Smile
Back to top
View user's profile Send private message MSN Messenger
daemon



Joined: 07 Nov 2007
Posts: 62

PostPosted: Tue Apr 15, 2008 5:12 am    Post subject: Reply with quote

you could use tokenize to find your first word or command, then strlen it to figure out where to begin your substring for the rest if necessary

even tokenizebyseperator might be useful depending on what you want to do
_________________
-daemon [ daemonforge.org ]
Back to top
View user's profile Send private message Visit poster's website
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Tue Apr 15, 2008 7:53 am    Post subject: Reply with quote

I've done this in the past, certainly doable. I made a scriptable weapons system, one which could be reloaded during gameplay, so you could write changes to a weapon, and supply an impulse in the game to reload scripts.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group