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

Pages: 1 ... 3 4 [5] 6 7
61
SFML projects / Screenway - a racing game
« on: April 24, 2010, 10:25:05 am »
Quote from: "pierreyoda"
Hey, just a question : how do you get that zoom effect?  :D


Code: [Select]
dt = window.GetFrameTime();
if (window.GetInput().IsKeyDown(sf::Key::Add)) view.Zoom(1.f - dt);
if (window.GetInput().IsKeyDown(sf::Key::Subtract)) view.Zoom(1.f + dt);

62
Graphics / Problem loading large images
« on: April 23, 2010, 01:07:37 pm »
OK, so to sum up:

Is there a way to load and display an image that is larger than the maximum supported texture size using SFML?

Or is the only way cutting the big image into smaller images in some graphics program?

Or maybe there is a graphics library that would enable loading large images, and then feeding SFML with sizes it can handle?

Seriously, if some guys can't display textures larger than 256x256, what can be done? If was to cut my 6000x2000 track into small JPEGs the result would be over 200 small images!  :shock:

63
SFML projects / Screenway - a racing game
« on: April 22, 2010, 10:57:55 am »
Quote from: "Ashenwraith"
1024x1024 is a much more standard size and if you want old gfx cards you should do 256x256


um, so youre saying I should slice my track image into:

(6 500 * 2 400) / (256 * 256) = 238.037109

about 238 pieces? hmm... maybe you know some library that could load big images to memory and then extract only parts of the image, so I could feed the sf::Image::LoadFromMemory or LoadFromPixels.

this is complex stuff, I'm quite surprised that it isn't covered by the library.

Quote from: "Breakman79"
Have you tried disabling the bi-linear filtering on the background images? It seems to be a very common issue that people have when first starting out.

image.SetSmooth(false)


yes, it worked! thank you! however, now the track does not look so nice when it is upscaled.

Quote from: "pierreyoda"
I tried the game : very nice !  
I love the car's physic, with lot of inertia  


thanks. Remember, this is just the first thing I decided is worth showing. It will see many improvements, like drifting for example.

64
SFML projects / Screenway - a racing game
« on: April 22, 2010, 12:47:38 am »
OK guys, I cut the image into pieces of 2048x2048. Hopefully, everyone will be able to run it now.

I also added zooming, NUM+ and NUM- are responsible for it.

http://grebocin.com/upload/screenway_r7.zip

I really hope it works now! However, now you can find these black lines between the tiles. I don't know why they appear, as the tiles are perfectly matched...

65
Graphics / Problem loading large images
« on: April 21, 2010, 11:15:47 pm »
Quote from: "Ashenwraith"
You have mutliple textures/sprites and move them together using like an array/loop.

It's inefficient to have one giant texture to be the track because you can only view a small part of the track at one time. It's much better if you have tiles because you can have bigger tracks AND use less memory.


OK, but you agree with me, that it should not be my problem how things get done. If my large track is consuming too much CPU, because it is being processed outside the visible area, then the graphics engine should know not to deal with the invisible part.

Besides, I'm not sure if checking which tiles are visible and which not, and them turning them ON or OFF is that much efficient than actually displaying the whole image.

And lastly, modern graphics cards are such killer devices, that displaying one big track and a car over only makes them laugh. Without Vertical Sync, my PC generated 10 000 Frames Per Second, with the track being the size of 6500 x 2400, and upscaled 3x3 (so it was about 20000 pixels wide).

66
SFML projects / Screenway - a racing game
« on: April 21, 2010, 10:51:30 pm »
Quote from: "Ashenwraith"
Scaling your images in game is tricky to make them look good and best avoided in a simple game (there is a certain pattern of resolution created by evenly divided by 100).

The track looks too blurry, I wouldn't scale it.

The car should be scaled beforehand so it's smooth.

I would also try picking a car that doesn't look like it's covered in pebbles.


Dear Ashenwraith

I only scaled the image to make the road big enough for the car, to test how it behaves.

The car is bigger, because later on i will add speed dependent zooming, like it was in GTA 1 (you drive slow, the car is bigger, you drive fast, you see more of the track).

Besides, if I enable anti-aliasing the quality will improve a lot.

And finally, the textures aren't what matters now. I only chose this track and this car, cause I didn't have to make them myself. When I work out the physics, I will take care of the graphic side

Any way, thanks for the input  :D

67
Graphics / Problem loading large images
« on: April 21, 2010, 10:39:14 pm »
Quote from: "Laurent"
If you draw your sub-images inside a parent Drawable, then you can manipulate it as one piece and nothing will fall apart ;)


I don't understand. How do you draw an image inside a "parent drawable"? I'm really confused. Can you place images inside some class called sf::drawable?

Lets say i have an image of 4000 x 4000. I cut it in IrfanView into four pieces of 2000 x 2000. Now i load these four images to SFML and convert them to sprites. Now I have four sprites. How do I make them stick together and refer to it in a single reference (like draw, move, delete)?

Quote from: "Laurent"
It's very complicated. In SFML, images and classes that use them are completely separated.


OK, so i understand that it is impossible to display a large image in a single sprite. But am I right, that it should be possible to load even a very large image to SFML? Then, you could create a sprite from a slice of an image with something like sf::sprite::load(sf::image, rectangle);

Right now, if I have a large image, it is just impossible to use with SFML. Note, that many images made using modern cameras are bigger than a single texture size. I am saying that only to point out, that support for large images is a feature that SFML would benefit from.

68
SFML projects / Screenway - a racing game
« on: April 21, 2010, 10:22:15 pm »
Yes guys, the track is too large, and SFML supports only sprites as big as the largest texture your graphics card supports.

I have GeForce GTX 260, which supports textures up to 8192x8192, so the game works for me. I will try to find a way to make it work.

And, as I wrote, I am using SFML 2.0.

Most graphics cards support textures of 2048x2048, so if you crop the image montmelo.jpg to this size, the game should work.

69
Graphics / Problem loading large images
« on: April 21, 2010, 08:46:43 pm »
Hey, I posted a very early version of a game ive been working on (the game called Screenway in the Projects section). It uses a texture of a car and a track. The texture of the track is about 6000 x 2000 pixels. Now, my GeForce supports maximum textures of 8192x8192, so the game works fine. However, on a majority of PCs and Laptops the max size is 4096x4096 or even 2048x2048.

AFAIR, this value is stored in GL_MAX_TEXTURE_SIZE.

I can't imagine chopping down the image into smaller pieces and then calculating all the sprites to follow the movement and rotation, so that the puzzle doesn't fall apart.

So my question is: is the biggest possible loadable image in SFML limited to the maximum texture size of user's graphics card? Are there plans to change that? What do you suggest me to do to overcome this obstacle?

Another problem is, on a laptop which is able to run windows 7 with the Aero transparent interface, the game behaves really bad. It's choppy, like the vertical sync was not working correct. What would that be?

70
SFML projects / Screenway - a racing game
« on: April 20, 2010, 11:54:40 pm »
Hello there. I finally started my first project. It is going to be a racing game. At the moment there is only one car that can be driven over a surface with no collisions. I made it using VS 2010 and SFML 2.0 snapshot. The VC 2010 dll's are included in the package, so it should run out of the box.

Link:

http://grebocin.com/upload/screenway08.zip

Controls:

steering - arrows
gear up - A
gear down - Z
toggle vsync - F1
zoom in - NUM+
zoom out - NUM-

List of changes:

rev 8 (2010-04-24) - added rev meter and a timer
rev 7 (2010-04-22) - added zooming

71
General discussions / Re: Which language to use?
« on: April 16, 2010, 12:38:28 pm »
Quote from: "Mindiell"
Be careful, I'm just asking questions, not judging you. It's always interesting to see what others do.


Hey I didn't mean to offend you, I was only puzzled by your question.

Here is how my code looks like:

Code: [Select]
int txt = sprintf_s(string, "KPH %6.0f WHEELS %6.2f AIR %6.3f DISTANCE %6.0f POWER %6.0f", s, wheels, air, dist, pwr);
label.SetString(string);


Label is an sf::Text object. So, as you can see, displaying these numbers with all the formatting, using c++ streams would be much more complex.

Anyway, I seem to have some problem with my code. I declare the "float wheels = 0.f;" and when I run the program, SOMETIMES it is not equal to zero. it's very strange to me. the value randomly is equal to zero or something else, each time I run the program.

72
General discussions / Re: Which language to use?
« on: April 15, 2010, 11:01:27 pm »
Quote from: "Mindiell"
Why do you want to do that ? Don't you think you could do better by using strings for string stuff and numbers for number stuff ?


Wow, I almost don't know how to respond to that. I need to print some values to check how some variables behave. Anyway, I'm using the good old sprintf. For me, the c++ way of working with strings is terrible.

73
General discussions / Which language to use?
« on: April 14, 2010, 05:18:16 pm »
Quote from: "Laurent"

I mean all .Net languages. Once an assembly is compiled, it can be used by all the .Net languages. There's a VB.Net sample in SFML.Net to demonstrate that.


OK, I read a bit about the .NET. I did not know that there are more languages than C# working with the .NET framework.

So, I have found out that there is such thing as iron Python, which is Python for .NET. So the question is, which would be better: PySMFL or SFML.NET with iron Python?

74
General discussions / Which language to use?
« on: April 14, 2010, 04:14:37 pm »
so, by .NET you mean C#? I know that C# has some nice functions included, which make eg. type conversion easier. But is this whole "binding" a simple thing to do for a noob? Are there no compatibility issues, do the binding work 100% and are they efficient to use? How about portability, if I write in C#, will I be able to compile it under Linux?

75
General discussions / Which language to use?
« on: April 14, 2010, 02:44:32 pm »
Hello. I am a hobbyist programmer. I do not have academic programming knowledge, only the things I learned on my own.

I would like to write a 2D racing game of my own, and I really like SFML. However, there are many obstacles when I try to write it in C++. I lack the flexibility of PHP, I can't really grasp the whole low-level programming stuff, like memory management, pointers. Converting numbers to strings is a real pain in the ass.

I have heard about Python, although I do not know how to program in this language.

So I would like to have some advice from more advanced programmers. For a hobbyist programmer, who does not like to fiddle much with the source code to get things done, which programming language should I use? Are the SFML bindings fully functional? Or should I stick with C++?

Pages: 1 ... 3 4 [5] 6 7
anything