• FEATURED

View more

View more

Image of the Day Submit

IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.

Needing to get started with HTML5/CSS3/JS!

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

6 replies to this topic

#1ZippoLag  Members

Posted 03 December 2012 - 09:54 PM

Well hello there! Man it's been a while since I last visited this forums..

Anyway, I know my way around proggramming turn based games with multiplayer on C and C#, but I want to tackle the web monster this holyday season. My goal is to have a working simple (even if not quite finished) turn based tiled "strategy" game by mid january, wich looking at my schedule seems quite doable.

Problem: I only know the basics of HTML and CSS (and fortunately that includes several "good practices" that have not been deprecated in the definitions of HTML5 and CSS3) and NONE JavaScript. Also the simplest of PHP, but I've done nothing more than a "Hello World!" for now.

As for graphics, good ol' colored ASCII characters will do just fine, so you could say I'm aiming at "2D" at the moment (actually it'd be neat if the game would eventually turn into a "full fledged" roguelike, but for now let's assume I'm not being hardcore, I'm just lazy about graphis).

Now, our dear uncle Google has shown me the existence of several interesting topics of discusion (i.e.: the state of html5 implementation, canvas, webgl, css transitions..), as well as the existance of several SDK/frameworks, some of wich are even free and open. But I'd prefer to work purely with code, Notepad++ is a good friend of mine, althought I won't complain if you know any good (free) IDE or other editor better suited for the job.

So.. Any advice as to where to start? Have books on html5 game development been written yet? I tried to look at Mozilla's BrowserQuest code on git but that was of course a bit too complex for me

Big thanks!

Edited by ZippoLag, 04 December 2012 - 11:48 AM.

Posted 03 December 2012 - 11:24 PM

My advice would be to not use HTML5 and JavaScript directly if you can avoid it. I know you said you wish to work directly with code, but the following tools are worth checking out in my opinion:

Game Maker (http://www.yoyogames...amemaker/studio) can produce HTML5 games.

So can Construct2 ( http://www.scirra.com/construct2 )

Baring that there are game libraries such as Crafty: http://craftyjs.com/tutorial/

Or cocos2d: http://cocos2d-javascript.org/

If your goal is to create a game than I strongly advise not to try to reinvent the wheel and to use some existing framework/library/tool as the basis for your game. If you want to start "from scratch" then something like: http://rhuno.com/fla...and-javascript/ may be a good starting point.

Good luck.

Edited by shadowisadog, 03 December 2012 - 11:39 PM.

#3BMO  Members

Posted 04 December 2012 - 12:10 AM

Here are some videos that are a good crash course in JavaScript: http://www.newthinktank.com/videos/web-programming/javascript/
He also has some of HTML/CSS as well.

And this should get you going with HTML5 using Cocos2D: http://www.gamefromscratch.com/page/Cocos2D-HTML-5-Tutorial-Series-table-of-contents.aspx

#4ZippoLag  Members

Posted 04 December 2012 - 07:42 AM

First off, thanks to you both for the quick replies!

Second, indeed, I'm not trying to re-invent the wheel, but merely to implement already proven successfull patterns by myself while also using what I already know. But I have no clue how to implement the game loop in web technologies D:

As I said, I know only very little about web coding, so I'm applying a learning strategy I've found to be effective in the past: implementing a small project as means of gaining extra motivation to learn a new language. That's one of the two reasons I want to stay as away as I can from plugins, frameworks, SDKs and libraries unless they are the current de facto standard and there's no easy way to do whatever I'd want to without them, specially since the technologies are still so young and changing. Also I don't have a budget, this'll be strictly a hobbyst/educational project for myself.

One extra concern I have, of course, is what I should develop the server side mechanics with. Since I could host anything on my PC, but I don't want to leave it running and with open ports just like that all the time, but if I actually end up coding something "pretty" I'd like to leave it playable on the web. That's an extra reason why I'm not using C#/ASP.Net: I know of NO free hosting sites for such technologies, while I've been using some (pretty) decent hosts for PHP and I know of a few really cheap local companies to host PHP sites, altought I only know very little PHP and I don't know if I would be better off learning some other language for (multiplayer/interactive) server side.

A rough schedule for the weeks to come sound like this in my head:

1. Plan thru and define what technology to use.
2. Learn the basics!
3. Experiment!
4. If failure, go back to step 1.
5. Implement simplest version of the game mechanics.
6. Implement "full" single player mechanics, with dumbest/simplest of AI.
7. Add multiplayer capabilities. (this is the point I'd like to arrive at mid January 2013)
8. Polish game mechanics!
9. Implement real AI. (probably not gonna happen until June 2013)
10. See what lies beyond! (probably fiddling with mobile and geolocation)

The mechanics for the game would be fairly simple, as I said, there's no point in describing them beyond the concept of a tile-based, turn-based, single-unit-under-your-command "combat/strategy" game.

If your goal is to create a game than I strongly advise not to try to reinvent the wheel and to use some existing framework/library/tool as the basis for your game. If you want to start "from scratch" then something like: http://rhuno.com/fla...and-javascript/ may be a good starting point.

Good luck.

I'll check that out, and thanks!

Here are some videos that are a good crash course in JavaScript: http://www.newthinkt...ing/javascript/
He also has some of HTML/CSS as well.

Thanks! I'll watch it as soon as I can clear up half an hour in my schedule

PS: I've been checking out the following sites, also, just in case someone ever finds this thread by searching ;)
http://www.html5gamedevs.com/ (seems to be dead at the moment)
http://www.photonsto...g-money-from-it
http://www.html5gamedevelopment.org

Edited by ZippoLag, 04 December 2012 - 10:00 AM.

#5Celiasson  Members

Posted 04 December 2012 - 09:15 AM

Unfortunately I can't help you on where to start, since I know just as much about this as you(I've done a few websites but nothing fancy). What I can do, however, is suggest a nice editor. I used Sublime and I love it. I haven't really used it to its fullest extent, but I really love the layout and the way the editor works.

I have used Notepad++, but I can't really recall why I switched to sublime. I'm not much of use here, but if you try sublime and finds that it makes it easier for you in any way then this post is relevant so I decided to post it.

Good luck with your game, I'd love to see the result!

#6Serapth  Members

Posted 04 December 2012 - 10:05 AM

If you go the library route, there are a ton available. I have recently been working with EaselJS, and other than a few annoyances, its a nice, straight forward and clean library to work with, that doesn't do all the much more than what it needs to, which is nice.

As to coding a game loop in HTML5, that's pretty simple. In an older browser, you used the setTimeoutJavaScript function, which you pass the time in milliseconds to wait between calling the game loop function ( for example, 1000/60 for 60 FPS ), as well as the game loop function itself. In more modern browsers, people use requestAnimationFrame, which works almost identically. Most game libraries use the later, then detect the abilities of the browser and fallback to setTimeout if requestAnimationFrame isnt available.

Over in the game programming forum I posted a math tutorial series, but each example includes a complete application written using JavaScript and EaselJS. It's probably not the best place to start, but does give you an idea of what code looks like, implements an example simple game loop and gives you half a dozen working examples to start with. I would recommend starting with a library like EaselJS, Cocos2D, etc... to get started, then roll your own later if you want to get more into the nitty gritty.

Oh, and check out WebStorm, its an amazingly awesome ide.

Edited by Serapth, 04 December 2012 - 10:09 AM.

#7ZippoLag  Members

Posted 10 January 2013 - 04:47 PM

Hi and thanks for the replies!

I actually read them right when you posted them all, but didn't have the time to reply at the moment.

Just to keep you guys posted (and to inform anyone who is in my same path) I've found those JS videos quite interesting, but the bulk of my learning's now been done in codecademy.com just like the MDN site suggests (https://developer.mozilla.org/en-US/learn/javascript).

I've also been lurking around reading about SVG, since it seems like a nice technology to implement other game idea I have (starting with an Asteroids clone). Sadly I've found none really good sources for this, the MDN site has some tutorials but they are incomplete..

I'm still going with the plugin-less approach!

PS: to anyone struggling and hesistating to learn JS thinking "its a really horrible language! why do we even have to use this?" I highly reccomend watching Douglas Crockford's "JavaScript: the good parts" lectures on youtube, they really changed my perspective regarding this language.

Edited by ZippoLag, 10 January 2013 - 05:06 PM.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.