Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / Creating a Tile Engine - Adventure Game System

Author
Message
BuccaneerBob
AGK Developer
14
Years of Service
User Offline
Joined: 18th Aug 2010
Location: Canada
Posted: 7th Mar 2017 21:46 Edited at: 7th Mar 2017 21:47
Hey Everyone,

With EvadeZ now out on Android and iOS, I wanted to move onto something a bit larger scale; but nothing too overwhelming. My final goal is a survival game, I don't want to release too many details too soon. I knew I'd have to make a decent Tile Engine to suit my needs. I knew I wouldn't be able to use exist tools like Tiled just due to the nature of the project I wanted to complete.

Here is what I've created thus far. Right now, it loads the custom .map file (created by my own Map Editor tool) and renders the map very well. I knew I wanted to keep performance optimal, so it takes the screen width and height and divides it by the tile size. It creates the proper number of tiled sprites on the screen and updates the image of each sprite according to the Offset X and Y of the players location compared to the Map File. Thus, at any one time the number of sprites being used are still kept relatively low. I may even consider caching each layer (ground, etc) large chunked textures, I haven't decided yet. It then loads an Object file, which is the placement of all the interactive objects on the map (anything a player can interact with) It determines the depth of each object based on the players relative location (Tile Y) to the Object's Tile Y. If the player is slightly in front of the object, it won't dim, however if the player steps behind a large object, it changes the transparency so you can still view the player.

Here's a video of the engine in action so far.

Robert Janes (Samu Games)
http://www.samugames.com/artifact
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Mar 2017 23:16
I just thought of a suggestion, though I wouldn't be able to help actually do it, but it'd be cool if instead of the whole tree going transparent just a small part of it. A circle around the character would become transparent through the tree. I think that would be possible with shaders, which is why I can't help. I know squat about writing shaders.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 9th Mar 2017 12:05 Edited at: 9th Mar 2017 12:07
There is one option for that... you could just add a second player sprite that totally copies from the real sprite, but have it at 50% alpha, and a depth that means it is drawn on top of everything. Then when the player goes behind scenery you'd still see the player, but a 50% translucent version. It might also be possible to have the ghost sprite coloured, but I haven't tried sprite blending. Say for example you set the normal player sprite to RGB((0,255,255) and the ghost sprite to RGB(255,0,0) - so long as these can be set to an additive blend, you'd have a red ghost on just the pixels that are obscured by the other sprites.

You could make a shader and pass the position of the player to it, so it can do a distance check and fade the pixels when they are close to the player, but that might cost a lot in terms of performance, as each pixel on each sprite would need a square root calculation. The twin sprite method would only mean 1 extra sprite and no shaders, and also would negate the per sprite distance check for the current alpha fade.

Also worth mentioning that a text object might be a decent solution for a tile based map. Text objects render faster than the equivalent sprites, because they all use the same image and the whole text object can be drawn in a single call. You could make a tile map on a fixed grid size, and assign each tile an ascii value then build a text object for your map - effectively a tile set image becomes a font image. I do have a demo of this, shows a lot of layers of text object maps in parallax. One issue with that is you'd be limited by the number of tiles you could have... maybe 100 tiles per text object, to keep within ascii limits - but you could layer them... like one layer for dirt and grass, then another for rocks and small details, another for shadows etc... maybe even allowing optional layers, like snow, or leaves - thinking about a game like Stardew Valley or Don't Starve, where the map changes each season. Heck, you could even have a snow layer gradually increase in opacity. It kinda boils a whole load of sprite commands down to 1 single text command, rather than changing a grid of X by Y sprites, you'd just change a single text object instead.
The code is dark and full of errors
BuccaneerBob
AGK Developer
14
Years of Service
User Offline
Joined: 18th Aug 2010
Location: Canada
Posted: 15th Mar 2017 02:08
Newest Video, some minor bugs to work out but it's coming along

Robert Janes (Samu Games)
http://www.samugames.com/artifact

Login to post a reply

Server time is: 2024-11-24 04:36:45
Your offset time is: 2024-11-24 04:36:45