Hello, First of all sorry for my english.
So I've got gaming project to do for my university. I'm studying Computer Science and i chose SFML library.
Here's my topic. I have to write something like Worms (Simple ofc, it don't have to be AAA game ^^) but in real time with simple map editor. It's hot-seat game, map has got size of screen resolution, each of players has 30 seconds to draw his half of map and then they're shooting to each other. Map is destructible.
I've got some problems. I've got 2 versions of drawing map but both sucks.
First version and problem: efficiency
void Level::Render(sf::RenderWindow &gamewindow)
{
for (int i = 0; i < mapelements.size(); i++)
{
mapElement a = mapelements[i];
gamewindow.draw(a.circle);
}
p1.Render(gamewindow);
}
void Level::handleInput(sf::RenderWindow& gamewindow) {
if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
{
mapElement circle;
circle.setPosition(mouse.getPosition(gamewindow).x, mouse.getPosition(gamewindow).y);
mapelements.push_back(circle);
}
...
mapElement is a circle with some methods. This version really sucks in efficiency. If there are 500+ circles there's huge fps drop. If collision is off i can draw about 700+ circles
Second version
I've got transparent RenderTexture (Screen Resolution size, e.g 1366x768) on which i draw circles and then i remove circles from vector so there's no efficiency problems but i can't handle with collision cause it's one big texture...
I don't have other ideas, i'm new in SFML but i tried. Maybe you can help me with ideas of mine or you've got other ideas.
Thanks