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.


Topics - Tukimitzu

Pages: [1] 2
1
General / Optimize this City Map application?
« on: May 18, 2018, 12:55:59 am »
EDIT: just realized this should be in General Discussion board, I think.

I'm doing this application where it shows a city, which is divided in neighborhoods, and then when the user clicks on one of them, it shows the urban blocks and streets in another view. I'm hoping I can improve the rendering performance because right now it is pretty bad.



On the top left you can see the time it takes to render going up until it stabilizes at 14-15 milliseconds. I only create the polygons once (which are not sf::ConvexShape, rather they are sf::VertexArray triangles for the filling part and sf::VertexArray line strips for the outline), and redraw them every frame. I was hoping sf::VertexBuffer would improve the performance, which it did, but only for 5-10%. Do you have any tips? How would YOU use SFML to do something like this?

2
EDIT: Solution at the end of this thread.

Hello!

I'm having a linking error that only happens when I try to build on debug mode.

obj\main.o:main.cpp:(.rdata$_ZTV16SFMLRenderWindow[__ZTV16SFMLRenderWindow]+0x1c)||undefined reference to `sf::RenderWindow::activate(bool)'|
obj\main.o:main.cpp:(.rdata$_ZTV16SFMLRenderWindow[__ZTV16SFMLRenderWindow]+0x34)||undefined reference to `non-virtual thunk to sf::RenderWindow::activate(bool)'|

I've built SFML 2.5.0 from scratch, with CMake, with the MinGW g++ compiler version 6.2.0 (i686-posix-dwarf-rev1, Built by MinGW-W64 project).

I'm sure I'm doing something wrong, but I can't find out what. Again, release build works just fine, it only happens on the debug build.

Thanks!

3
Feature requests / File system
« on: January 11, 2017, 05:39:34 am »
Can we please have some file system features?
I wish I didn't had to add boost::filesystem as a dependency, it's so janky.
Start small, no need for directory iteration, but a sf::getAppPath() to get the application data directory would be nice.

I haven't used it, but it looks like SDL does just that with char* SDL_GetBasePath(void).

Thanks!

4
General / Can't track this SegFault
« on: September 16, 2016, 02:17:04 am »
Code Blocks debugger callstack shows this:

#0 0x738253bb   ?? () (??:??)
#1 0x73831b13   ?? () (??:??)
#2 0x73766bbb   ?? () (??:??)
#3 0x73766c5b   ?? () (??:??)
#4 0x77145de3   ntdll!RtlUnicodeStringToInteger() (C:\Windows\SYSTEM32\ntdll.dll:??)
#5 ??   ?? () (??:??)

I have my game updating at a constant 60 updates per second. If I call printf("Something...") every update, when the SegFault happens, I will see an incomplete call of the last printf (terminal shows "Someth" or whatever), which indicates to me the SegFault happens in another thread, and not in my game loop. Since I only have one thread and the only library that I'm using that creates threads internally is SFML 2.4.0, I suppose that's where the SegFault is. But where? I don't know how to track it down, if I run drmemory, sometimes it won't even accuse SegFault.

5
Audio / Having multiple sf::Music open
« on: September 16, 2016, 01:18:01 am »
Is there any problem having multiple sf::Music opened? Should I call openFromFile(...) only when I'm about to play it or can I have multiple sf::Music opened and then just call play when I want? Even if there "shouldn't" be a problem, what is safer, faster and what not?

Currently I open all my music at once on the start of the program, then play it as I need, but I'm not sure that's a good idea.

6
General / Save to Memory
« on: August 20, 2016, 02:10:58 am »
Hello all,
I have a bunch of images, fonts, sounds and musics that I want to pack into a single binary file. I know there are loadFromMemory functions, but how to I write these objects in the memory in the first place?

In an ideal world I would have something like this:

// rscMap is a std::map<string, X*> where X can be sf::Sound, sf::Texture, etc...
std::ofstream file("my-pack", ios_base::binary);
file << rscMap.size();
for (auto resource : rscMap){
  file << resource.first;
  file << sizeof(*resource.second);
  file << *resouce.second;
}

If there is a library that already does that I would like to know as well.
Thanks!

7
SFML website / Link to different versions
« on: August 15, 2016, 06:03:18 pm »
Hello,
I very much like the new "old version" warning on the website. It was very convenient for me while the 2.3.2 version was the most recent one. Now that it isn't, it's not that useful anymore, unless I update my library.

What if aside from linking to the most recent version, it gave you a link for each version? I don't know the complexity of such task, I'm just throwing it out there.

I'm talking first world problems here, the website is already great.

8
SFML website / SFML on Google
« on: April 24, 2016, 05:06:08 am »
Whenever I google some SFML feature it returns me the SFML 2.0 documentation rather than the most recent one. Why is that?

9
Network / Non-blocking usage and Status handling
« on: April 10, 2016, 08:09:21 am »
Hello friends,

When I have non-blocking sf::TcpSockets updated in a loop, what are the correct ways to send and receive data?
This is how I've been doing:

Listening to connections:
    sf::Status status;
    sf::TcpSocket* socket = new sf::TcpSocket;
    while ((status = listener.accept(*socket)) == sf::Socket::Done){
        // store socket somewhere, then...
        socket = new sf::TcpSocket;
    }
    delete socket;
 

Receiving data:
    sf::Packet packet;
    sf::Socket::Status status;
    while ((status = socket->receive(packet)) == sf::Socket::Done){
        // read packet
    }
    if (status == sf::Socket::Disconnected){
        // delete socket, remove from storage
    }
 

Sending data:
    // when I want to send a packet, I don't send it right away, I store it in a queue
    peer.packetsToSend.push_back(packet);
    //...
    // further in another moment I actually send it
    if (!peer.packetsToSend.empty()){
        sf::Packet& packet = peer.packetsToSend.front();
        if ((status = socket->send(packet)) == sf::Socket::Done){
            peer.packetsToSend.pop_front();
        }
    }
 

Question #1: is the packet send queue necessary? Do I need a receive queue too?
Question #2: can the send method return sf::Socket::Disconected as well? If so, do I have to handle it or you think it's fine handling it only on receive (considering I call receive 60 times per second)?
Question #3: how to proceed if send(...) returns an error? Should I try to send the whole thing again?
Question #4: how to proceed if receive(...) returns an error?

Thanks!

10
Network / My generic questions about network
« on: April 04, 2016, 05:35:09 am »
Hello friends,
I don't have any problems really, I'm just looking for more experienced programmers to point me to the right direction. This is a little chat I've made using SFML + Dear ImGui. It works fine, it does what it is supposed to do, yet, I want to make sure to learn everything I can with this little program.

ChatSystem.h:
(click to show/hide)

ChatSystem.cpp:
(click to show/hide)

Keep in mind that I have 0 (zero) experience with network programming (not true since I got this chat working  ;D).

Question #1: I only have one socket that I use for everything, connecting, sending and receiving data. Since it is an unblocking socket, could that be a problem? What if I try to send something when it is receiving something? (the send function is not inside any loop).

Question #2: Do sockets have an internal queue or something? In unblocking mode, if I call receive (and there are things to receive) right after I call send, will it return NOT_READY on the second call if it's not done?

Question #3: I'm only able to connect with computers in LAN, why is that?

Question #4: I'm doing this as an exercise for something bigger, a turn-based strategy game. This is how I have the match-making in my mind:
- Player connects to server.
- Server is connected to all the players who are looking for match-making.
- Server says to player: "Hey, you and him are connected to me, which means you are both looking for a match. Here is his sf::IPAddress, try to connect with him."
- If successful, match starts.
- Then it's pretty much like a chat, where player send commands to each other.
Did I get it right? Is it really that simple (I should not say that, I know I'll regret)? What other concepts should I grasp?

Thanks!

11
Window / Poll Event issues
« on: April 03, 2016, 07:02:57 am »
Briefly put, the issue is this: a few seconds after having the program running, the pollEvent function in one of its iterations takes a long time (more than 1 second) to do whatever it does.

1) This lag spike happens only once in the entire execution, and it only happens some time within the first 5 seconds of execution. It will run normally after that.

2) I had this problem with SFML 2.0 and now with SFML 2.3.2.

3) I'm using sf::RenderWindow.

This is the code:
...
    while(window.isOpen()){
        sf::Event ev;
        sf::Clock cl;
        while(window.pollEvent(ev)){
            printf("ev.type = %d took %.6fs\n", ev.type, cl.restart().asSeconds());
            if (ev.type == sf::Event::Closed){
                window.close();
            }
        }
    }
...

First execution:


Second execution:


Third execution:


Detailed description: I run the executable, it opens the window and runs the code fine, display whatever it has to display, 2-5 seconds after started, the lag spike happens. It doesn't matter if I let the mouse resting on screen or off-screen, if I don't move the mouse during this first 5 seconds, the next time I move the mouse, the lag spike will happen, 100% of the times.

I'm running Windows 10 and MinGW-4.9.3 compiler, although it also happened when using Windows 8.1 and some other previous MinGW version that I can't recall.

Thanks for helping!

12
Graphics / Maximum image size on old machines [Solved]
« on: March 18, 2016, 08:39:33 pm »
- I create a 1280x720 something.png image
- I change the extension to .bg
- I use sf::Texture::loadFromFile("something.bg")
- It says it can't load because maximum internal size is 1024x1024, and the image is 2048x1024

1) Why does it say the image is 2048x1024 when it is in fact 1280x720?
2) How outdated is this hardware for not being able to load a 1280x720 image?
3) Noob question: is this related to GPU or RAM?

Thanks!

13
SFML projects / [DOWNLOAD] Pointless Wars - [Turn-Based Pointless Strategy]
« on: February 29, 2016, 01:35:52 am »
Hi guys, I finally decided on the name and I'm ready to share with you!



No story, no reason, no problem!
Explore a beautiful world, fight unlikely heroes using the power of nature elements and questionable war tactics.
It would be a shame if you did all that for no reason at all.


Battle Gameplay

Objective
Win 2 consecutive battles.
The Army
In order to crush the enemy, you need an army.
The Challenge
After each battle, the loser can rebuild his army, and the winner will have his army recomposed with the same units he had at the start of the previous battle.
Can you win in disadvantage?



Strategy
Well... after building your army, just go for it! Just remember your units have weaknesses and your hero can only do so many things.



You can pick a battle formation, if that helps. Just kidding, it does help.


Game Modes

Campaign: Fight for no reason!
All the answers you need.



Online/LAN: Fight for pride!
Beat people online and... get bragging rights?
Arena: Fight for power!
Beat all the heroes and... feel accomplished!



Custom Game: Fight for fun!
Remove overpowered heroes, increase luck factor, make it challenging, make it easy, play with friends.

Leave your thoughts! Thanks!  ;D
@davi_doro

14
SFML projects / Feedback Request
« on: February 17, 2016, 10:14:20 pm »
Hello again! This is the game I'm working on. Say whatever comes into your mind, I'm gathering input to decide on the name!

Genre: Turn-Based Stategy.
Atmosphere: comedic, humorous, makes fun of itself.
Theme: Mostly medieval.
Short Description: Two players fight each other with armies, engaging in battle after battle.



Win Condition: Wins the game whoever wins 2 consecutive battles.
Resources: Each player controls an army composed of 50 units and 1 hero.
  • Units: Each unit has one of four attack types (Fire, Water, Earth, Air) and different resistances to these types. When attacking, units will target random enemies (see exceptions on Mechanics)
  • Heroes: Each hero has a type and special abilities such as intimidate the enemy, convert units, confuse the enemy, explode the world, etc.
Challenge: After each battle, the loser can rebuild his army, and the winner will fight with the same army composition of the previous battle.
Mechanics (these can change): In order to win a battle, and therefore the war, the players make several decisions such as:
  • Hero selection: before the game begins, a random pool of heroes is shown to the players. They take turns choosing the heroes they want to take to the battle until all the heroes are picked.
  • Army composition: the loser of the previous battle will rebuild its army. A random pool of units will be available for him to pick from. Hint Hint: you want to counter the enemy weaknesses, but you don't want to build an army that is easily countered.
  • Actions: in his turn, the player will choose an action for the hero and for his army. Most hero abilities are passives (positive effects on allies and negative effects on enemies). The army does most of the killing.
  • Battle Formations: the formation grants passive positive effects on allies such as:
    Spear: when attacking, your units will prioritize the targets they are most likely to kill.
    Ellipse: grants +1 resistance of all types for all your units.
    Square: higher chance of winning in close combat.
    Hint Hint: If you are the first player to attack, you may want to adopt an aggressive formation, and if you are the first to defend, you may want to adopt a defensive formation. Or not, it's your call.
  • Close Combat: After each turn the armies will move forward. When they meet, in the center, the army that is winning (the army with more units alive) can choose between 3 close combat options:
    Army vs Army: 100% chance of winning, unless the enemy adopted a Square-Formation.
    Man vs Man: a random unit of each army volunteers itself to fight. Their type and resistances matters on the winning chance.
    Hero vs Hero: Fire > Air > Earth > Water > Fire. Heroes die permanently, but this battle victory will not count for the win streak needed.
Game Modes: campaign, local single player, local multiplayer, online multiplayer.
Custom Games: The players can customize matches to make it more or less challenging, or more or less RNG dependent, etc, where they can make several changes such as:
  • Eliminate heroes and/or units from the pool: if they feel some character is overpowered they can remove it from their custom games.
  • Change win streak needed to win the war: 2 win streak is challenging enough, I promise you.
  • Change number of turns per battle.
  • End all battles in Army vs Army combat.
  • Change time to think.
My Goals: I would say my goal is to create a game that is easy to learn and difficult to master. I'm not pretentious enough to claim that I'm achieving that, but that's what I'm aiming for  :)


15
SFML projects / [POLL] Name This Game
« on: February 14, 2016, 10:02:07 pm »
Note: I'll make a Round 2 of this poll including the suggested names and the winner of this poll.










Yes, this is a heart battle formation.

Pages: [1] 2
anything