Tile engines anyone?

Started by abstauber, Tue 30/03/2010 08:44:47

Previous topic - Next topic

Calin Leafshade

Quote from: Crimson Wizard on Thu 01/04/2010 20:55:44
By the way, since we touched this topic here, does anyone know, why this may be that when I create dynamic sprite from file, all colours became screwed?
I tried everything, it seems, like making graphic colour amount match game's colour amount, trying different colour settings in game, etc, nothing seem to help.

are you drawing it on a emtpy room?

try adding a 32bit background to the room

Wonkyth

Khris: I suppose I din't explain it very well, but what I actually mean is instead of the level file being stored as values in text, wouldn't it be better - at least for less complex setups - to store the level as a PNG or something?
The first/last row/column could be used to store non-physical level information(or it could be stored as text for easy reference), and the rest for the actual tile layout.
This would enable you to use an image editor for level creation and the likes, making a near instant level editor.
"But with a ninja on your face, you live longer!"

abstauber

Quote from: Khris on Thu 01/04/2010 19:56:18
Code: ags

ReadDoubleword
BitString
BitStringToInt


Khris: Which library am I missing? Those don't sound very AGS internal ;)

Crimson Wiz: According to Khris' posted function, it does work with .pcx files. Have you tried those yet?


Khris

#23
I might post the complete source code at some point, yeah :)

wonkyth:
Well, I could save the level as image, sure, but by the same logic I could not use tiles at all. Using tiles, all I need is a sprite containing all tiles; this will always be smaller than even one level.

Edit:
Here's a primitive example of a two layer room with walk tiles.


I can save the background, foreground and walkable areas as files, then import them into my MapEditor.
Thus, ProMotion is effectively both a multi layer MapDesigner & PaintProgram. It's also the most professional pixel art program out there. It can't get any better than that :)

Wonkyth

You're still misunderstanding me.
In the level image file, one pixel correlates to one tile, it's type specified by the clour of the pixel.
"But with a ninja on your face, you live longer!"

Khris

Aha!
Now I get you.

The thing is that I'd have to read the pixel's color from the PNG (imported as sprite). Translating the color number into a tile index is really uncomfortable; plus I'd have to use multiple colors to store mirroring.
(I spent half an hour once finding the right way to translate the color number into RGB values.)

It's nice and clean as opposed to storing huge chunks of array setting codes in modules though.

abstauber

#26
Hey Khris, one thing that came to my mind: can you somehow store tile attributes inside that map file ( e.g. a tile being deadly) ?

In my ascii maps I only have one character to map a certain tile, like '-' being a regular floor and '~' being a water. Everything else is currently mapped by hand..

Khris

Creating the levels using layers in ProMotion makes it possible to add all kinds of additional data to maps.
To add deadly tiles, you'd simply add a layer that uses a blank tile and, say, a purple tile. Then you'd fill all deadly areas using purple tiles and export the map.

I'm planning to have a map editor that can then be used to refine the level design, but the bulk of the design work is supposed to done using ProMotion.

Once I've imported a GBA tile map into the AGS program, I can simply save the game. Thus, every save game slot will eventually hold one level. When I want to change something, I simply restore the level's savegame, then reexport the level as a code text file.

So I'll probably not use a ProMotion layer for exits or other data that only very few tiles will have.
Thinking about it, I guess handling only the two graphics layers in PM is best, as long as the map editor is comfortable to use.

The main benefit is being able to design two visual layers at once.

Khris

#28
Phew, took me a few hours...
And ProMotion suddenly crashing on me constantly didn't help.

Features so far:
-imports GBA tile maps (name + name_fg, example included)
-foreground and background tile layer can be edited (big crosshair, x & y to flip)
-scrolling (hold right mouse in tile mode)
-all types of Chrono Trigger solidity tiles implemented (mousewheel to change type, right-click to delete)
-1, 2, 3 to enable/disable layer visibility, 0 to reset

http://shutupload.com/dl/ac06163fb178/

I'm seriously hoping I'll manage to stay on track this time...

abstauber

Phew, that's pretty impressive :)
I like the scrolling - I thought of using sliders somehow, but the right click works great and intuitive.

Also having all those tiles being loaded from an external file is totally cool. I wonder if this affects the performance in any way.


A slight bug: the map designer crashes if I click on the map region before selecting a tile the first time.


Khris

#30
Yeah, I actually found that one immediately after uploading it, corrected it, uploaded again and only just now saw that I forgot to re-zip it and uploaded the old archive twice :D

What do you think of the way placing the different small square and triangle solidity tiles is handled? I came up with that spontaneously and liked it so I kept it. Or is it to fiddly?

abstauber

Hehe, well it feels quite DOSsy :P In other words: if you know how it works, it works pretty good :)
But I wonder if you'll just allow keyboard movement, because for mouse-movement you'd need some sort of pathfinding inside AGS-script (of course you know that too, I'm just curious ;) )




Khris

Tile-based path finding isn't that hard, I'd just have to implement a simple A*.
It might get hairy in narrow passages between triangles though.

Luckily I don't plan using mouse movement; everything is supposed to be controlled via keyboard/joypad eventually. I want to stay as close to the old SNES-RPGs as possible.

abstauber

Hey guys,
currently I'm at a point where ascii-map files become somewhat limited.
I suppose doors and hotspots are just another overlay/layer in ProMotion, as well as other attributes.
But I wonder  how you manage tile animation? Right now, I'm doing it "by attribute", but of course I'm still using sprite slots so I know which sprite belongs to which frame.


Scarab

Sorry abs, can't really help you there, haven't got to animation yet.

However, this thread has re-kindled my interest in mine, and I'm back at the exporting to file problems that stopped me originally. (I thought posting here would be better than starting a new thread).

Basically when I store something in a file, I get odd symbols in there as well, part of the String syntax, I would assume, and I would very much like for them to.. not be there.

My current solution is to copy-paste the whole thing into Room_Load(), and extract them manually using the find and replace functions, but ideally I would like to be able to access scripts from outside the game file. Would I be using the wrong commands? I'm using WriteString and WriteRawLine.

I would also like to know if there's any way one could make the exported files unopenable/uneditable, so no-one can edit maps to get rid of enemies or remove a door or something.

peace
Scarab

abstauber

#35
As far as I understand the manual, File.WriteString(string text) and String File.ReadStringBack()
use a custom file format. So if you use this pair, your file should become uneditable for texteditors.

File.WriteRawLine(string text) and String File.ReadRawLineBack() on the other hand use a plain textfile.

Could it be that your file troubles result in mixing these two pairs of functions?



edit
@Crimson Wizard
QuoteBy the way, since we touched this topic here, does anyone know, why this may be that when I create dynamic sprite from file, all colours became screwed?

That's most likely because you're using a blank room. Just import a black 320x200 bitmap as background and it works. I've tested it with .bmp and .pcx.

Wonkyth

Or, again thinking of using an image, you could have the levels built in as a sprite, and can compare the colours with that of a KEY image, which would simplify the reading of colours...
"But with a ninja on your face, you live longer!"

SMF spam blocked by CleanTalk