Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Coding a scripting language in QC Goto page 1, 2 Next

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
MauveBib Joined: 04 Nov 2004 Posts: 602 |

Posted: Fri Apr 11, 2008 1:46 pm Post subject: Coding a scripting language in QC |

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 |

MauveBib Joined: 04 Nov 2004 Posts: 602 |

Posted: Fri Apr 11, 2008 2:18 pm Post subject: |

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 |

FrikaC Site Admin Joined: 08 Oct 2004 Posts: 947 |

Posted: Fri Apr 11, 2008 3:03 pm Post subject: |

Doable.

Back to top |

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

Posted: Fri Apr 11, 2008 11:09 pm Post subject: |

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 |

MauveBib Joined: 04 Nov 2004 Posts: 602 |

Posted: Fri Apr 11, 2008 11:44 pm Post subject: |

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 |

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

Posted: Sat Apr 12, 2008 12:25 am Post subject: |

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 |

leileilol Joined: 15 Oct 2004 Posts: 1321 |

Posted: Sat Apr 12, 2008 3:54 am Post subject: |

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 |

frag.machine Joined: 25 Nov 2006 Posts: 728 |

Posted: Sat Apr 12, 2008 4:46 am Post subject: |

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 |

Error Inside3D Staff Joined: 05 Nov 2004 Posts: 558 Location: VA, USA

Posted: Sat Apr 12, 2008 9:45 am Post subject: |

already did with all of Elder vale's npc's although Elder Vale turned into Realms of Quake _________________ Inside3D : Knowledge Is Power Darkplaces Documentation Wiki

Back to top |

daemon Joined: 07 Nov 2007 Posts: 62 |

Posted: Mon Apr 14, 2008 10:38 pm Post subject: |

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... _________________ -daemon [ daemonforge.org ]

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Mon Apr 14, 2008 10:47 pm Post subject: |

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 |

MauveBib Joined: 04 Nov 2004 Posts: 602 |

Posted: Mon Apr 14, 2008 10:59 pm Post subject: |

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
_________________
Apathy Now!

Back to top |

Chris Joined: 05 Aug 2006 Posts: 78 |

Posted: Mon Apr 14, 2008 11:57 pm Post subject: |

http://survivalhorrormaker.ru1337.com same concept, it does indeed work, very simple concept

Back to top |

daemon Joined: 07 Nov 2007 Posts: 62 |

Posted: Tue Apr 15, 2008 5:12 am Post subject: |

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 |

Urre Joined: 05 Nov 2004 Posts: 1073 Location: Sweden |

Posted: Tue Apr 15, 2008 7:53 am Post subject: |

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 |

Display posts from previous:

| 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