I want to create an old school simplistic Text based RPG. No inventory, no fighting, just finding the right way through a dungeon.
There will be a describing paragraph about each "room" and there will be choices depending on the room. IE, If there's two doors, you can choose which to go through, or if there's items you can use them and so on. As you progress, the story unfolds.
I really want to use php for it, since I don't really know alot of programming and I hear that it's an relatively easy entrance for that. I already know enough php to develop for Wordpress, as well.
I really want it to remind people about the old MUDs, designwise i want to be like a terminal or the cmd. The styling is certainly no problem with css, but i'm still not sure about what to use to make the typing feel good, but i'm currently eyeballing tryruby.org and goosh.org to get the right feel.
Any ideas on how to go forth with that? What Do I need to use? Javascript/jQuery? Any good resources for me to look at?
EDIT: Ofcourse, it's online.
Extending #rmorero answer you can use my terminal emulator, so you don't need to recreate tryruby.org look and feel http://terminal.jcubic.pl and use JSON-RPC, you can use my php library for that https://github.com/jcubic/json-rpc
It all depends on your preference.
A quick way to get started would be a html/javascript frontend and a php backend.
The javascript frontend emulates a console, the implementation at goosh.org looks like great inspiration.
Callbacks can be done through ajax, jQuery is pretty useful here.
You could also take a look at Comet if you want to push content (sending content from the server to the client without the client requesting it - or using requests several times).
PHP for the backend sounds good, you'd just implement a script that returns each location, descriptions and possible exists. I'd recommend looking into the JSON format for this, as it will allow you to return an object like:
{
"title": "A dark room",
"description": "This is a very dark and scary room. The smell is obnoxious",
"exits": {
"nw" : " A small door",
"n" : "A huge ladder"
}
}
Php has built in functions to create json objects from php objects, i.e. json_encode.
You probably want some kind of database as well, to store the locations. Here it depends on what you want to use. You can use a traditional sql database (mysql, postgresql, etc), or a no-sql database (mongodb, redis, etc).
You should look into development frameworks for interactive fiction. The two leading development tools for terminal-style games are Inform and TADS, but Quest looks good as well.
If you want to have an even lower entry barrier -- or just don't want players to type in commands, but rather click on alternative choices -- you might want to look into Choicescript or Undum. Choicescript is extremely easy to use and great for writing strictly choice-based text-adventures. For Undum, you need to know some JavaScript, but you can do more things with it. (I extended Undum once to add RPG-like dice rolls, character sheets, etc.) Quest 5.3 introduced a "Gamebook mode", which makes Choicescript-style games very easy to build as well.
I should point out that none of these environments requires PHP or indeed any sort of client-server communication. One advantage of this is that you can distribute your games very easily: a static website is fine, plus your games can be played offline. Potential disadvantages are that you don't improve your PHP skills; that your games are singleplayer only (though Undum games could be made multiplayer with some effort); and that no matter which environment you choose, you are never quite as flexible as you would have been with plain Javascript or Javascript+PHP.
Related
I first learned web programming with php a while back. It has some features that I find very helpful, but the overall language is not something I enjoy, just as a matter of personal preference. I am wondering what alternatives I could use to provide similar functionality using a different underlying programming language (Python? Ruby?).
What I am looking for:
general purpose programming capability
in-line server-side code embedded in HTML (i.e. I want to be able to make my documents pure HTML if desired, rather than demanding special syntax even where I don't want dynamic content)
access to request parameters
ability to send headers, set cookies, etc
Preferably:
does not require a separate server process
easy to connect with Apache
Does anyone have any suggestions?
One thing I tried to do was embedded Ruby (erb) through CGI. This looked like a good fit on paper. Unfortunately, I was not able to get it to work, because I was following a few different guides and the result of combining them did not work out. At any rate, it seems this would not allow me to set arbitrary headers (and more importantly, use sessions and cookies).
Note: I'm not looking for a full web framework at the moment. Just relatively small amounts of dynamic content among otherwise HTML pages.
Thanks!
You've hit on the big reason why PHP is so popular - it has all of those pieces in a server-embeddable package. There aren't really many solutions with its ease of deployment; PHP is written specifically for what you want, which is both its strength and weakness. It's why it's such a weak general-purpose language, and why everyone and their dog knows it. It's everywhere, and the barrier to entry is near zero.
PHP is a language plus templating plus a web framework all baked into one package. To get an equivalent, you're going to need a web framework, even if it's a small one. Something like Sinatra is a super lightweight way to do similar in Ruby, though it requires a separate server process.
You could look at something like Perl with cgi.pm, but it may be a step in the wrong direction if you're wanting something cleaner than PHP.
I don't know Python packages well enough to offer suggestions there, but Twisted makes it easy to bind a Python program to a web interface. That does end up running in its own server process, though.
You'll need to do a little more work than your standard PHP deploy if you want to use something besides PHP, but that's often a choice that people consider to be a reasonable tradeoff for gains in productivity.
Python Flask is a good web framework: it fits your requirements, easy to learn, and scales gracefully. Go through the tutorial to see!
I have three suggestions.
The first is Ruby on Rails - It's pretty fun once you get into it.. I would recommend going through Rails for Zombies to get a general idea of whether you like it or not.
http://railsforzombies.org/
It's really easy to get something up and running on Heroku for free, so you don't have to spend any money to get something up on the web..
My second suggestion is one I'm just trying out called Node.js. I'd recommend watching this video to get an idea of what it's about:
http://www.youtube.com/watch?v=jo_B4LTHi3I
If you're into Javascript, I think you'll get it right away. You can also build an open source Node.js project on www.cloud9ide.com which is pretty nifty too.
A third one, if you're into learning Java, is "Play". A cool video on this is:
http://vimeo.com/7087610
I haven't used this much, but it's on my "to do" list of things to check out. Overall, I suggest just dipping your toes in the water for a bunch of different frameworks and get an idea of how they work and then you'll naturally pursue whatever makes the most sense to you. Good luck!
I'd say given your requirement
Just relatively small amounts of dynamic content among otherwise HTML pages.
then, PHP is going to be hard to beat for getting going quickly and a minimum of learning overhead. It avoids all the CGI issues that you would otherwise have to deal with, and is in fact its own templating language. That's why so many get started with it. Once you get past the point of your goal of mixing a little programming logic into HTML pages, and developing more flexible, maintainable and testable applications, then frameworks such as Rails, Django and others will be worth your time to learn.
Using Scheme as a web development language meets your criteria, with a caveat: instead of inline code embedded in HTML, you have inline code embedded in the Lisp-ish representation of HTML called s-expressions. (There is a one-to-one correspondence between HTML and is s-exp equivalent; they can be interconverted with one function call.) So the static parts of your page and the code share the same syntax - something I really like about Scheme.
> (sxml->xml `(div (p "It's been: " (i ,(current-time)) " seconds")))
<div>
<p>
It's been: <i>1339772791</i> seconds
</p>
</div>
i have long wanted to be a web designer, self taught. My aim for this year is to design a wordpress theme from scratch. i dunno where to start from.
learn photoshop, html, js, php, mysql in which order? where to get the learning resources etc.
what do i need to learn?
any advice will be hugely appreciated...
Are you aiming for designer or developer or both? A designer doesn't neccesairily need to be able to make a fancy AJAX page that does all sorts of mysql things. Mysql isn't needed at all for a designer.
Now if you wan't not only to design the template, but give a complete sollution to you customers your need to do a lot more.
The order I would do it would be:
photoshop / drawing / 'designing' ->
make the actual thing you want to
sell (the image, the 'vision' etc)
Some usability etc: Show your clients why your design is better,
why it's a good page and why your site 'works'
HTML: you can make a mock-up for your site so they can actually click
trough it. You can also sell this as a base for their programmers.
javascript, AJAX etc: You can make your mock-up better like this!
Now you want to sell complete templates (not just the design), you'll have to start learning the ins-and-outs of wordpress templates. that's kinda like a language an sich.
Get some basic PHP skills if you want, cause it can get you out of trouble, but it's not a big amount.
Mysql is only needed if you want to start adding functionality etc, but now you're really talking about a second job :)
In building websites there are different disciplines. In a nutshell:
Designer. Draws the website, how it should look. Defines the style of the website. Uses mainly PhotoShop.
Interaction Designer. Defines where each feature goes and how it should work.
Client side developer. Writes client side code. HTML/CSS templates, maybe a bit of JavaScript, although there is a big difference between HTML and JavaScript and the skills you need. Maybe you should even consider HTML/CSS and JavaScript to different disciplines.
Server side developer. Writes server side code (PHP/ASP/...). Will probably need some SQL knowledge as well.
Database administrator. Keeps the database running. Actually not part of the web-building disciplines list.
So, you need to think whether you want to be all these persons, or just one or a few of them. I personally so mainly PHP development and a little JavaScript. In work, I hardly do any HTML/CSS, because this is done by another guy. If you got a fellow that wants to build websites too, you maybe could check where each others skills lie. If you're a programmer, you can focus on serverside and JavaScript, where he can build the lot in PhotoShop, think about the interactions, and build HTML/CSS. You will only need a little of eachothers skills for sparring, and you could build great things together because each of you has their speciality.
If you need to do it on your own, and you haven't got any of these skills yet, I would just start somewhere and at least try everything. Keep your learning projects simple, and don't start mixing 5 of the names disciplines. If you want to start using HTML techniques, don't mind tha fancy looks yet. Draw a few lines in paint and just pretend you got all these gradients and spiffy looks. With a bit of make belief, if you try one of these skills you don't need any of the other ones.
My question is in bold (see below) but I hope to provide some insight into my issues just in case it helps anyone who could answer my question.
I'm not sure which framework or language is the best for this job but I'd like to make an app that has two or three independently scrollable areas, similar to a 2 column template, that are all dynamically updated. Users can populate each list separately as they go and yah know ... I really don't want the app to move slowly in any way. It needs to be jerky with almost knee-jerk reactions to input.
I've read some interesting things about speeds for each language that I'm considering (php and python - possibly java or ruby) and well, I can't really decide for myself since I don't yet know what's going on to create any slowdowns.
The app would be very simple requiring basic information on a user and letting the user basically grow their own database of lists themselves. Some fancy things would happen on the site per the users input or list updates like color changes or pictures and numbers that change .. maybe a graph or something.
All that said, I hope my question(s) is simple and answerable:
What is a useful programming language and/or framework for making and handling user created hierarchical lists that would ultimately grow in complexity? And how does the language differ from the others for tasks like ones as described in this post?
Just trying to find the right/best/effective tool for this particular job.
By the way, I'm new to programming but have covered the basic tutorials for python (plus some django) and php via youtube mostly - I've got a few books in the queue. be gentle
I don't think you will conclusively be able to decide on a language for your task based on clear evidence of it outperforming others for similar task.
There's too many variables to factor in.
My take is, a well built app, whatever the technology would perform as well as the other one with different technologies, but built well. The difference wouldn't be much to make a fuss over.
Some things that are of note:
The client side code, HTML, CSS and Javascript would need to be top notch. You need to
Combine that with a good host, a nicely constructed and tuned database, a good lean method of communication back and forth between client and server.
Use gzip, caching, minifying and combining scripts, stylesheets, make fewer http requestes,
Architect the application with performance in mind from the get go.
If you are new to programming then the language/framework will be the least of your problems. You tried a little Python and some PHP. Which language did you find easier to grasp? Whichever one that was, pick it and just start writing.
As you work on your project and become a better programmer you can revisit the language/framework debate (although, to be honest, the programmer influences the site performance more than the framework).
I have basic knowledge of PHP and had done a few small personal projects before. Since my programs were small and usually consisted of less than five classes, I jumped into coding right away -- thinking of my database tables and user interface design as I went along. The problem was that I often found myself lost in my own ideas at the middle of my project. Hence, I thought that some form of formal planning would be practical to begin with.
I have been reading several software engineering books lately. One book said that, in web engineering, agile processes such as extreme programming and scrum should be used. I was introduced to tools such as use cases, CRC cards, and UML -- all I believe are too complicated and impractical for the simple projects I have in mind.
On the other hand, a web article I read simply suggested a rough sketch of the UI, a sitemap, and a simple workflow diagram. They seemed practical but too rudimentary and informal.
What would be a practical but formal approach to building a simple web application?
Don't be so quick to discard use cases, or some similar concept, e.g. 'user stories'. The benefit these tools bring is to make you think about what the site needs to do. That can guide all the further technical work, and help you focus on what's important instead of getting lost in interesting but low-value work.
Think about the top n things the site needs to do, and for each of these list out:
the ultimate goal for the user in this particular case
the kinds of people and other systems involved (actors, in use-case terminology)
what needs to be in place before starting this activity (the preconditions)
the basic steps the primary actor needs to perform to successfully achieve the goal
what should happen if one of those steps can't be completed
what the system looks like if the case is successfully completed (the postconditions)
what the system should look like if there were errors along the way
With a handful of these use cases, you can get an overall feel for what needs to be built to fulfill the goals. If it starts to look like too much work, you can look at which goals are of greater or lesser importance, and cut or defer those that provide less value. And if you think of new things the site should do, the existing use cases either:
provide a home for that feature, so modify the appropriate use case to incorporate the feature,
don't provide a home, indicating you missed a use case or discovered a new one, so you should elaborate on it as described above, or
don't provide a home, and therefore indicate the isn't necessary and so you shouldn't spend time on it.
The trick is to pick the proper level of abstraction and formality. Work at a high level, write informally, and you can knock these out quickly. When they're no longer useful (you have most of the application sketched out and are now heads-down working on details), put them aside. When you think of new things, see if they fit. Lather, rinse, repeat.
You have to ask yourself a few simple questions first:
1) Do I want to re-use and extend this code later?
If so, it may be a good idea to use some basic pattern such as MVC (Model-View-Controller) or use one of the many PHP frameworks available. The already established frameworks are more format in their design and how you use it. You could always use them as a basis to design your own as well.
2) Is the site you are making going to grow or change frequently? If the site isn't going to change much you could probably make something very simple and not worry too much about good design principles.
3) Do you want to learn and apply some of the techniques you mentioned? If so, then go to town and try the different techniques and see which ones appeal to you.
These kinds of questions will help you decide how you want to decide you build your website.
Start small, mock up a few simple screens, their database structure, etc. Use whatever method works for you - if that is UML diagrams, then fine. Get something finished, evaluate, and iterate from there.
This may not be quite what you are looking for, but also do yourself a favor and choose a framework such as CodeIgniter to make your life easier writing your server-side code. And similarly, consider using a client-side framework such as jQuery. This will make it easier for you when you are ready to actually sit down and write the code.
The Bare Essentials
I find there is a (roughly) four-step process that make application development a lot easier, and helps me avoid getting lost along the way. I make no pretense about using agile development methods. This is just the way I work.
Decide what the application needs to do. By "need", I mean, absolutely must do and nothing else. If it's a "nice to have" feature, write it down and come back to it later.
Figure out what data you need to keep track of to make everything work. Slugs, titles, datetimes, etc. Design the database. (I use MySQL Workbench for this.)
With your feature shortlist, prototype a user-interface with Balsamiq. Remember to add only the features you need right now.
You might consider doing HTML / CSS templates in this step.
Now that you have the data model and the UI, connect them. Business logic should focus on two things:
Abstract away from the data model so you can easily retrieve and store information from step 2.
Make the UI work exactly as you designed in step 3. Don't get fancy.
Focus on Small Goals
There are two keys to the process. The first is to to separate the design of various components. You don't want to be thinking about implementation details when designing the UI, etc. The second key is to iterate. Focus on exactly what you need to add right now and ignore everything else.
Once you're done, you can iterate and tweak, repeat steps 1-4, etc. But don't get stuck in any step for too long. You can always iterate again later if things don't turn out exactly as you like. (I think agile calls the iteration "sprints", but I'm not up on the theory.)
Practical Considerations
It helps if you have a light framework (at minimum) to assist with 4.1 (ORM, like Propel) and 4.2 (JQuery, etc.). You want to keep both the UI and data access as modular and compartmentalized as possible so it's easy to change later.
If you mix everything into one chunk of code, then you'll have to change every part of the program just to (for instance) add a new column to the database or add a new button to your app. You've had some experience, so you should have an idea of pitfalls to avoid.
I've been googling around for a really simple way of making what is, in effect, nothing more than an enhanced phpMyAdmin.
In a mysql database, I have:
Name, address, phone, website etc, plus 2 or 3 custom fields. This data is pulled out to make a website.
All I want is to be able to make a freeform form, a bit like Access, but for the web, and the only thing I want to do over and above normal field editing would be to have a list of when I contact them, what was said, and perhaps a reminder when the next action is due. It also needs to implement some basic permissions so that different users can access different subsets of the data.
I've looked at so many CRMs my mind is boggling, and they all do WAY more than I need. I don't have leads or accounts, all I have is the need to make sure than when I update the person's details, and for that data to be in the same DB as my site is generate from.
I'm happy to learn if I can get pointed in the right direction, and I have a feeling that something like what I want might lie in the direction of jquery. It's just that there's so much good jquery stuff about, I can't see the wood for the trees!
Thanks.
If phpMyAdmin doesn't quite do it for you, it sounds like you just want a simple little web application.
jQuery is probably barking up the wrong tree. It's just a javascript library. While you could certainly use it to spiff up your little application, it's not going to get you the core functionality you need.
I would just dig in and write a little PHP script that does exactly what you want. Even if you're not very experienced, this would be a great learning project.
There are lots of tools which will generate forms including Phpeanuts, phpFormGen, Delphi for PHP, PfP Studio, FormFields, phpMyEdit (and many more).
I've not looked at Radria for some time - previously, it was more of a CMS/page layout/mashup thing rather than a form generator though.
C.
As has been said, you need to build a web interface.
One simple thing you can use is something like Django's admin panel or Ruby on Rails' script/generate scaffold functionality. If you can run Rails or Django, try those.
If you are tied into PHP, consider using one of the PHP frameworks. I'm no expert on them - some of my PHP-using friends have good stuff to say about Symfony (the alternatives: Cake, CodeIgniter, Zend). A bit of random Googling tells me that Symfony has an admin generator that may be quite like that of Django.
As has been said, jQuery won't do what you need, although you can use it.