Jump to content
Sign in to follow this  
DerekBogie

First Time Javascript Game Maker

Recommended Posts

Hello, I am new to the entire field of computer software development. I am currently a police officer who is undergoing college for a degree in computer science. I have taken a great deal of interest in html and javascript and find this language to be a wonderful language to know. With that being said I am a newb when it comes to correct methods. On my time off i have spent numerous upon numerous of hours coding a javascript, html, game. The game is the classic "Don't touch the walls with your mouse" style game with a better twist. I have spent numerous hours coding in the features and intros etc.... So i only have one level currently complete.

 

Since i am new and cannot find any similar topics to my question i thought i would ask you. My game is not built on canvas. I built it straight on html pages and then jump website pages to different aspects of the game such as level1, level 2, game over, etc.... I know I am doing this all wrong and most or all of you would be like "Don't quit your day job, This is a mess get rid of it" I would kindly request some pointers to help point in the right directions as to "fix" this game setup before i continue or perhaps some pointers on what i should be doing instead. I cannot find any other game that page jumps like mine so i assume it should not be done. Linked below is the actual game i temporarily uploaded for your viewing pleasures. If you request code let me know and i will post whichever code you would like to see. Like i said i am new and just want to do this right if i am doing this wrong.

 

Thanks Derek

 

http://emeraldcreations.site90.com/

Edited by DerekBogie

Share this post


Link to post
Share on other sites

Game design is a complicated field. I can't teach you that in one post. But you should make your program load the entire game on one page. The reason games aren't spread over multiple pages is that the user can win the game by simply typing a URL into the browser.

 

I see slow loading problems, make sure all the images have finished loading before you start the game. This can be done be putting all the game's images into an array and attaching an onload event to the images.

Share this post


Link to post
Share on other sites

I have looked into numerous of ways to implement the entire game on one page but i cannot find a good method. basically the entire game is reloading onto a new page and a localStorage event saves the lives, level, and coins earned. As far as the images i have implemented most of those in html pages as well. I would have to transfer the image variables to javascript into the array as you said first. Like i said the game is a mess and i dont want to pitch it as i think it has a kind of a cool twist.

 

One problem i know i have, There are over 15 pictures with opacity set to 0 that call a loose life function when onMouseOver. This is how i have my bounderies set up for my maze. all of which are initiated by the html file only.

Edited by DerekBogie

Share this post


Link to post
Share on other sites

You can use AJAX to load stage data from JSON files.

 

An important part of building any software is determining what data structures you need and how you'll use them before beginning to build it.

Share this post


Link to post
Share on other sites

I implemented this into javascript, i used a body onload for the index file to load this function, I cleared my history, and it seems to instantly load my images for me now. Thank you for that, that has been bothering me for a while.

var images = new Array()function preload() {    for (i = 0; i < preload.arguments.length; i++) {        images[i] = new Image()        images[i].src = preload.arguments[i]    }}//-- usage --//preload(    "images/titlePicture.png",    "images/cave1.png",    "images/cave2.png",    "images/cave3.png",    "images/cave4.png",    "images/cloud1.png",    "images/cloud2.png",    "images/cloud3.png",    "images/cloud4.png",    "images/disclaimer.png",    "images/easy.png",    "images/finishedLevelFive.png",    "images/finishedLevelOne.png",    "images/finishedLevelThree.png",    "images/finishedLevelZero.png",    "images/gameOver.png",    "images/gameOverTitle.png",    "images/hard.png",    "images/introduction.png",    "images/lives0.png",    "images/lives1.png",    "images/lives2.png",    "images/lives3.png",    "images/lives4.png",    "images/logoGlobe.png",    "images/medium.png",    "images/menu.png",    "images/rules.png",    "images/skip.png",    "images/spikes.jpg",    "images/story1.png",    "images/story2.png",    "images/story3.png",    "images/story4.png",    "images/titlePicture.png",    "images/verify.png")

Share this post


Link to post
Share on other sites

As it would so happen I'm halfway through college getting my masters in Game Design.Which is why I haven't been around recently I've been hella busy. Making games is a highly involved field, so much to the point that if you want to make a great game you need to understand your limits, and never expect that people will turn you down to help. I know that people here, nor your peers in the industry won't have a "don't quit your dayjob" attitude, as most will be more than willing to help. Your bosses however will want to be convinced that you have both the potential and personality to contribute to a team, (that said every game company is unique in certain mindsets).

 

Since you already have a game concept in mind, there are a few typical things you need to have a firm grasp on before you even touch any code, the pre-pro(duction) phase. What do you want in the game, and what skills does the team have (in this case that's just you)? You wanted to do this in javascript and html (since thats what you can use) then its important to know what you can and can't do in javascript; and how this will likely affect what features your game will end up having. Simply using javascript on its own has several limitations as any player with knowledge in javascript can mess with the game state and cheat if they were so inclined. This may not bother you at all but its still a risk you have to understand if you still want to use javascript.

 

Next is make yourself a physical prototype of the game to play as if it were a board game. of course there will be some aspects that a physical prototype can't clarify like the challenge of the game should come from the use of the mouse, but prototyping and play-testing is a tried and true technique to help both you and others in understanding what should happen in the game in certain situations and what else you'll need in the game. Plus, it can give the sense on whether the game might have elements which will be fun to play. from this you can now plan out everything you need to code far before you even code anything. All in the pre-pro stage. now walk through each feature you want in the game and ask yourself how long you think it will take to complete the feature. add up all the hours and divide that by the hours youll spend per week to give you a loose estimate of how long it'll take to complete this game. since you are the only one working on the game and you already have another job, completing even a small game like this during your spare time can take several months.

 

The main reason I'm telling you this is so that you understand that, through these numbers alone and the level of work that goes into any game, that you shouldn't be afraid to ask for any help. Even if you are turned down every now and then. It WILL happen, people will drop out. Two developers just dropped out of our capstone for a game we were planning to release August. and so we compensate by looking for more developers on the campus (due to the workload our school gives we typically expect to only have each game developer for a month or two).

 

TLDR; The game industry is no place for people afraid to ask for help. It is not an environment where you are expected work alone. You will not survive in the industry with a mindset like that.

 

with rant A out of the way....

 

you are already in the production phase using javascript. just continue using javascript but be sure to undertake from training when you can to help you better understand it. No one becomes an expert in any field overnight, but after roughly 10000 hours of learning. so for example, going back to your job as a police officer if you worked 40 hours a week with no vacation it'll take roughly 5 years to reach this expert status. in reality you'll likely have days off or you work more than 40 a week, or you have some talent that shaves off like 1000 hours, but 5 years remains a good estimate for the average person.

 

In any case the people here won't mind helping you train. or with any questions which they would know the answer to.

 

  • Like 1

Share this post


Link to post
Share on other sites

I appreciate your extensive thoughtful reposnse Hadien. I am used to car forums when most members are complete tools and are stuck up. This is the first programming forum ive joined so it's a whole new ball park of new people. I am basically learning as i go, i learned javascript on my own as i couldnt find any classes to support the training until recently. Now im beginning a beginners level javascript course next semester so i should be well prepared.

 

With this game i do not expect anything but immediate friends to be interested in it as simply a nice gesture to me. I am primarily building this game because for every step i take i have had to learn something new. CSS Animation, setInterval timed functions, case statements, localStorage, Audio implementation, and much more about html itself than my classes have ever taught me. I am enjoying making this game just to basically learn as i go even though its currently a coding mess with the multiple pages haha.

 

My current degree that i am going for is software Development (currently associates graduate next month) I plan on continuing to my masters degree but want to make sure i follow the right path, degree, and classes i need to, to go for the job i would like to be in. I love javascript and the way it operates, I learned a little C++ and java but i am still trying to figure those out. Are there any recommendations that you have to further my ability and home teaching methods in game development? I took a game development course in college last year and was very dissappointed that the entire course was based on "gamemaker" with no implementation of script language creation. Some websites that teach you by playing a game, such as "codeavengers.com" may help a litle but it doesnt show me the entire code and how it all fits together. It basically makes me reword one line of code and leaves it at that without showing any other code. Where can i go to learn as a step process to begin developing games with javascript?

Share this post


Link to post
Share on other sites

The best way to learn to make a game is learning programming in general. C++ and Java are better suited for learning real programming concepts than Javascript is.

 

I would suggest learning about object-oriented programming, data structures in general (arrays, lists, trees, hash tables), searching algorithms and sorting algorithms.

Share this post


Link to post
Share on other sites

Ingolme beat me to it.

 

Its better to get more acquainted with object-oriented programming in general and not stay specific to any one language. That said, C++/C# and Java are the dominant languages when it comes to game dev. and much of the fundamentals that you would learn in C++ you can take to many many other languages, including javascript. the other way around is risky as javascript can lull you into a complacent style of programming by relying too much on letting Javascript handle the things you would worry about in other languages. and you may end up having to relearn some fundamentals when you move to something like C++.

 

When you get more familiar with the basics of a language start using frameworks. frameworks save you a lot of work by preventing you from trying to re-invent the wheel and all the bugs that would come with it.

 

Also after you got the basics down, grab books on design patterns so that you can better plan how you'll need to code your games before you even start the coding process, and a better plan makes for faster, more effective coding. Knowing the right design patterns can guide you to making compact, efficient, stable, and flexible programs as well as getting you into the habit of thinking in OOP, and not procedural programming. plus knowing design patterns is essential if you plan on making your own game engine, but that's a long, long way down the road.

Share this post


Link to post
Share on other sites

Thanks for your valuable input, I respect exactly what both are you are saying to help point me in the right direction. I am more vamped to stay on track with java then. I have a java certificate but yet i feel as if i barely even know the beginnings of it. I will continue on my own time to study into it.

 

As for your input on the game itself I have implemented an Iframe on the index page which now runs the game in that window so they can no longer change the url. I appreciate the input it was very easy to do once explained thank you both.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...