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

Pages: 1 ... 7 8 [9] 10 11 ... 15
121
Graphics / Drawing text vs making a render texture once and then draw
« on: November 19, 2013, 11:42:16 pm »
Hello.
Hint:I simplified the question as best i know, therefore the request may seem a little OOD.

I am wondering the following since i have no idea how cpu consuming is to draw text?
Question 1:If i have wall of text is it more cpu efficient to draw to render texture(that will continue to live after current loop) and then draw the render texture each loop(to screen) or draw the text itself(to the screen).
Question 2:If i have text that is gonna change each 5 seconds that will hold about 20 characters, draw it onto render texture once and then use it until the text is changed upon witch time i will redraw the renderTexture or draw the text itself to the screen?

122
Graphics / Re: VertexArray collision?
« on: November 19, 2013, 01:57:11 pm »
I will attempt to help further.

Quote
This is just for a example, it is not fleshed out properly and is only to give you an idea what next step could be

You will probably need few things like:
Code: [Select]
int Get_Vertex_ID(int posX, int posY);//This function will take two arguments, witch represent position of a unti for example
//And will return a ID of vertex to check collision with
For example:
if you pass x=100 y=100 and you map have following characteristics:
tile_Width = 4, tile_Height = 4, tile_Size = 32, mapSizeX = tile_Width*tile_Size...
0 4 8 12
16 20 24 28
32 36 40 44
48 52 56 60
Function with x=100 y=100 would return 40 and thus you do only one to maximum of four collision detections(if your unit is same size as the tile, in case it is bigger...) and there is better code then you intended :)

But with this there are few problems.
One is that if the collision for Vertex_ID = 40 is walkable and (44,56,60) is unwalkable your unit is on that place so you need to do additional checking
Code: [Select]
int Get_Vertex_ID(int posX, int posY)
{
    if(posX%32 != 0)
        Tiles_To_Check_X = 2;
    else
        Tiles_To_Check_X = 1;
}
But then again there is another problem with this.
What if the unit is at Vertex_ID = 60 and tries moving right or down.
The code above would produce error cause the program tried accessing above Vertex_Array range.(Vertex_Count = 60) but the program tried accesing 64 or higher ^^


124
SFML projects / Re: All the King's Men
« on: November 13, 2013, 12:39:18 pm »
It is fun!
But somehow i fail each time because i want the tresure and the king is left unguarded :P.
Somehow making the tresures boost you and be worth sometimes sacrificing a hit to the king would inprove the tactic part of it.
Simple and good.

125
Graphics / Re: Drawing grid 16x16 all over the window?
« on: November 10, 2013, 12:56:19 am »
You can get data from sf::Window class and make your grid = window.width / 16.
Refer to documentation for window class.

126
Graphics / Re: Completely Eliminating Jittery Movement
« on: October 22, 2013, 09:21:05 pm »
I did not notice that, did not read everything through in depth.
Saw in first post not using real time events so  :-[.

127
Graphics / Re: Completely Eliminating Jittery Movement
« on: October 22, 2013, 02:39:39 pm »
...
Not using real time events in movement is the reason its so Jiggering.
I will put a quote from tutorial
Quote from: Tutorial
Sometimes, people try to use the KeyPressed event to implement smooth movement. Doing so will not produce smooth movements, because when you hold a key you only get a few events (remember, the repeat delay). Smooth movements can only be achieved by using real-time keyboard input with sf::Keyboard

To fix the movement make something like
Code: [Select]
bool isKeyWPressed = false;
//Event loop
case sf::Event::KeyPressed:
switch(event.key.code)
{
case sf::Keyboard::W:
isKeyWPressed = true;
break;
}
break;
case sf::Event::KeyReleased:
switch(event.key.code)
{
case sf::Keyboard::W:
isKewWPressed = false;
break;
}
break;
Do note there are many things to take in account like, losing focus on screen then releasing the W, then the window gains focus and it never got that W was released... do read upon it i suggest.

128
SFML projects / Re: Sins of a Hex Empire
« on: October 22, 2013, 02:36:06 pm »
I will surely check it out when i get home, looks sweet!

EDIT::
After playing the game and lose few time i figured out i have no idea how the unit system works...
I also did have issues with commands you should at least write in post a list of commands.

List of stuff you should consider redoing:
1: Unit count and power!, during my gameplay i had no idea why my troops kept loosing, and it seamed we both had 9 starts in power.
2: Little explanation on whats terrain and whats territory. At first glimpse there are collors for each faction and i did not notice that the blue is not a faction but water.
On this subject you could make flags on land instead of full colored hexagons. That would allow for better visuals.

I liked the game, it was a blast with the lack of information.
It has potential but it needs some love.

129
Graphics / Re: Problem with RenderTexture
« on: October 17, 2013, 09:32:33 pm »
Quote
intel returns 8192 and nvidia 16384.
I guess that's not the problem

I'll have a look what I can find in my bios
EDIT: I can't find any checkbox like that :/
Yea its 8192x8192 and other one 16384x16384, that is not the problem.

For the bios, its usually the complicated thing... google it is the best way you can find out.
I cant remember how its called, but i know how to do it on my pc, cant help you out sorry.

130
Graphics / Re: Tilemap drawing breaks with different tile sizes
« on: October 17, 2013, 01:34:07 pm »
The second picture issue:
Both of those for loop code is exactly the same, why not merge it intro one and just change the Layer that is used on second loop cycle:
Code: [Select]
my_class LayerTarget = 1;
for(int i = 0; i < 2; i++)
{
//The positioning,drawing...
LayerTarget = 2;
}

When you added
  sprite.setTextureRect(sf::IntRect(0, 0, 32, 64));
your first draw was fine, but second main loop went true and it was drawing the terrain with textureRect wrong.
If you modified textureRect for second draw, you most set it back for first draw.

If you are interested in best way to draw tiles that is sf::VertexArray.
It is little tricky to start with, but since i have used it i have gotten such a good performance its crazy good.
To provide you with vision, i got same performance drawing ~1000 tile sprites as drawing ~27,000,000 tiles .

131
Graphics / Re: Problem with RenderTexture
« on: October 15, 2013, 11:06:01 pm »
There are few things i can think off:
1: Check if the GPU memory capacity is enough to store 500x500.
2: In bios i think there will surely be somehere a checkBox of some sort to allow errors to pop up(to display) when they happen (on my system when one of my components reported error i got showed onto a blue screen with error, don't confuse it with BSOD)
That way i figured out my motherboard has front panel audio error but i don't remember how i exactly did it.
Little messing around bios needed, but if you can program it should be in line of work.

132
Weird, I got no screen tearing.

I actually got extremely bad screen tearing.  It looked like there was a drastic FPS drop, but the fps was apparently a constant 60, so I'm not sure what that's about.
Ive noticed that at set "Screen resolution" and VerticalSync set on, on some systems the screen tearing occurs.
What i have noticed is that "Screen resolution" is not valid for their system (but it shouldn't mother since its not fullscreen) well one case i had one person help me test it.
I have made code so that it checks if the screen resolution is valid.
If valid apply the default one.
Else check witch screen resolution that is the least bigger is valid and apply that and there would be black borders.
And with that the tearing was gone, so if i add that i fixed the error.

About the code request:
I save each build i make. Each build is made each time i finish/start programing so there is allot of builds.
The issue is that i do not know witch build this error was occurring at, and i messed with the renderWindow and openGL states before and after so the code may be incorrect.

I suggest open a new thread for this issue, (The windows saves witch date/time the file was modified) by that i can check when first post was made and i will get you the code very close to the time of the post.

CODE
Code: [Select]
//"Control.h"
const bool WINDOW_FPS_CAP = false;
const int WINDOW_FPS_CAP_AMOUNT = 60;
const bool WINDOW_VSYNC = true;
const int WINDOW_WIDTH = 800;
const int WINDOW_HEIGHT = 600;
const int WINDOW_BPP = 32;

//"time.h"
#include <SFML/System.hpp>
class Time
{
public:
Time();

void UpdateLoopTime();

int timePerLoop;
int dt;
private:
sf::Clock mainClock;
};
//"time.cpp"
Time::Time()
{
timePerLoop = 0;
dt = 0;
}

void Time::UpdateLoopTime()
{
dt = mainClock.getElapsedTime().asMilliseconds();
if(dt < 0)
dt = 1;
else if(dt > 50)
dt = 50;
timePerLoop = mainClock.restart().asMilliseconds();
}

//"FPS.h"
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>

class FPS
{
public:
FPS(sf::Font & font);

void Update();
void Display(sf::RenderWindow & renWin);

private:
sf::Clock clock;
sf::Text txt;
int loopAmount;
int totalAmount;
};
//"FPS.cpp"
FPS::FPS(sf::Font & font)
{
loopAmount = 0;
totalAmount = 0;
txt.setFont(font);
txt.setCharacterSize(12);
txt.setColor(sf::Color::White);
txt.setPosition(0, 0);
txt.setString("FPS:0");
}

void FPS::Update()
{
loopAmount ++;
if(clock.getElapsedTime().asMilliseconds() > 1000)
{
clock.restart();
totalAmount = loopAmount;
loopAmount = 0;
txt.setString("FPS:" + std::to_string(totalAmount));
}
}

void FPS::Display(sf::RenderWindow & renWin)
{
renWin.draw(txt);
}

//"Window.h"
class Window
{
public:
Window(int Width, int Height, int BPP, std::string string = "", int style = sf::Style::Default);

sf::VideoMode vidMod;
sf::RenderWindow renWin;

private:
void CreateWindow(std::string string, int style);
};
//"Window.cpp"
Window::Window(int Width, int Height, int BPP, std::string string, int style)
{
vidMod.width = Width;
vidMod.height = Height;
vidMod.bitsPerPixel = BPP;

CreateWindow(string, style);
}

void Window::CreateWindow(std::string string, int style)
{
sf::ContextSettings constSetting = sf::ContextSettings();
constSetting.antialiasingLevel = 0;
constSetting.depthBits = 32;
constSetting.majorVersion = 0;
constSetting.minorVersion = 0;
constSetting.stencilBits = 0;
renWin.create(vidMod, string, style, constSetting);

//If cap fps then cap fps
//else if VSync true then VSync on
if(WINDOW_FPS_CAP == true)
{
renWin.setFramerateLimit(WINDOW_FPS_CAP_AMOUNT);
}
else if(WINDOW_VSYNC == true)
{
renWin.setVerticalSyncEnabled(true);
}
}

//"main.cpp"
int main()
{
//Creation of objects
Window objWindow( WINDOW_WIDTH, WINDOW_HEIGHT, 32, "YoFat^^", sf::Style::Default);
Camera objCam(objWindow.renWin);
Time objTime;
FPS objFPS(objFon.arial);
...
//Main loop
{
objTime.UpdateLoopTime();//Delta time
objFPS.Update();
//Logic, drawing...
objCam.SetViewDefault();
objFPS.Display(objWindow.renWin);//Fps draw
objWindow.renWin.display();
objWindow.renWin.clear();
}

If you want to contact me send me a message...

133
The blur does not seem like an issue thanks  :)

Space(zoom) is currently ongoing a testing phase that's why its real time event.

Its poking me because, Units are moving and they are not creating it.
View is moving and everything gets that blur.

134
I tried getting a screen shot, tried recording it, researched and have not accomplished what i wanted.
I am unable to provide you with input of what i am experiencing, i will provide with .exe file, that is the only thing i can think off.


Pretty please can you help me, i need you to test if in game moving around produces the same effect of (leaving a veig trail of itself with 75% transprency) because i am feeling missurable right now.

I got media file upload link Pretty please test it out for me:
http://www.mediafire.com/download/q2f8k4i2xumgf9c/Test.zip

1:When you start application its gonna prompt a intro that ends in about 1-2 sec.
2:Press new game.
3:Navigate right down(intro open area) using W,S,A,D keys.
4:Pressing left mouse button add dozen "sheep".
5:Now MOVE! see if the sheep leave that pesky blurry effect behind them, if they do! press E or Space to destroy them, and bring me your report.

Protip: Its best visible when moving diagonally.

135
Graphics / Re: Smooth movement.
« on: October 07, 2013, 09:33:08 pm »
eXpl0it3r
Don't mix real-time inputs and event handling.
Read the linked tutorials (again), especially pay attention to when you should use what and where you should use what. :)

Read true tutorials, you will figure you why the movement is jaggy.
Its pretty highlighted in certain parts you wont miss it!

Pages: 1 ... 7 8 [9] 10 11 ... 15