SunQuest
           Game Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesGame Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old October 22nd, 2007, 10:43 AM
Programatorul Programatorul is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 18 Programatorul User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 36 m 52 sec
Reputation Power: 0
Should I write a parser?

Hey there, here's my dilemma: i have to write a small, web based, multi player game. The technology is not yet decided but it will either be (php+some c++ daemons) or (java).
What is special about this game is that will have to run a lot of programmed tasks. For example, at the hour 14pm it will have to:
- grant all players 10gold
- move them 1 square to the left
- bla bla
These tasks have to be highly customizable, so I'm having some trouble trying to find a suitable storage method for them.

I then thought that writing a language + interpretor/parser for it it will solve a lot of problems and it will offer considerable advantages not only for programmed tasks but also for gamemaster usage etc, player defined triggers and maps etc.

But a parser is a big task and will drive me deep into Automata theory. I want to ask you if it's worth it. I would be willing to make the efforts if it will help me in the future (lets say... for bigger games).

How about the quick method? Have you cammed across this problem? How have you solved it?

I'm eager to hear your opinions.

Reply With Quote
  #2  
Old October 22nd, 2007, 12:14 PM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,784 Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 4 Weeks 18 h 2 m 3 sec
Reputation Power: 437
You say "These tasks have to be highly customizable", I do not think you'd be able to find a premade system designed to store this type of info, if it were up to me I'd write a small parser, it doesn't have to be very large, you can make it accept x amount of different types (of actions) or an unlimited amount, but then the user has to create a schema for it, or something along those lines. The easiest way would be to just do a simple one at first and see where it gets you.
__________________
Miscellaneous Software
Viper_SB
Developershed E-Support


Anyone else play chess?
Challenge me

Reply With Quote
  #3  
Old November 30th, 2007, 01:43 PM
kubicon's Avatar
kubicon kubicon is offline
pogremar
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Location: At Work
Posts: 945 kubicon User rank is Corporal (100 - 500 Reputation Level)kubicon User rank is Corporal (100 - 500 Reputation Level)kubicon User rank is Corporal (100 - 500 Reputation Level)kubicon User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 14 h 50 m 47 sec
Reputation Power: 7
I dissagree with Viper. PHP and C++ are very versatile languages. I'm sure you can accomplish what you need with them.

I started wring a compiler, which, of course, includes a parser, 3 years ago!! I still have 2 years to go (in my estimate). Now, I'm not as smart as most people, but never the less, it's an involved task. I wouldn't recommend it unless there's an absolute need for it.
__________________
Some day I'll create a smart quote to put here.

Reply With Quote
  #4  
Old December 1st, 2007, 02:53 PM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Psycho Canadian
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jan 2001
Location: Canada
Posts: 4,784 Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Viper_SB User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 4 Weeks 18 h 2 m 3 sec
Reputation Power: 437
I never said they weren't versatile languages, where did I even mention the language type?

Reply With Quote
  #5  
Old December 1st, 2007, 11:55 PM
tagmanadvance's Avatar
tagmanadvance tagmanadvance is online now
Kage Bunshin
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2005
Location: The Seven Seas Of Rhye
Posts: 766 tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 3 h 35 m 46 sec
Reputation Power: 184
Send a message via AIM to tagmanadvance Send a message via Yahoo to tagmanadvance Send a message via XFire to tagmanadvance
I am just going to make some assumptions here, so if I am wrong let me know. Since it is an online game, it will be using some kind of database. If this is true, then no matter what language the server is written in, you will be able to modify the database. This assumes the server is using apahce; I would would write a php script and attach it to a cronjob for each of the tasks you described. When the database gets updated, no matter what language the client is written in, will also be updated, if you design that way.
__________________
"Java makes impossible things possible, but makes easy things difficult." - Somebody

Reply With Quote
  #6  
Old December 2nd, 2007, 03:20 PM
Schol-R-LEA's Avatar
Schol-R-LEA Schol-R-LEA is offline
Commie Mutant Traitor
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Location: The People's Republic of Berkeley
Posts: 1,076 Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 6 h 47 m 14 sec
Reputation Power: 443
EDIT: I just noticed the date of the original posting. Chances are, this issue is long dead. Oh, well.

It should be pointed out that there are any number of parser generators for both Java and C++, and the parsers they generate are likely to be more efficient than a hand-rolled one for any but an expert on the subject.

Or you could use an embeddable scripting language like Lua, Guile or Jython and not have to worry about writing the interpreter yourself. While I personally like Guile (or rather, Scheme, which is the language Guile is based on), I expect that Lua would be the best choice, since it is already widely used for game scripting. The main advantages of Jython are that a) a lot of programmers already know Python, and b) it can (IIUC) run inside a Java applet on the client side, whereas the other two would be server-side only.

However, this whole issue doesn't really address some important questions. You may wish to have a scripting language for the game (that's a really good idea, in fact), but you still need to provide the primitive game elements which the scripts perform. Scripting means that you don't have to build as much into the game engine itself, but you still need the basic operations which the scripts use. From what you've said, it sounds like most of these are in fact in place already, but you do want to give some serious thought as to what has to be primitive and what can be scripted out of those primitives.

It also occurs to me that of the two implementation strategies you've mentioned, one of them (PHP and C++) is entirely server-based (unless you use an ActiveX control or something similar), while the other could be either entirely server based (servlets and/or JSP) or have an active client as well (applets). Is there anything which you may need an active client for in this game? That is to say, are there any parts of it that should run independently from the server, or for which messaging from the client to the server and back would present a considerable overhead and lag?

To give you an example of what I mean, most games involving any animation - moving an icon around a map, for example - would want some sort of client to perform the animation, rather than have to refresh the entire page just for a single move. The usual method would be to have a standing socket between the client and the server, which they can pass messages through without going through the HTTP server. On an action, the client sends a message to the server informing it of the intended action, then the server sends back a message either confirming or denying the action. In the meanwhile, the client will usually go ahead and render the updated action (though if it is a turn-based game, it may wait for the confirmation to go ahead and display the new screen). If it is denied, the client can back out of the action and give the appropriate response instead. This means that only those smaller messages are passed over the network, rather than a whole updated screen, and the client scan actually do much of the work rather than overburdening the server.
__________________
Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
#define KINSEY (rand() % 7) λ Scheme is the Red Pill
Scheme in ShortUnderstanding the C/C++ Preprocessor
Taming PythonA Highly Opinionated Review of Programming Languages for the Novice, v1.1

FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov

Last edited by Schol-R-LEA : December 2nd, 2007 at 04:12 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesGame Development > Should I write a parser?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway