![]() |
Parser rewrite. Need Feedback! - Printable Version +- Forums (https://www.vdrift.net/Forum) +-- Forum: Project (https://www.vdrift.net/Forum/forumdisplay.php?fid=4) +--- Forum: Development (https://www.vdrift.net/Forum/forumdisplay.php?fid=9) +--- Thread: Parser rewrite. Need Feedback! (/showthread.php?tid=1346) |
Parser rewrite. Need Feedback! - NaN - 09-23-2010 I've been working on the parser to have a more data driven car setup. See http://vdrift.net/Forum/viewtopic.php?t=1351 and http://vdrift.net/Forum/viewtopic.php?t=1378. The syntax is very much shader parser alike(will be merged) having sections and name value pairs. I've separated value pairs (damper-speed, damper-factor) to keep the syntax simple. Code: [aerodevice] An alternative would be: Code: damper-factor = 0.06,1.20 0.08,1.10 0.10,1.00 0.20,0.90 0.50,0.50 1.00,0.30 5.00,0.10 Code: damper-factor = 0.06:1.20 0.08:1.10 0.10:1.00 0.20:0.90 0.50:0.50 1.00:0.30 5.00:0.10 Code: damper-factor = 0.06=1.20 0.08=1.10 0.10=1.00 0.20=0.90 0.50=0.50 1.00=0.30 5.00=0.10 I'd prefer to keep them separated. What do you think? - cologne - 09-23-2010 Quote:I'd prefer to keep them separated.But the logic is: Show a list of pairs of values! White space isn´t a good delimiter for pairs of values. Code: damper-factor = (0.06,1.20), (0.08,1.10), (0.10,1.00), (0.20,0.90), (0.50,0.50), ( 1.00,0.30), (5.00,0.10) Code: torque-curve = (2000, 70),(3000, 74),(4000, 110),(5000, 144),(6000, 177),(7000, 197),(8000, 222),(9000, 253),(10000, 287) Or without comma between brackets? - NaN - 09-23-2010 What about(omitting the comma): Code: damper-factor = (0.06, 1.20), (0.08, 1.10), (0.10, 1.00), (0.20, 0.90), (0.50, 0.50), (1.00, 0.30), (5.00, 0.10) Hmm, the comma delimited list looks more readable. - NaN - 09-24-2010 What do you think about merging suspension and wheel? Right now there have to be the same number of suspension and wheel sections. Code: [wheel] An alternative would be to define the suspension relative to the wheel(orientation) to be able to share it: Code: [suspension] - cologne - 09-24-2010 I don´t like these named references to other datablocks. It logical, hierarchical and i use in my own programming. But tuning a config file, it´s not convenient. Aims: hold data together and define only differences. Another proposal (and fast example): Quote:[suspension-front]Like a cascading stylesheets, the more specific value - suspension-front-left - overwrites the presets - suspension-front - - NaN - 09-25-2010 The named references are a necessity I fear. The idea is to expose the implementation to allow more flexibility. See it as a stupid simple declarative script language. I have actually considered to go towards a Lua or Python compatible syntax to emphasize this. - cologne - 09-25-2010 NaN Wrote:See it as a stupid simple declarative script language. I have actually considered to go towards a Lua or Python compatible syntax to emphasize this.Oh, i love deep complex hash-structures in Perl! But the car-file is the interface to ambitious users. A programming language isn´t the best template! The car-file should simply readable and understandable. Code: [wheel-0] Code: [suspension-0] Code: [suspension-0] Why [coilover-front] and not [coilover-5]? Is "coilover-front" a reference or a keyword? There is no different namespace! - NaN - 09-25-2010 Code: [wheel-0] Yes this sucks(wheel is the type, 0 is the identifier/name). Will change to Code: [wheel] ; object type What if you wanted to describe a 2 or 3 wheeled vehicle or even a 6 wheeled one. Do you propose to have templates for every possible vehicle type, or go back to the previous 4 wheels only configuration. I want to move the complete car declaration into the config files to get rid of the hardcoded load/init code. So there will also be scenenode, drawable, model and light objects(sections). This is going to be too much for the ambitious user I guess. Any ideas? - NaN - 09-30-2010 Wheel graphics(rotating parts): Code: import xs.car The import directive is needed to get front_tire, front_brake, front_left_wheel objects. The scale is mirroring the mesh. We don't support scaling in the scenenodes(it would affect the normals). This means the above code has to be replicated for each wheel for a default car configuration, doh. Looks like a lot of boilerplate code. The good thing is that it could be shared using import. I have to admit that the readability goes down with the number of objects as you have to look for the referenced entities. Any proposals to enhance this are very welcomed. I could compile a list of objects I'd like to expose if there is interest. - NaN - 09-30-2010 We could actually support object mirroring in the scenenodes i think. It would simplify the car setup a lot. Code: [scenenode] Edit: The mirroring has to happen relative to the drawable. Means we need one drawable per wheel(but can share the meshes). Code: [drawable] |