Trails ForwardThe New Educational Simulation Video Game at Tufts University Center for Engineering Education2013-06-14T17:01:34Zhttp://sites.tufts.edu/trailsforward/feed/atom/WordPressNicholas Bensonhttp://sites.tufts.edu/trailsforward/?p=252013-06-14T16:37:19Z2013-06-14T16:37:19ZImpact was one of many options available to us among JavaScript game engines. Of course, trying out every single one would be just a little bit insane (there really are a lot of options). So we picked two engines that seemed like they would work well – I had heard of Impact previously, and Dr. Shapiro had heard of the Isogenic Game Engine – and produced a little mockup with either engine to compare them. Ultimately, though both engines were comparable in performance and features, Impact won the competition because of its modularity of design and superior documentation.

Impact has a lot of features that will make our lives as developers much easier when it comes to making games for the web. It has a nice object inheritance mechanism based on John Resig’s Simple Javascript Inheritance. It also splits its functionality into individual modules that can be extended (through the aforementioned inheritance system), included, or ignored as desired. This functionality is extremely useful in a game engine – having a neat and tidy object inheritance system allows a game to avoid a lot of annoying and bulky code duplication, since games often involve lots of objects that are similar to one another in many fundamental ways. Impact gets you started in that direction with its Entity class, which are special objects that the engine is able to manage all on its own, including drawing, updating, and even colliding them and setting up the appropriate callback functions. These entities can be constructed with arbitrary attributes very easily thanks to JavaScript’s powerful typing system (or powerful lack thereof?) in combination with the inheritance system, and even configured with an included level editor to make things even nicer, though our game doesn’t really need one. Long story short, Impact feels like a real game engine for real, big-boy games, and that’s a powerful thing.

Of course, it wasn’t all high frame-rates and handshakes all around at first. In fact, in the initial testing, the Isogenic Game Engine got far better performance in rendering our 128 x 128 isometric map containing data from Vilas County, Wisconsin. The cause was naïveté; where IGE had support for optimized isometric maps built-in, Impact only had its entity system, far more suited to active objects in the game world than large amounts of static tiles. The simple implementation of producing 16384 entities in Impact was definitely not the smart one. Each of those entities iterated every single frame at an attempted 60 frames per second, so even with culling based on the camera position the poor engine was trying to call the Canvas API’s .drawImage() function some 48,000 times a second depending on the zoom level. The solution was implementing a relatively simple caching system (inspired by the system that IGE uses) that splits the map into square sections, draws all of the sections of the map once to off-screen canvases, stores them in memory, and finally draws those pre-rendered sections on the screen as needed. Combined with programmatically reducing the resolution of the individual tile textures, this solution was so optimized that it could handle – granted a hefty initial load time – a map the size of the entirety of our data from Vilas County, approximately 1,300 by 800 tiles in size. (That’s over a million tiles in total!)

Another problem we originally had with Impact was that it was designed with pixel art rather than high-resolution art in mind, so while it’s easy to scale your game by integer factors and get nice-for-pixels nearest-neighbor interpolation, the engine doesn’t support smoother interpolation and non-integer scaling factors out of the box. Thankfully, the Canvas API has its own scaling methods that do support non-integer scaling factors! Since Impact uses regular old Canvas contexts to render things, most of what it took to support a zoom function was simply calling .scale() right before we draw anything to a canvas.

We’ll have to do some fancy things with caching and culling to make a nice-looking, smooth experience in the web environment for very large maps of data. Once we’re ready to start working with dynamic entities interacting with this map, Impact is going to really shine.

]]>0Aaron Tietzhttp://sites.tufts.edu/trailsforward/?p=232013-06-14T16:38:07Z2013-06-14T16:15:40ZAs developers on the Trails Forward project, we are very excited to explore the research and practice of using simulation design to provide unique learning opportunities. Working on a complex, multiplayer simulation that both runs quickly and looks appealing will test the programming and design skills of our team, the abilities of the software libraries we use, and the current best practices of educational technology creation and use. An exciting project for us as developers and researchers, we want the result of our work, and the work of those before us, to be widely accessible. In part, accessible means that the we will prioritize design along with function in menus, game text and images, and other user-facing facets of the game. We consider ourselves lucky to have a talented UX team member to make sure that we never lose sight of this goal. Existing code, design documents, and play testing analysis make for a nice foundation from which to move forward, and we are grateful for all of the thought and effort that has been given to the project so far. We look forward to expanding the existing codebase into a complete simulation that will encourage players to think about their interactions with others in the game environment and the world around them.

The goal of producing an intuitive, realistic, and thought-provoking simulation is one that we do not take lightly. We understand that there will be a lot of hard work ahead with multiple failed attempts at implementing features, and countless revisions. With our focus on the immediate tasks to be done, we nonetheless spend some time thinking about the future. Through discussions about what we believe would give the game longevity and usefulness to others, we have set a goal for the simulation to open source and easily editable by end users. We envision a future where the same Trails Forward client run simulations set in different locations and time periods, each with their own sets of flora, fauna, and player roles and quests. To this end, we have decided that a lightweight, “dumb” web client paired with a modular server program is the best way to go. After testing two JavaScript game engines, we are confident that Impact can be used to produce game visuals that are high-quality and efficient. We feel that the project’s codebase is still small enough, and the promise of an open-source web future bright enough, that the cost of a small delay now is worth the payout later.

]]>0Shriya Nevatiahttp://sites.tufts.edu/trailsforward/?p=182013-06-14T16:41:33Z2013-06-07T21:04:09ZThe Timber Company has separate actions of Harvesting, Yarding, and Transport that are rolled into one total action. Each part costs a certain amount of TP and they can buy upgrades to make individual parts faster or increase their capacity. Players are notified of their current capacity and speed (TP) each time they want to log in a certain area that has been surveyed.
]]>0Shriya Nevatiahttp://sites.tufts.edu/trailsforward/?p=152013-06-14T16:41:38Z2013-06-07T21:02:09ZWhen a player requests that zoning laws are changed for a particular area, players can vote in favor of or against the change. They can also influence the decision using PC (NPCs would “vote”) until the time for that particular law to be modified runs out. The player who requested the change will have it enacted or denied based on the total votes.
]]>0Shriya Nevatiahttp://sites.tufts.edu/trailsforward/?p=132013-06-14T16:41:42Z2013-06-07T21:00:42ZA player who is requesting a service of another player goes through the following process:

The requester posts their request on a public board

The service providers offer the requester to complete their request for a particular cost and amount of turn points (which approximate time) based on their upgrades and abilities

The requester reviews all received offers and chooses one

The service provider completes the action, costing TP and gaining $, from the requester

]]>0Shriya Nevatiahttp://sites.tufts.edu/trailsforward/?p=92013-06-14T16:41:46Z2013-06-07T20:22:06ZTurn Points are an abstract in-game representation of time passing. Some actions cost TP, some cost $ (dollars), some cost PC (Political Capital), and some cost a combination of the three.

Player Actions : Costs : Profits

Logging : -TP, -$ : +$

Surveying : -TP : +$

Building/Developing : -TP, -$ : +$ (once people move in)

Planting Trees : -TP : +PC (e)

Commissioning Anything : -$ : (ability to modify land)

Actions that progress in Game Time but are outside of the player’s control:

people moving into and out of houses

trees growing

animals reproducing or dying or moving habitats between tiles

zoning laws changing

players losing money over upkeep (of companies and assets)

More About Political Capital

PC can be pro-environment (e) or pro-humanity (h). Players can spend PC to make the government change laws in their favor, but PC are more efficient if they are aligned to the goal. For example, if you want to preserve an area of land for an endangered species, it will cost 4 PC (e) but 8 PC (h).

]]>0Shriya Nevatiahttp://sites.tufts.edu/trailsforward/?p=72013-06-14T16:41:50Z2013-06-07T20:09:51ZAfter a great brainstorming session, we have decided on a time model for the game, in two modes: Standard and Classroom.

Standard

112 years in game time

2 weeks real time (14 turns), constant cycle

20 hours is one day, then 4-hour chunk is when simulation happens and game progresses 8 years

Game play happens on a Turn Points scale; once points are exhausted, turn is complete and player must wait until following day to play again

Classroom

same as Standard but 14 turns total; progress when all students in classroom done with a turn (small area, so limited simulation time–less than 5 minutes)

]]>0Shriya Nevatiahttp://sites.tufts.edu/trailsforward/?p=12013-06-14T16:39:17Z2013-06-07T14:43:08ZHere’s a cropped version of a shot of a full map mockup in impact that convinced us we could actually get good performance in the browser.