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 - Vit

Pages: [1]
1
General / SFML2 Examples don't start in Windows (MinGW)
« on: October 23, 2011, 09:44:34 pm »
Never mind, I figured it out - I hadn't copied the resource folders over to the same directory as the executable. Pong still doesn't work, though (probably a DLL problem)...

2
General discussions / State machines or Screens?
« on: October 20, 2011, 12:28:04 pm »
A bit of a bump, but related to the topic:
In my game, I've implemented a state machine system similar to the one keyforge described. However, I've run into a problem - returning values from a state being popped to the new (previous?) state. As an example, my game allows the player to name their character. This means I need a name input state. However, I can't think of a good way to pass the result of the name entry back to the character creation state... Any suggestions?

3
General / SFML2 Examples don't start in Windows (MinGW)
« on: October 20, 2011, 12:12:39 pm »
I just got a new PC, and I'm trying to set up SFML2 on it. The OS is Windows 7 64-bit.
I've downloaded and compiled SFML2 and its examples successfully, using mingw32-make. However, the only example which works is the window example. I've tried pong, shader, and win32 - shader and win32 exit as soon as they start, and pong crashes with error 0xc000007b. My SFML project from Mac OS X also crashes similarly when compiled for Windows.

4
General / Application path
« on: September 23, 2011, 10:44:00 am »
That's good to hear. I noticed it stores the path to the executable, not the directory (at least on OS X), so I trim it up to the last forward or back slash. That should work whether it's given an executable path and directory path (as long as the directory path has the slash on the end).

5
General / Application path
« on: September 23, 2011, 10:32:18 am »
Thanks, it seems to work. Can I count on it to work on different platforms (it being non-standard)?

6
General / Application path
« on: September 23, 2011, 10:09:42 am »
What's the easiest way to get the application path? I'm storing my resources in subdirectories next to the executable, and have set up my IDE to set the working directory appropriately. However, when I run it normally, the working directory defaults to the root directory, which doesn't help.
I've had a look online, and it seems that the usual method to get the application path varies by platform; I guess I could use that, but it would be nice if SFML provided an easier way.
I'm using Mac OS X 10.6 and compiling with GCC, but I'd like to be able to get it to work on Windows and Linux too.

7
General / Pac man game
« on: June 30, 2011, 12:31:28 pm »
Pac-Man is tile-based; your array should be the size of your tile grid. For example, if each of your tiles was 20x20 pixels, and your screen size was 640x480, your tile grid would be 32x24 tiles. Each element in your array would then represent a 20x20 square on the screen.
When you want to move Pac-Man on the screen, you'll need to find out which tile he'll be moving to first. For example, assuming your tile array starts from the top-left, to move right you'll need to check board[pacman.x + 1][pacman.y]. If the element is passable, you can start moving him into the tile; otherwise, do nothing (as he's trying to move into a wall).

8
You've used >= instead of < (or <=).

9
Graphics / game engine question 2
« on: June 25, 2011, 03:42:20 pm »
How big is each of your tile objects? 1000000 tiles should only be a few MB at most.

Does each of your map objects contain 1000000 tiles, or are there 1000000 tiles in the world in total? 1 GB of memory is a lot for just a million tiles. I don't know how you managed to get 1KB per tile. Does each tile have its own sf::Image by any chance? It's far better to have an array of sf::Images that can be accessed by the rendering code, and give each tile object an index into that array.

I'd split the world/maps up into smaller chunks - for example, in my game, I have a (practically) infinite world, which is split into 32x32 chunks. Only the chunks near the player's location need to be loaded, so the rest of them can be saved to a file and removed from RAM.
You could probably use bigger chunks than that (the reason mine are that size is that each chunk is rendered at once, and my graphics card can't cope with chunks much larger). Each tile is 4 bytes, so a chunk is 4 KB. This means I can load enough chunks around the player to make the world seamless without using much memory. Loading chunks from files is fast, too, as there isn't much data that needs to be loaded.
Then, separate from the chunk objects, I have a fixed number of chunk renderer objects. All visible chunks are attached to one of those; when the  player moves far enough that the visible chunks change, I detach the renderers and reattach them to the new visible chunks. That way, only the chunks right next to the player need to have any sort of rendering data; further-away chunks only need to store basic tile data (i.e. only take 4 KB per chunk).

I'm using straight OpenGL for rendering, but I'd imagine a good strategy to use in SFML would be to render each chunk to a single sf::Image (or if you're using layers, one sf::Image per layer). Then, you only need one sf::Sprite per chunk, saving rendering time (though it would be more memory-expensive, as you'll need a large sf::Image per chunk). When a chunk is no longer visible, you can delete its image. I know that's how RPG Maker works; each map is rendered to an image rather than being drawn tile-by-tile each frame.

10
General discussions / SFML 2 for OS X comes true!
« on: May 25, 2011, 05:40:30 pm »
This probably isn't the right place to post this, but I've found that closing the SFML window sometimes makes my computer emit a brief loud 'static' sound through the speakers (even if the volume is completely down). I'm using a 2005 Macbook running Mac OS X 10.6. I've experienced this problem in two different projects which don't share any code, so I don't think it's a problem with my code (unless there's something funny going on with my OpenGL calls; I'm using straight OpenGL for map rendering in both, though again, the code is completely different).
I'm not sure what's going on here, and it's starting to worry me...

11
General discussions / SFML 2 for OS X comes true!
« on: February 17, 2011, 06:59:20 pm »
I haven't checked back here for a while (been busy with other things), but SFML 2 on Mac is amazing news :D

I'll be trying it out in the next few weeks; I hope the problems I had with 1.6 are fixed!

12
General discussions / SFML 2 for OS X comes true!
« on: November 29, 2010, 11:18:57 am »
Hooray :D
Let's see if the bugs I noticed in 1.6 are fixed (a few SFML + OpenGL integration bugs, and transparent bitmap blitting).

13
Graphics / Can you "send to back" with graphics?
« on: April 30, 2010, 07:08:17 pm »
I made a new Sprite class which inherits from sf::Sprite, but also stores a z-value (along with a few other extra things).
To order them, I used a std::list of sprite pointers and its sort function, calling a comparison function to check the sprites' z values.

I also have a std::map of the sprite pointers, indexed by std::strings, as I like being able to dynamically create sprites and refer to them with text rather than numbers. Each time the sprites are sorted, I clear the list and then re-add each sprite from the map (to ensure the list contains every sprite). I don't think this is very efficient, but I only update the order when a sprite's z is modified or a new sprite is added, and only once each frame, so it's not currently a problem. But if anyone cares to give me a better solution, go ahead.

14
Window / gluPerspective/glOrtho not working?
« on: April 13, 2010, 05:59:19 pm »
I recently updated my project to use SFML 1.6 (Mac OS X).
I'm using direct OpenGL to render a 3D tile-based map (aka 2.5D), with either a perspective or orthographic projection.
However, I've found that once I use either glOrtho or gluPerspective, I can't switch to the other later (after I call app.Display). If I call glOrtho first, it gets stuck in orthographic; if I call gluPerspective, it's stuck in perspective.

It's most likely a fault in my code somewhere; however, it worked perfectly in 1.5, so I suspect it's something to do with SFML. If needed, I could try creating a minimal example.

Pages: [1]
anything