Discuss Scratch

turkey3
Scratcher
1000+ posts

Python - Server-Side and Games?

Something confuses me about Python. I thought Python was a server-side scripting language like PHP, but it seems one can make and run games in Python. This doesn't make any sense - do these games run in the web browser, as an app, or what? Since when does a client computer interpret Python?
CatsUnited
Scratcher
1000+ posts

Python - Server-Side and Games?

Python is an offline language AFAIK, but it can send requests to the internet.
Firedrake969
Scratcher
1000+ posts

Python - Server-Side and Games?

https://www.python.org/about/apps/

So like C/C++/C#, or like PHP.
Or R if you want it for stats and stuff, I guess.
ChocolatePi
Scratcher
1000+ posts

Python - Server-Side and Games?

Almost all real programming languages can set up a server and respond to requests being sent to the server. So that means you could make a web server in Perl (although I recommend you don't!) and make some sort of parsing system to embed it in your HTML.

So basically, every programming language can be a server side language, but that doesn't mean they all should be.

And yes, Python can be used to make games. I'm using it right now to make a Scrabble game, in fact, and it's going well (better than expected)!

Last edited by ChocolatePi (Sept. 16, 2015 12:45:46)

__init__
Scratcher
1000+ posts

Python - Server-Side and Games?

ChocolatePi wrote:

And yes, Python can be used to make games. I'm using it right now to make a Scrabble game, in fact, and it's going well (better than expected)!
Ooh, can I play it when it's done? I've been looking for a good one
ChocolatePi
Scratcher
1000+ posts

Python - Server-Side and Games?

__init__ wrote:

ChocolatePi wrote:

And yes, Python can be used to make games. I'm using it right now to make a Scrabble game, in fact, and it's going well (better than expected)!
Ooh, can I play it when it's done? I've been looking for a good one
Sure. Probably won't be for a few weeks
Ethan_1
Scratcher
100+ posts

Python - Server-Side and Games?

Python, at least the Python from python.org, is server side only. However, your webpage can send requests for data to the server. To make things even more difficult, there are things like Brython (http://www.brython.info/) which allows you to write python-like code that runs “client side” or only on a users computer (server sends code to your browser, all computation happens on your computer). If your interested in making games for a website, I would first suggest that you learn javascript, which is a pre-cursor to doing anything for client side programming. If you really want to use Python, you could use Brython. There is a “port” of pygame, the popular python game suite for brython.
BookOwl
Scratcher
1000+ posts

Python - Server-Side and Games?

Ethan_1 wrote:

Python, at least the Python from python.org, is server side only. However, your webpage can send requests for data to the server. To make things even more difficult, there are things like Brython (http://www.brython.info/) which allows you to write python-like code that runs “client side” or only on a users computer (server sends code to your browser, all computation happens on your computer). If your interested in making games for a website, I would first suggest that you learn javascript, which is a pre-cursor to doing anything for client side programming. If you really want to use Python, you could use Brython. There is a “port” of pygame, the popular python game suite for brython.
Except that is not quite true.
First, let's define some terminology:
Server-side: A program that runs on a server.
Client-side A program that runs locally on the clients machine.
Web app A program that runs in the context of a web browser.
Python is client-side and server-side, but is not a language for making web apps.
Firedrake969
Scratcher
1000+ posts

Python - Server-Side and Games?

Definitions of server-side and client-side as regards web development means that Python is primarily server-side (unless you use a py to js converter or something like http://www.skulpt.org/ but in the end it's JS anyways)

Python is used for the server-side capabilities of web apps.
https://en.wikipedia.org/wiki/Web_application
http://spin.atomicobject.com/2015/04/06/web-app-client-side-server-side/
It involves both client-side and server-side - the client-side just is the part you interact with.

Basically, Python's good at server-side capabilities for webapps and running on your local machine, but it's not the best choice for client-side stuff.

Last edited by Firedrake969 (Sept. 17, 2015 12:37:02)

Powered by DjangoBB