This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

MrCohen presents ...


Preview - GreenTreeChronicles

This is a performance test of my code in it's current state. This is a Tile-and-objects engine I wrote to allow the creation of massive 2D game worlds. It's a long term project. For now, it's just a test/preview. I am trying to keep everything I do Greenfoot Gallery compatible, so I test each iteration on here.

Click to move the player. You can pick up, and then put on items. The skeletons are presently paused. There is not much to do except walk around. There are borders which demonstrate the tile collision system, which is similar to what I use in Collider within my AnimatedCharacter class (click my scenarios to find it if you're interested in seeing some of my graphics import and manipulation code).

On my local computer, the game runs at 60 fps (reports 61) consistently. On here, it has little dips, but still runs pretty smooth. I hope to release this one day as a project for my students to learn from, and optionally add content of their own.

1385 views / 11 in the last 7 days

4 votes | 0 in the last 7 days

Tags: None

Your browser does not support the canvas tag.


I do plan to share this! I can offer no timeline, but ultimately I try to share everything I create, for the benefit of my students, and educators and students everywhere :)


❤️ Mr. Cohen is the best


I've designed game-based projects for my classes. When I looked into game design there was so much: Threading, fps, collisions, etc. So in order to scaffold it I turned to GF. Are you using timers for managing fps, or in the act-cycle loop?
A new version of this scenario was uploaded on 2021-01-21 03:17:17 UTC Huuuuuuge efficiency gains ... I think.


Hi Mr Bradley. This uses System time / delta time. Presently working on a slick workaround for the lack of a z variable. Greenfoot can be pretty deep it you want it to be.


Are you using Threads? I look forward to seeing it!


No threads. Just a common timer based on nanotime, to keep things sort of in sync. I don't believe that the Greenfoot Gallery would play nicely with threads (everything gets converted to JavaScript before being displayed in HTML 5) so I didn't even consider that. At it's core there is TreeMap of TreeMaps of ArrayList of GameObject (not as complicated as it sounds - just a way to keep track of objects without having millions of null checks) and a camera algorithm to provide a list of objects near enough to the player to be "drawn." I layer that over a separately managed by similarly timed Tile engine. The thing that's slowing me down is that this is a behemoth of old code! This wasn't a planned project - it started off as starter code for an almost completely unrelated student project (an image manipulation project, where they manipulate a buffered image using 2d array logic) and so each time I add something, there is a lot of backtracking. Having said that, if you send me a message on the Teacher side of this website, I'll send you a link to the code.


Ur students are so lucky to get such a great teacher!


Will u give me ur Facebook id plz


Reached out. Thanks

See all comments

Want to leave a comment? You must first log in.

Who likes this?

mik. SwaggyXiao xiestar0310 Gbasire