tips on making a simple web-based game?

eLiu

Diamond Member
Jun 4, 2001
6,407
1
0
I'm trying to make a super simple web-based game (tic tac toe for example) but I'm not even sure where to start. Like I can write C code + cmdline interface easily enough. But how to set that up w/a gui online is a mystery...

One option would be to like do everything in java & embed an applet. But what are my options for having some C code as the backend? Like I could autogen a new html page every time the board updates but that seems awkward. Would that have to run on the server?

thanks in advance,
-eliu
 

KIAman

Diamond Member
Mar 7, 2001
3,342
23
81
The simplest method would be HTML and some Javascript. No need for server side code.
 

eLiu

Diamond Member
Jun 4, 2001
6,407
1
0
The simplest method would be HTML and some Javascript. No need for server side code.

How hard is it to set up C++ as the backend? I do lots of scientific computing so I know things like C, fortran, etc like the back of my hand. But I know almost nothing about html, javascript, and whatever else.

So I can try to learn some javascript and give that a whirl. But I'm also curious about what it would take to use C directly?
 

Ancalagon44

Diamond Member
Feb 17, 2010
3,274
202
106
Its possible, but you would be wasting a lot of good work done on precisely the problem you are trying to solve. You would be reinventing the wheel rather than simple learn a new language/paradigm.

Play around with Javascript, have fun. The worst that could happen is that you learn something new and add another skill to your toolset. Change your mindset to use the best tool, not just the tools you know. Programming languages are just tools after all.
 

Cerb

Elite Member
Aug 26, 2000
17,484
33
86
Tic-tac-toe can be done with pure HTML. Multiplayer would need a back end, but C or Java would be silly, when PHP will be on most web server, ready to use.

Instead of setting up a backend with clumsy low-level tools like C, learn how HTML and HTTP work, and use clumsy high-level tools like Python, PHP, and/or Javascript :).
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,635
4,562
75
If you really want to write with C or C++, you can. One of the oldest methods for setting up interactive websites, CGI, can do that. I see they mention a helpful library.

But really nobody uses (well, writes their own) C or C++ for websites because they're insecure. It's easy to attack them with buffer overflows and such.
 

eLiu

Diamond Member
Jun 4, 2001
6,407
1
0
Ok, cool. Thanks guys for all the reasons not to even bother trying w/C++ :)

I wasn't against learning something new... more like I wanted to learn multiple ways to do it. But if the C/C++ backend route is by far the shittiest, then by all means I will avoid it.
 

iCyborg

Golden Member
Aug 8, 2008
1,344
61
91
You could also use asp.net - using C# as backend is easy and not uncommon. Or if you don't want C#, there's managed C++ (or c++/cli). I haven't seen native C++ or C with asp.net, but perhaps it can be used. If not directly, maybe with P/Invoke.
Of course, this will limit the server OS to Windows.
 

serp

Member
Aug 4, 2012
25
0
0
php and javascript are very C-like in their syntax.. should be an easy pickup for you :)