Best language and framework for a text based game like mafia wars - language-agnostic

Which do you think is the best language/framework to develop a text based adventure game like
Mafia wars? I am proficient in Java/JavaScript and have dabbled in Python, Perl, Erlang, Scheme. Also, any pointers to articles relating to this is very welcome. I am starting from scratch and hence have no constraints. This is a hobby project that I am planning to do to satisfy my coding urge.

The 'best' language doesn't exist.
Try using the one that you feel most comfortable with, after thinking about date structures, functional requirements, possibly the one where you can get the most support in your immediate (person to person) or close (e.g. stackoverflow) environment.

I'm going to try something original here - give Natural language a try.
Inform is a tool for creating interactive fiction (a.k.a. text-based adventures) that features its own language. It takes care of creating the initial "infrastructure" (taking user input, recognizing verbs, that sort of thing) and lets you concentrate on creating "things", "places" and "actions".
Here's a sample, extracted from its tutorial:
The wood-slatted crate is in the Gazebo. The crate is a container.
Mr Jones wears a top hat. The crate contains a croquet mallet.
It looks deceitfully easy, I know. But try it :)
Inform also allows you publish it on The Interactive Fiction Database, as well as export it to a standard Z-machine format (I belive the file extension for this is .z8) .There's even a javascript z-machine interpreter, in case you prefer to host your adventure on a web-page yourself.
Edit: I've found two additional "frameworks" - I don't know whether they use a programming language, or they are completely graphical, I don't use windows: Adrift and TADS 3

I'm a little confused by your requirements; Mafia Wars is a web game, correct? Text adventures, while they can be played on the web (see this article: http://kooneiform.wordpress.com/tag/if-interpreters/) are usually single-player games, a far cry from Mafia Wars.
I think you mean you want to create a PBBG or web game; based on your experience then I recommend a Python back-end with JavaScript on the client-side. One framework you could look into is the Google App Engine, which has Python support, and would be an excellently scalable solution.
Alternatively you can choose one of the many Python web frameworks available. If you'd like a simple place to start, I recommend web.py, which I've been trying out recently and quite like. I've found that combining Python and JavaScript/AJAX with web.py and something like jQuery is a very enjoyable and friction-free way to develop.

Clojure could be a fun option - Lisps are a classic way of writing natural language processing programs and text adventure games are a good example.
Here's a nice little tutorial for writing a text adventure in Clojure.

Just use what you have learn, there no specific programming language to do that kind of application. Just it's more or less easy depending the language
Since you seems to be experienced in Python just go ahead with python! If you don't already made some web project, you should take a look at tutorials and resources on the web.
Good luck!

Related

Where can I learn the basics of writing a lexer?

I want to learn how to write a lexer. My university course had an assignment where we had to write a parser (and a lexer to go along with it) but this was given to us with no instruction or feedback (beyond the mark) so I didn't really learn much from it.
After searching for this topic, I can only find fairly advanced write ups which focus on areas which I feel are a few steps ahead of where I am at. I want a discussion on the basics of writing a lexer for a very simple language which I can use as a basis for investigating tokenising more complex languages.
At this stage I'm not really interested in best practices or optimisation techniques but instead prefer a focus on the essentials. What are some good resources to get me started?
Basically there are two main approaches to writing a lexer:
Creating a hand-written one in which case I recommend this small tutorial.
Using some lexer generator tools such as lex. In this case, I recommend reading the tutorials to the particular tool of choice.
Also I would like to recommend the Kaleidoscope tutorial from the LLVM documentation. It runs through the implementation of a simple language and in particular demonstrates how to write a small lexer. There is a C++ and an Objective Caml version of the tutorial.
The classical textbook on the subject is Compilers: Principles, Techniques, and Tools also known as the Dragon Book. However this probably falls under the category of "fairly advanced write ups".
The Dragon Book is probably the definitive guide on the subject, although it can be a bit overwhelming. Language Implementation Patterns and Programming Language Pragmatics are great resources as well.

Learn and understand the full stack

I have been struggling with an idea for a few weeks and wanted to see if someone can help me out here.
Programming today is full of abstractions, and people who do not understand the abstractions, do not truly understand the reason or design than went into building that abstraction/layer/framework and will struggle as soon as they step outside the comfort zone.
I was wondering if there is a learning resource that goes about teaching programming in an incremental fashion. This will lead to understanding the full stack.
take a small problem
implement a simple solution
talk about the the solution and the designs used
convert the solution into a framework or utility of some sort
now extend the problem space and repeat from step 2.
This way when someone then picks up any framework/library, they can easily visualize the problems the framework is trying to solve, the design decisions taken and the reasons thereof.
[Added to clarify the intent]
Based on the answers and comments below, I want to clarify that I want to move further up the stack. Building your own ORM to understand ORM better, same goes for ActiveRecord, IOC container, data binding, templating engine, and the host of other magic/glue/plumbing we use day-to-day.
Thanks.
Here's what I recommend : Have a brush with assembly (just one book or one month is enough). Have a good strong review of C++ (hopefully it will teach you some of C as well). Now the world is yours. Python is made in C/C++ , Object C is pretty close to c++, .NET is in C++ and C#/VB.NET , The windows API is oriented for C.
I picked C# as my abstract language of choice after this by the way.
Read the source. It is a good idea to build something you want to understand, but you can enhance your understanding of concepts significantly by looking at how something is built. This is especially true for infrastructure pieces (ORM/DI/Templating) which you seem to be interested in.
Get the software to build on your machine, attach a debugger and trace through the code. This is pretty easy for C#/Java with a good IDE. For dynamic languages like Python and Ruby, it takes a good editor and a lot of grepping.
If it is a good software package, it will usually have tests. Tests are a great place to start digging into code. They usually make clear the intent of the code, and also provide you a logical starting point to peel off the layers and actually peek under the hood.
Build a fully functional compiler from scratch in a systems language like C or C++. Maybe it isn't the full stack, but it's a large part of it. This is something I want to do as well. If only I could find the time and space.
The best example of the sort of learning resources I am seeking is the MIX session by Rob Eisenberg on "BUILD YOUR OWN MVVM FRAMEWORK". It goes step by step on explaining the pattern and also implementing it at the same time, attacking one problem area at a time.
http://live.visitmix.com/MIX10/Sessions/EX15
Hope there are more out there.

which web framework gives more functionality for free?

I'm using codeigniter for a little time and I find it really good, but sometimes it's difficult to find pre-cooked examples on the web that will guide me on what I want to do...so my question is which web framework(independent of language) will offer more examples, better tutorials and more resources in general?thanks in advance
Have a look at this wikipedia comparison of frameworks to see what they support out of the box (resources).
As to user base / documentation / useful examples: it depends on code that you can easily read as well. Have a look at:
http://static.raibledesigns.com/repository/presentations/WebFrameworksOfTheFuture-FlexGWTRailsAndGrails.pdf and https://equinox.dev.java.net/framework-comparison/WebFrameworks.pdf also compare frameworks.
I personally use the MS family, and I am satisfied.
I would strongly recommend CakePHP , it has alot of examples and really nice documentation.
It has a very nice way in handling models relationships
I'd recommend you have a look at the following, categorized in no particular order, with their language of implementation and support in brackets. They all present rather clean and novative aspects, but I don't think there's any real silver bullets. Just lots of very nice bullets depending on what you aim for.
The Laureates are...
Lift (Scala, Java)
Play (Scala, Java)
SeaSide (Smalltalk)
Ruby on Rails (Ruby)
Grails (Groovy, Java)
Yii (PHP)
Wicket (Java)
Others
There are other ones, but these were the ones that struck me a blow the first time I saw and experimented with them, and which have - in my opinion - brought some innovation to the scene in general or to their platform in particular.
Note that this isn't to say that some other frameworks may have been equally significant, but I merely list relatively recent and modern ones, and most importantly ones that I will still consider to write a modern web-app (in the general case).
Feel free to look around for more (and maybe add them in comments or edit this answer).
A few notes...
Play is indeed fun to poke around. Yii is the only PHP framework I'd touch with a very long pole (maybe CodeIgniter as well, granted, but I find Yii cooler and less of a hurdle to use and to work through). Rails/Grails are obviously on par. Wicket is something you'd want to consider if you are in a Java shop that's relatively restrictive and doesn't want anything ultra-exotic, but still enough on the edge.
But mostly, I'd recommend you have a look at Lift and Seaside, if you want to see something truly amazingly well thoughout and for the highest feature-per-LOC ratio. (Oh, and it's inspired partly by Seaside and Wicket, and designed by someone who had to work with a lot of (g)rails web-apps, so that sums it up. Plus Scala is an amazing language, granted you can use it and its underlying platform...)
This is an old question, but what the hell, Just came across it...

Programming practice

I've decided to get some experience working on some project this summer.
Due to local demand on market I would prefer to learn Java (Standard and Enterprise Editions).
But I can't even to conjecture what kind of project to do. Recently I had some ideas about C. With C I could to contribute to huge Linux projects. I don't mean that my work will be surely commited. I could get the code and practice with it. But C it's not right thing to get good job in my area. In case of JavaSE there is a chance to develop some desktop applications. But thinking about JavaEE I get stuck. I'll be very thankful for answers.
CodingBat.com will give you good core Java practice.
Project Euler is still the best for all around practice. You can use whatever language you'd like to solve the problems there.
For actual projects, I almost always start on something easy like a Twitter client. It gets you exposure to all the basics along with UI and network communication. You can work up from there. Just don't start with something so overwhelming that you can't figure it out and want to give up. That's not going to get you anywhere.
The best advice is: work on a project that you have personal interest in. Something based on your hobbies, maybe.
If that doesn't work, make a blogging / CMS engine. Or an online photo album. Or an eStore. The world doesn't really need another of any of these things, but it will give you some good practical experience with JavaEE.
Another benefit of "re-inventing the wheel" (for learning) is that you have probably already used systems like these described above, and you have a good idea of how it can work, and maybe you have your own ideas of how it could work better. That can make requirements much simpler, and also will give you a sort of benchmark so you can see how close you can come to building a tool like the "real" ones out there. And if yours is really great, well, maybe release it and see what happens. ;)
There are many Java-based projects on SourceForge. Tinker with one you find interesting.
I've implemented either a betting pool or a Baccarat game in almost every language I've
learned.
This type of software covers:
Dates and times, with calculations
Currency types and things that can be converted to and from currency.
A discrete set of rules that is easy to test
States, transition between states and multiple entities responsible for state transition
Multiple users with different views of the same model End conditions
Multiple player blackjack and poker would work also.
One caveat is that in my day job I work on financial systems and there is a huge overlap
between things to consider when writing a multiplayer game of chance and a trading system.
build an address book. the concept is simple, so you're not stuck on "what" to write. You can focus on learning your chosen language. You get experience in working with a database, java ( insert any language here), and UI design.
when you decide to learn another language you can create the same thing. Since the database has been created already, you can focus on the language itself.
the concept of inputting data, storing data, and retrieving data is central to a lot of applications.
Have a look around http://openhatch.org/ for a project that sounds interesting.

Diversify programming knowledge

I've taken courses, studied, and even developed a little by myself, but so far, i've only worked with Microsoft technologies, and until now I have no problems with it.
I recently got a job in a Microsoft gold partner company for development in C#, VB.net and asp.net.
I'd like tips on how to diversify, learning technologies other than those from Microsoft. Not necessarely for finding another job, I think my job just fits me for my current interests. I think that by learning by myself other languages, frameworks, databases.. I may become a better programmer as a whole and (maybe) at the end of it all having more options of job opportunities, choosing what i'm going to be working with.
What should I start with? how should I do it?
If you're comfortable with C# and VB, learn a language that uses different paradigms. The usual suspects would be Ruby, Erlang, Haskell, Lisp. All of these are available for Windows and other platforms. You might have to get used to different tools to interact with them but that's not necessarily a bad thing.
At the risk of sounding trite, why not install some variant of Linux on a cheap desktop? The mere act of setting up a Linux box is educational.
Once you find your way around it, do some shell scripting and install things like a web server. That should keep you busy for a while. Once you past that, play with some dynamic languages like perl, ruby, python, PHP, etc.
If you're interested in other languages, just pick one and away you go. You sound like you have enough experience to be apt in another language.
If you're looking into a new desktop-development-language then I'd recommend Java or Python, both of which you'd ease into with your C# and VB.NET experience.
If you're looking into web programming, go for PHP?
Browse some source
examples and see what catches your
eye as the most interesting.
Pick up a book on that language.
Ideally, one should know at least one example from each of the major "paradigms":
Assembly (nowadays a dying art, and not that useful)
plain C
one of the OO-variants of C (C++, objective C)
Java or C# (they are very similar, probably no need to learn both)
a scripting language like Ruby or Perl
Javascript (preferrably via Crockford's book)
a non-pure functional language, e.g Scheme (PLT Scheme is a nice learning environment)
a pure-functionalal language like Haskell or OCAML
Erlang (somewhat of a class of its own)
a mathematical/statistical language like R, or J (an APL-successor)
Microsoft technologies aren't bad to start with. My advice would be:
Make sure you aquire sound knowledge about the foundations of programming and the technologies you use. The more basics you know, the more independent you'll be from the latest fads:
Read "Windows Internals" to understand the operating system you're working with. In the process, you will understand other operating systems a lot better.
Toy around with other languages. Learn the differences between statically-typed languages and duct-type languages, functional programming languages, iterative programming languages whatever.
Learn the language you use the best you can. Become John Skeet!
In other words, don't move sideways first. Dig deeper and become better at understanding what you do.
It would be a nice idea to get associated with one the open source programm on http://sf.net. That way you can even have your learning for new platform and also produce some legitimate code. Also you get to look at some good coding practices. Last but not least some giving back to the software community
Maybe think of a project that would be of use to you in your daily life and see if you could develop that in a suitable language. That way you have a goal and at the end of the project you have something useful.
Alternatively why not try learing something not directly programming related, project management might be of use for future roles or do some reading about the history of technology.
These won't add any new languages to your CV but they might add some different aspects to your thinking that might make you a more well rounded potential employee.
I see two main directions to go:
Specific technologies. Select these depending upon how you want to extend yourself, new language (perhaps scripting if you haven't done that, perhaps functional programming), or new techniques (for example, UI programming, or low-level network programming depending upon what you haven't already done), or new OS (Linux if you're a Windows person).
Or, look at higher level problems, for example Design Methods and Team organisation. Read books such as Brooks' Mythical Man Month and Beck's Extreme Pogramming. Consider how to deal with problems bigger that can be solved by one person. Read up on (Rational) Unified Process, UML. Explore revision control systems, Testing techniques, not just Unit Test, but otehr flavours. Think about how you would organise a team if you were the leader. How would the tasks be subdivided, how would communication be managed?