.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Shrapnel Community > Space Empires: IV & V

Reply
 
Thread Tools Display Modes
  #1  
Old July 13th, 2004, 06:54 AM
Ed Kolis's Avatar

Ed Kolis Ed Kolis is offline
General
 
Join Date: Apr 2001
Location: Cincinnati, Ohio, USA
Posts: 4,547
Thanks: 1
Thanked 7 Times in 5 Posts
Ed Kolis is on a distinguished road
Default SE4 Scripting in Python (templatizer again)

This might not sound very impressive, but I just wrote a program that can negate a number...

Why'd you do that, you might ask? Well, I'm working on an expression evaluator. OK, you ask again, why are you doing THAT? Well, this expression evaluator is going to be used in a sort of Uber-Tech-Gridder program which combines the flexibility of editing text files (ask Gandalf Parker or any other Linux junkie ) with the power of something like Krsqk's Component Generator. OK, it won't generate tech *grids* - it will only work in one dimension - but there will be a lot of flexibility; basically you will be able to do what Aaron's promised for SE5 with the SE4 data files - something like this:

code:
Start Level           := 1
End Level := 12
Name := Anti - Proton Beam [level]
Description := Focused energy beam used as a medium range weapon.
Pic Num := 18
Tonnage Space Taken := 30
Tonnage Structure := 30
Cost Minerals := [50 + 25 * level]
Cost Organics := 0
Cost Radioactives := [10 + 10 * level]
Vehicle Type := Ship\Base\Sat\WeapPlat\Drone
Supply Amount Used := 5
Restrictions := None
General Group := Weapons
Family := 2000
Roman Numeral := [level]
Custom Group := 0
Number of Tech Req := 1
Tech Area Req 1 := Energy Stream Weapons
Tech Level Req 1 := [level]
Number of Abilities := 0
Weapon Type := Direct Fire
Weapon Target := Ships\Planets\Ftr\Sat\Drone
Weapon Damage At Rng := [max(15 + level * 5 - range * 10, 0)]
Weapon Damage Type := Normal
Weapon Reload Rate := 1
Weapon Display Type := Beam
Weapon Display := 1
Weapon Modifier := 0
Weapon Sound := apbeam.wav
Weapon Family := 1

And the beauty of my approach is that it will apply not only to Components.txt, but also to Facility.txt and anything else you might want to have leveled items! " src="images/icons/cool.gif" />

Now I know that I'm not easily motivated to work on something past the first night, but I know that this program is something that the SE4 community would greatly appreciate (at least I'd think you would!) so please keep bugging me to finish it! (Or at least release the code so someone else can )

edit: changed topic from "Semi-OT: I just negated a number! (Really, this is interesting! ;-)" to "Math parser ready (not the data file generator - yet!)"
changed topic to "SE4 Templatizer Ready for Download!"
edit: changed topic to "Templatizer 3 is HERE!!!!!"

[ July 25, 2004, 05:52: Message edited by: Ed Kolis ]
__________________
The Ed draws near! What dost thou deaux?
Reply With Quote
  #2  
Old July 13th, 2004, 07:30 AM
Atrocities's Avatar

Atrocities Atrocities is offline
Shrapnel Fanatic
 
Join Date: Dec 2000
Location: USA
Posts: 15,630
Thanks: 0
Thanked 30 Times in 18 Posts
Atrocities is on a distinguished road
Default Re: SE4 Templatizer Ready for Download!

I just program in basic. I hear binary is easy too, but is owned by Microsoft so that is ruled out.
__________________
Creator of the Star Trek Mod - AST Mod - 78 Ship Sets - Conquest Mod - Atrocities Star Wars Mod - Galaxy Reborn Mod - and Subterfuge Mod.
Reply With Quote
  #3  
Old July 13th, 2004, 08:13 AM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: SE4 Templatizer Ready for Download!

Negate a number? As far as I know, a number is an imaginary creation designed to represent Groups or singles of something. ??
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote
  #4  
Old July 13th, 2004, 08:32 AM
Fyron's Avatar

Fyron Fyron is offline
Shrapnel Fanatic
 
Join Date: Jul 2001
Location: Southern CA, USA
Posts: 18,394
Thanks: 0
Thanked 12 Times in 10 Posts
Fyron is an unknown quantity at this point
Default Re: SE4 Templatizer Ready for Download!

Will it support all sorts of funky math? Exponents, sin, custom user defined functions, etc.?
__________________
It's not whether you win or lose that counts: it's how much pain you inflict along the way.
--- SpaceEmpires.net --- RSS --- SEnet ModWorks --- SEIV Modding 101 Tutorial
--- Join us in the #SpaceEmpires IRC channel on the Freenode IRC network.
--- Due to restrictively low sig limits, you must visit this link to view the rest of my signature.
Reply With Quote
  #5  
Old July 13th, 2004, 05:19 PM
Ed Kolis's Avatar

Ed Kolis Ed Kolis is offline
General
 
Join Date: Apr 2001
Location: Cincinnati, Ohio, USA
Posts: 4,547
Thanks: 1
Thanked 7 Times in 5 Posts
Ed Kolis is on a distinguished road
Default Re: SE4 Templatizer Ready for Download!

I'm hoping to basically put in anything that's in the .NET math library, so exponents and sines should be in. As for user-defined functions, I wasn't planning for them, but if you want to add functions, the program is designed to be extensible so you can code them yourself if you know a .NET language such as C# Basically, I have an Expression class with subclasses for all the different types of expressions there can be (unary operations, constants, functions, etc.) and to add a function you'd have to derive a class from one of my base classes and implement its Value property which does the actual computation.
If I ever get this working I'll post it on www.codeproject.com; my main problem is to get the input string parsed out into an expression tree... but I've read about converting to Reverse Polish Notation and that should prove helpful with everything except the functions... and the (non-user-defined) functions shouldn't be too much after that, it's just a matter of getting them to take multiple parameters...
__________________
The Ed draws near! What dost thou deaux?
Reply With Quote
  #6  
Old July 13th, 2004, 06:56 PM
Fyron's Avatar

Fyron Fyron is offline
Shrapnel Fanatic
 
Join Date: Jul 2001
Location: Southern CA, USA
Posts: 18,394
Thanks: 0
Thanked 12 Times in 10 Posts
Fyron is an unknown quantity at this point
Default Re: SE4 Templatizer Ready for Download!

User defined functions are necessary to prevent having to put the same formula code in 700 entries...
__________________
It's not whether you win or lose that counts: it's how much pain you inflict along the way.
--- SpaceEmpires.net --- RSS --- SEnet ModWorks --- SEIV Modding 101 Tutorial
--- Join us in the #SpaceEmpires IRC channel on the Freenode IRC network.
--- Due to restrictively low sig limits, you must visit this link to view the rest of my signature.
Reply With Quote
  #7  
Old July 13th, 2004, 07:14 PM
Ed Kolis's Avatar

Ed Kolis Ed Kolis is offline
General
 
Join Date: Apr 2001
Location: Cincinnati, Ohio, USA
Posts: 4,547
Thanks: 1
Thanked 7 Times in 5 Posts
Ed Kolis is on a distinguished road
Default Re: SE4 Templatizer Ready for Download!

Hmm, that might be doable if I just had a separate functions.txt listing all the functions and what they evaluate to; they'd just be evaluated Last in the precedence order, I guess...
__________________
The Ed draws near! What dost thou deaux?
Reply With Quote
  #8  
Old July 14th, 2004, 05:37 AM

hobospecialist hobospecialist is offline
Private
 
Join Date: Feb 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
hobospecialist is on a distinguished road
Default Re: SE4 Templatizer Ready for Download!

no offense, but that's kinda like my program, i woulda posted it up, but i couldn't, here's the link to the topic:

http://www.shrapnelgames.com/cgi-bin...=011057#000000

btw, only works for non-weap components (i got bored making it, so i stopped)
Reply With Quote
  #9  
Old July 14th, 2004, 05:47 AM
narf poit chez BOOM's Avatar

narf poit chez BOOM narf poit chez BOOM is offline
Shrapnel Fanatic
 
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
narf poit chez BOOM is on a distinguished road
Default Re: SE4 Templatizer Ready for Download!

Quote:
Originally posted by narf poit chez BOOM:
Negate a number? As far as I know, a number is an imaginary creation designed to represent Groups or singles of something. ??
I wasn't trying to be funny, I want someone to explain the topic name.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
Reply With Quote
  #10  
Old July 14th, 2004, 06:13 PM
Ed Kolis's Avatar

Ed Kolis Ed Kolis is offline
General
 
Join Date: Apr 2001
Location: Cincinnati, Ohio, USA
Posts: 4,547
Thanks: 1
Thanked 7 Times in 5 Posts
Ed Kolis is on a distinguished road
Default Re: SE4 Templatizer Ready for Download!

Negating a number means turning 5 into -5, or -3 into 3, or whatever - basically subtracting it from zero.
__________________
The Ed draws near! What dost thou deaux?
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 06:43 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.