Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Mappy tilemap engine playback library port for SFML  (Read 41608 times)

0 Members and 1 Guest are viewing this topic.

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
Mappy tilemap engine playback library port for SFML
« Reply #15 on: April 26, 2010, 03:51:19 am »
Quote from: "Walker"
Tiled is good, but this is the SFML Mappy thread. Placing objects with Mappy really isn't very difficult to work out. AFAIK, Tiled doesn't already have map loading code for SFML.

I don't think switching to Tiled would be a good move at this stage, you're bound to run into just as many issues with that plus you would have to rewrite everything.


Of course SFML doesn't have map loading code for Tiled, that's what I'm suggesting, otherwise you don't have to do anything.

Mappy is closed source so you cannot quickly adapt it to your engine, it will always be a generic map editor and you have to write external converters/tools if you want more.

Breakman79

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Mappy tilemap engine playback library port for SFML
« Reply #16 on: April 26, 2010, 04:39:45 am »
WitchD0ctor, the BG Transparency flag doesn't do anything in SFMLMappy.  It was a trigger in DrawMapBGT to do a masked_blit instead of a regular blit.  

Only thing I can think of off-hand is that you are using the wrong color for the area you want transparent.  When the map is loaded into SFML all of the tiles are converted to 32-bit images with alpha channels.  For an 8-bit tile the palette color 0 will be converted to alpha 0.  15, 16, and 24-bit tiles use magenta 255,0,255 for alpha 0, and 32-bit images are left alone and use whatever alpha is already set in the image.

If you really need a hand you can upload the map and I can take a look at it to see what you're trying to do.


Ashenwraith, actually I have looked at Tiled and another one which I've forgotten when I first thought about porting a playblack library to SFML.  I went with Mappy since the Allegro playback lib was the easiest to port since I used to program in it.  Personally I like the Tiled editor interface better, Mappy is a bit clunky in a way and someone would need WINE to use it on a linux/mac box.   I do like that Mappy stores all of the tiles in map file where this program keeps them in a separate tilesheet.  You can't create animated tiles and It looks like tile properties are user defined.   It wWould be a lot of work to use an XML parser to build out a container to hold all of the map data.

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
Mappy tilemap engine playback library port for SFML
« Reply #17 on: April 26, 2010, 04:46:21 am »
Quote from: "Breakman79"
Ashenwraith, actually I have looked at Tiled and another one which I've forgotten when I first thought about porting a playblack library to SFML.  I went with Mappy since the Allegro playback lib was the easiest to port since I used to program in it.  Personally I like the Tiled editor interface better, Mappy is a bit clunky in a way and someone would need WINE to use it on a linux/mac box.   I do like that Mappy stores all of the tiles in map file where this program keeps them in a separate tilesheet.  You can't create animated tiles and It looks like tile properties are user defined.   It wWould be a lot of work to use an XML parser to build out a container to hold all of the map data.


Yes I thought about this because I'm not a big fan of XML myself, but since Tiled is opensource you can build a plug-in for Tiled that handles whatever format you want/convert to (ie, support for mappy).

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Mappy tilemap engine playback library port for SFML
« Reply #18 on: April 27, 2010, 05:36:09 am »
Sorry, Ashenwraith, I though you were suggesting witchdoctor switching to Tiled.

I did like the look of Tiled, but with no example code for me to dig in to straight away, I went with Mappy. If someone wants to port Tiled to SFML, I'd certainly use it :)

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
Mappy tilemap engine playback library port for SFML
« Reply #19 on: May 18, 2010, 12:30:00 am »
Sorry it took so long for me to get back to u, I'm stil having issues with background tranceparency. I'll upload a build of what I got very soon
John Carmack can Divide by zer0.

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
Mappy tilemap engine playback library port for SFML
« Reply #20 on: May 18, 2010, 06:02:03 am »
Ok, here is a build of what I have
www.blackshark.nukelol.com/NSSC/PlovR_001.zip

the controls are, W to thrust up, A and D to thrust Left and Right respectively

Left mouse to shoot, and mouse wheel to change weapons,

the black should be clear, and show the Grey background but it doesn't, its like its not being masked at all for some reason (this is block 0 that I'm talking about)


Thanks for any help you can offer!
John Carmack can Divide by zer0.

Breakman79

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Mappy tilemap engine playback library port for SFML
« Reply #21 on: May 18, 2010, 07:59:42 am »
Alright, I believe I have a solution for your problem.  There is indeed a problem with the drawing of tile 0.  I didn't notice it for my 8-bit test maps because the color of tile 0 matches the transparency color, but that isn't true for the higher bit depth maps.  

I've changed the Draw functions to ignore drawing tile 0 which should fix your problem and it gives a nice speed boost if you're drawing multiple layers at once.  I need to back out some changes I wasn't finished with but I think I can get a new release up sometime within the next day.

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
Mappy tilemap engine playback library port for SFML
« Reply #22 on: May 18, 2010, 09:32:37 am »
Most awesome, thank you very much.

I'm using this game for a prototype in one of my college classes and one of my team members brought up background images and reminded me of this problem, we meet up again Wednesday and it would be awesome if i had parallax scrolling backgrounds done by then.

Thanks again!
John Carmack can Divide by zer0.

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
Mappy tilemap engine playback library port for SFML
« Reply #23 on: May 19, 2010, 11:27:33 am »
Cool, my issue has been resolved, thank you so much!
John Carmack can Divide by zer0.

Breakman79

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Mappy tilemap engine playback library port for SFML
« Reply #24 on: May 19, 2010, 06:01:42 pm »
Awesome!  I'm glad it works for you now  :D

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
Mappy tilemap engine playback library port for SFML
« Reply #25 on: May 20, 2010, 12:18:38 am »
hey, I have a little feature request, don't know how feasible it would be, but how about being able to control how fast the parallax backgrounds scroll? for a cool multiple parallax effect, like you call

   
Code: [Select]
Map.DrawMapParallax(*Get_RenderWindow(), Background, Background.GetImage()->GetWidth(), Background.GetImage()->GetHeight(), Map.Get_Camera().x * scrollSpeed, Map.Get_Camera().y * scrollSpeed);


because currently if i were to multiply by scrollSpeed, i get really weird effects.


This isn't important or anything, just thought it would be kinda neat :)
John Carmack can Divide by zer0.

Breakman79

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Mappy tilemap engine playback library port for SFML
« Reply #26 on: May 20, 2010, 02:04:42 am »
Sure, I add to the function so that you can make it scroll slower.  Right now the parallax scrolls at half the speed of the map.  I can pretty easily change it so that you can pass in or set a parameter to change the scroll speed to 1/3, 1/4, 1/5... etc.  However if you need it to scroll faster than 1/2, it doesn't look so simple.

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
Mappy tilemap engine playback library port for SFML
« Reply #27 on: May 20, 2010, 07:19:11 am »
Cool! the only time i would need it to scroll faster was if it was in front of the map being drawn, which i might want, but that's something that would be a special case and i would add the myself any way.



EDIT:

also i noticed this in the header file,

Code: [Select]
If SFML has a method of returning image size for a sprite, let me know so I can change it so they don't need to be passed in.


I believe you can get it like this,
Code: [Select]

sprite.GetImage()->GetWidth();
sprite.GetImage()->GetHeight();




EDIT #2

Ok, I added the multi-speed scroll ability to the DrawMapParallax by adding a nother argument "float scrollSpeed", and if set to 1, it will scroll at the same speed of the map, the closer you get to 1 the slower it is, so 1.7 will scroll faster than 1.2.

works pretty well, if you would like to see the whole thing i could post it, but it really isn't much, the "scrollSpeed" just replaces the hard coded 2 in the function.
John Carmack can Divide by zer0.

CytraL

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • GitHub
Using Zoom
« Reply #28 on: July 02, 2010, 04:03:01 am »
Hi! first, great work!! ;)

Pls.. How can use sf::View zooming with SFMLMappy ???

Thx!
dev@redneboa.es | WordPress | GitHub | YouTube

Breakman79

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Mappy tilemap engine playback library port for SFML
« Reply #29 on: July 02, 2010, 07:41:53 pm »
I've have yet to actually work with Views in SFML, but it doesn't look to hard.  I added these two lines in my demo program before the main loop and it doubled the size of map and sprite images.

sf::View& DefaultView = App.GetDefaultView();
DefaultView.Zoom(2);