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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Dbug

Pages: [1]
1
SFML projects / Re: The 2D Game - drawing a tilemap with a shader
« on: February 02, 2013, 10:36:43 pm »
Is it supposed to work for size different than 256x? Your example breaks for me if I change all 256s to 128s.
I am working on shader that'll support any data and tile textures and with 32x32 tiles.
Yes it is possible. There are actually two ways to achieve that:
- Modify the shader constants so the computations to find the tile and texture work for the particular size
- Modify the shader code to get the textures dimensions that are passed as parameters

The first is easy but not flexible, the second will auto-magically  works whatever sizes you give.

I had a prototype using the second method but it made the code very ugly and complex for no particular reason since in my case I had decided to use 256x256 tilemaps and sizes that are 32x32 tiles.

I'll make a thread if I succeed.
Is it enough for your copyright if I paste a comment like that in my class code and publish my class and shaders?
        //The code on which this class implementation and shader code is based are subject to following copyright notice:

        //
        // Copyright (c) 2012 by Mickaël Pointier.
        // This work is made available under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported license,
        // http://creativecommons.org/licenses/by-sa/3.0/.
        //

        //Which is not included in shader source literals below to save space in final executable -FRex
I guess that's fine, perhaps just add a link to my website? Like for example:
// Copyright (c) 2012 by Mickaël Pointier. (http://www.the2dgame.com)

Have fun!
(I tried your executable, it works fine here)

2
SFML projects / Re: The 2D Game - drawing a tilemap with a shader
« on: January 15, 2013, 07:01:31 pm »
Did you solve the problem of loading new map pieces during player movement around the map?
It seems to be simply too slow, takes way over one 60th of a second.
Well, it's a matter of granularity, typically a 256x256 tilemap texture resolves as a 8192x8192 texture when rendered (using 32x32 tiles).
Uploading to vram a 256x256 pixels texture should be very fast, many games are doing that all the time.

At most you need 4 tilemap textures at the same time on screen, when you do transitions from a sector to another one from a corner.

You need a way to predict the direction of the player and make sure you upload the tilemaps before you need them, a possibility would be to use the position toward the center coordinate of the tilemap on which the player is located as a way to know which ones to load.

I made my tilemap editor in sfml, and I'm painting tiles directly on the texture and upload them on the graphic card immediately and has not noticed any drop in frame rate doing that, so there must be something different in the way you did it. Could you paste some code?

Your website is absolutely awesome!
I read all your articles, keep it up!
Glad you like them :)
I'm currently busy with some other stuff I promised to other people, but as soon as I am done with these duties I will go back to my sfml stuff with some new articles.

Thanks!


3
SFML projects / Re: The 2D Game - drawing a tilemap with a shader
« on: December 11, 2012, 09:26:41 am »
All the license means really is that if you made a change to the system, to make it perhaps more efficient or bug free, you are supposed to make the changes available to the public.

It does not mean your whole project has to be given away: Just publishing the modifications you did to these particular parts of code is enough. No need to publish your whole project as open source or whatever.

At least that's the way I interpret it, I don't see that as very restrictive.

I know this code is not rocket science, but it appears that most people are still using for loops or vertex buffers to draw tilemaps, so obviously the method is not that well known by most people.

My objective was just to make a minimal demo to make it easy to understand. I don't pretend I invented the method :)


4
SFML projects / The 2D Game - drawing a tilemap with a shader
« on: December 10, 2012, 09:12:12 pm »
Hi,

I started working on a small indy game in my spare time, and decided to document the progress on a blog, but in a way that can be useful for other people.

I started by a series of article explaining how to draw a tilemap efficiently, the final article was posted yesterday with actual sfml code and shader:

http://www.the2dgame.com/index?page=articles&ref=ART9

Hope you like it, don't hesitate to comment, for good or bad.

Thanks.

5
I'm been looking a bit on the forum, and there's been a number of requests that have been answered by "use this other library", or "this has nothing to do in a media library".

What I'm wondering is that is the actual delimitation between what makes sense to have in such a library.

Typically I was using SDL, and SDL wraps most of what you need. I switched to sfml because the performance of SDL was abysmal and having hardware acceleration by default was nice.

Now my problem with sfml is that in the current state I can't just use sfml and be done with it. If I want to do any serious work I need for example a basic portable file system library. Obviously sfml itself is loading and saving stuff (images, shaders, sounds), so I really wonder why there's no portable sf::fileLoad / sf::fileSave in the sfml API. That would be very nice and help keep some consistent code without having to add some dependencies on boost for example.

Similarly, most "multimedia" applications have a lot of assets. Assets take a lot of room; and many small assets tend to eat disk space quite fast due to cluster size. It could be nice to have some "container" system (like in old Doom and Quake WADS, or simple ZIP/7zip/rar).

In my particular case I just wanted to have a portable way to scan a folder to get a list of save games without having to maintain on the side some index file.

So what's the official stance on this topic?



Pages: [1]
anything