Contact Form

Name

Email *

Message *

Friday, November 20, 2015

Javascript Canvas saves a Puzzle

Through the coding of the puzzle game in the original language of Python, certain complications were discovered. These primarily were in adapting the application to not be packaged as a downloadable app, but rather as a game that would function on the website. It was quickly discovered, with some heavy research, that Python does not like to have this sort of webpage functionality, and thus there was a shift towards using Javascript. This proved to be less of a challenge than expected, as this language was easily supported by HTML5. It was discovered that the Canvas functionality in this language suited the puzzle's need perfectly. The Python code that was developed was adapted easily, though some was thrown out all together as more efficient and less-costly alternatives were discovered in Javascript. (Drawing on Canvas)

(Canvas Sketch JS)


The Javascript Canvas is a DOM element, which allows for styles and positions of objects to be displayed on a webpage. This is similar to the other type of DOM, a SVG, or Scalable Vector Graphic. A Canvas is similar, but different in that it needs to redraw the image graphic every time it is modified. This can allow for functionality such as moving an object, painting, or any similar methodology. A canvas is made using the canvas tag, <canvas>. (HTML Tag) Commonly used for webgraphics is the "2d" design for canvas, though "webgl" can be used to support 3D graphical elements. For this project, 2D is the main focus as that mainly suits the needs of our puzzle games. Different elements can be manipulated using the canvas; such as the fill color, which can be used to set the color of a drawn object or background; or even the stroke, which can manipulate the size and width of a line or outline. Text may also be displayed as pixel data, on a canvas. The canvas can even serve to host animations, drawing each frame, as coded in the Javascript. (Drawing on Canvas)

For this project, mainly what is being focused on is the ability to move images, and have objects in the foreground and background. With this functionality implemented, the puzzle can be modified by the Green-Ninja engineers in order to host any storytelling and riddles that they view fit for the ultimately finished version of the game. 

(n.d.). Retrieved November 20, 2015, from http://hawksworx.com/images/sketchjs.png

Chapter 16 Drawing on Canvas. (n.d.). Retrieved November 20, 2015, from http://eloquentjavascript.net/16_canvas.html

HTML Tag. (n.d.). Retrieved November 20, 2015, from http://www.w3schools.com/tags/tag_canvas.asp






Monday, November 2, 2015

Why Python for Game Design

Python is the choice language being used for the development of the Green Ninja Project. Other languages have been considered, but a static language has its limitations when compared to a scripting language such as Python. One of the main advantages of this language is that it can incorporate C/C++ code in order to enhance and automate production. (Game Scripting)

The limits of a language such as C++ stem from the fact that this language emphasizes run-time speed, rather than the features of the application. Sometimes there must be sacrifices to run-time in order to have the functionality that is desired. C++ also has the disadvantage of being static, which can infer that the coding process of the game being developed will take significantly longer. This is due to the complex functions that must be developed for potentially a single function call. (Game Scripting) C++ has the benefit of being an overall faster language when using floating pointers, in comparison to Python. However, the speed of modern computers effectively negatives this positive when comparing the extra work and time that would be spent adapting the same code in C++ from Python.

https://academy.zenva.com/wp-content/uploads/2014/09/Python-Game-Development-Create-a-Flappy-Bird-Clone.jpg


One of the main reasons to use Python in an environment, such as game development, is that all of the created objects have their memory allocated. Unlike in a static language which requires the freeing of memory,  there is no worry that bad allocation can cause other issues with memory down the line of the development or deployment of a product. Python also has easy integration of both C++, as well as HTML. This can allow for web apps, or in this case, games to be hosted on a webpage. In order for Python code to be executed on a HTML page, there needs to be a Common Gateway Interference, or CGI, that will serve as a bridge between the program and the server. (Use Python) From there, the standard MVC (Model View Controller) method can be applied in order to interface the application with the webpage. (Use Python) With these tools at the disposal of this language, Python becomes a very versatile and powerful language that has the ability to integrate high-level functionality while maintaining a simple-to-use coding environment.


https://i.ytimg.com/vi/CErDowuFclY/maxresdefault.jpg

Dawson, B. (n.d.). Game Scripting in Python. Retrieved November 3, 2015, from http://www.kaiyuanba.cn/content/develop/Game_Scripting_in_Python.doc

Kubica, M. (n.d.). HOWTO Use Python in the web¶. Retrieved November 3, 2015, from https://docs.python.org/2/howto/webservers.html