Revamping Old games and getting back at it!

For discussions about game development that does not fit in any of the other topics.
Post Reply
Zykal
Posts: 31
Joined: Thu Nov 29, 2012 4:38 am

Revamping Old games and getting back at it!

Post by Zykal »

I have some old games I'm looking to rework for fun. Most of them are php3/4 and html. most have no or little javascript at all.

I was thinking of trying to redo them in python but I'm not sure if that would be a good idea.

Before my game was link/page driven and had to reload each action to a new page. Very similar to Halls MMO tutorial.

I want to try to forgo that and keep page refreshes to an absolute minimum, So it looks like I have to get into some sort of client side javascript to make that work.


I've played with javascript very little as most of what I've had to do with work is all backend, not to mention a patched together IT department that revolves around 2003ish.


Anyways looking to get back into playing around in my games again and having some fun.


Thanks!
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Revamping Old games and getting back at it!

Post by Jackolantern »

I can't really say I would suggest learning Python specifically for web development. While it is a versatile language (much more so than PHP) and there are a ton of things it can do, it doesn't bring much new to the world of web development.

If you want to up your JS game, move away from links and page reloads I can only suggest to move towards node.js. Node makes web sockets so easy with Socket.io and web sockets change everything. Suddenly you can make anything from a PBBG all the way up to a real-time 3D MMORPG, all in the browser with nothing but Javascript from client to server.

Python and Ruby do have some basic access to web sockets and are marginally better at them than PHP but they rely on alternative runtimes, such as Event Machine or Tornado that basically run in a similar way to node.js. Node works completely differently to PHP, as there is no real concept of a "page" and your users aren't walled off in separate pages from each other but it does make things a bit more complex. But the pay-off for that complexity is huge.

I still sometimes get temped to pick up Python for Django or Ruby for Rails, but then I can't think of one good reason to pick them up and get into them compared to node. Node does everything they do, plus more.
The indelible lord of tl;dr
Zykal
Posts: 31
Joined: Thu Nov 29, 2012 4:38 am

Re: Revamping Old games and getting back at it!

Post by Zykal »

yeah I figured that'd be were I needed to go. So I have basic JS knowledge i know what node is but haven't used it. I've used Jquery in very limited form. Any advice on where to start out? I went through the code academy JS and Jquery a while back when they came out. But haven't really used it much since then.
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Revamping Old games and getting back at it!

Post by Jackolantern »

I would start with some ExpressJS tutorials. Express is simple enough that you can really learn Express and node itself at the same time. Plus you will be in familiar territory since it is still regular web development. It has been a long time since I worked some intro node or Express tutorials, but this series on YouTube looks pretty good and is fairly recent (within the last year...barely). This is important because any tutorials before the v4.0 release will be difficult to work now, but that change did happen a couple of years ago now. So really anything from the last year will be fine.

Get up-to-speed on using node, npm (node's wonderful package manager), downloading, installing and using some packages through npm, ExpressJS and maybe a couple of other things introduced in the tutorial series before picking up and trying out Socket.io. Probably the biggest hurdle for any new developer coming into node is getting used to the asynchronous nature of node. For example, let's take this fake code:

Code: Select all

console.log("1");
console.log("2);
console.log("3");
dbDriver.makeConnection(connectionString, function(err, result) {
    console.log("4");
});
console.log("5");
While it seems like this code would print:
1
2
3
4
5
...it actually won't. It will print:
1
2
3
5
4

That is because the makeConnection() method call has a "callback function" passed into it, and this callback function won't run until the makeConnection() call has completed. While the makeConnection() call is running, the application continues on to keep processing more code.

It seems strange, but really this is how node gets such great performance and how it survives hosting hundreds or thousands of users on a single-threaded server. And it feels like it would be difficult to compose an application with so much uncertainty of when things will return or even run but it turns out that this model actually works well for the web, game servers and most other socket-based applications as well as many other types of applications.

So check it out and if you need any help, we have some node pros around here who can definitely help you out!
The indelible lord of tl;dr
Zykal
Posts: 31
Joined: Thu Nov 29, 2012 4:38 am

Re: Revamping Old games and getting back at it!

Post by Zykal »

So before I dive into node should I get better at regular JS, seems like most node tutorials already assume you are a master at JS.
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Revamping Old games and getting back at it!

Post by Jackolantern »

You would at least want to get a handle on the basic language. Of course most Javascript tutorials out there focus on JS in the browser and very little of that is necessary in node. All you need are control structures like FOR loops and IF statements, JS object notation, arrays, functions, etc. Just the basic language. Node is done a bit differently from JS in the browser so browser-specific JS isn't needed.

But I guess since another of your goals is to put more JS in the browser, maybe you would be better off studying browser JS first. Once you have a handle on that, you will know everything you need to start working on node.
The indelible lord of tl;dr
Post Reply

Return to “General Development”