Jump to content

  • Log In with Google      Sign In   
  • Create Account

Servant of the Lord

Member Since 24 Sep 2005
Offline Last Active Yesterday, 09:28 PM

#5304887 Sfml-Cross-Platform-Alternatives

Posted by on 09 August 2016 - 08:32 AM

SFML is nice, and SDL is also; SDL is a C-like library.


I like SFML slightly more, but sometimes it gets in the way of rapid prototyping in a way SDL doesn't.

Currently I stick with SFML though.

#5304810 Can Render Triangle And A Quad, But More Complex Shape Results In Segfault

Posted by on 08 August 2016 - 10:13 PM

I think you're still misunderstanding how glVertexAttribPointer is used; the answer is not "3". The absence of crashing doesn't mean the code is correct, unfortunately.  :( 
Imagine you have vertex structure like this:

struct Position
     float x, y, z;

struct Color
     uint8_t r, g, b, a;

struct Vertex
     Position position;
     Color coloration;

"Position" (in this example) is one entire attribute that has three float components. "Color" is a separate attribute with four uint8 components.
In this example, you'd set it up like this:

 	3, GL_FLOAT, //Position has three floats. 
 	GL_FALSE, //We don't want it normalized.
 	sizeof(Vertex), //The entire stride, from one Position to the next Position (normally the size of the Vertex).
 	(GLvoid*)offsetof(Vertex, position)); //The offset of the 'Position' struct within the 'Vertex' struct.

 	4, GL_UNSIGNED_BYTE, //Color has four unsigned bytes. 
 	GL_TRUE, //We want 0-255 normalized to be 0.0 to 1.0.
 	(GLvoid*)offsetof(Vertex, coloration)); //The offset of the 'Color' struct within the 'Vertex' struct.

#5304718 Using Other Cultural Traditions In A Fantasy Game?

Posted by on 08 August 2016 - 01:30 PM

My concern is that in the middle ground I end up creating a game where priests run around swinging incense censers to fight yeti and eating the host to power up. That is, I capture the elements of a culture and then mishmash them in a slightly nonsense and profane way. I mean, that game sounds kind of awesome as an intentional thing, but weird as a cultural misunderstanding thing. I like the idea of the realms of rebirth colliding, it puts all these interesting characters in direct contact, but for all I know that could strike someone in that culture as silly or slightly offensive.


Many many games have misunderstood, misinterpreted, or even openly bashed the Christian religion (usually leaning towards more Eastern Orthodox or Catholic depictions, because the ritualism is cool to depict). I don't mind it so much. The same bashing over and over again gets tired for lack of originality or, heck, a lack of even knowledgeable criticism, but I absolutely don't mind portrayals - even accidentally butchered ones. The Japanese anime, manga, and videogame industry, often add Christian symbols and characteristics to otherwise completely not-Christian characters - that's so mild I wouldn't even consider it a portrayal, more of a friendly pilfering of symbols. Christian priests and clerics are stand-by tropes in almost every online RPG (Asian-esqe monks are pretty common too, with Ninjas and Samurai being less-common but very much present).


Some games even seem to intentionally try to profane Christian topics (rather than intelligent debate or knowledgeable criticism) - which just comes across as a jerky thing to do. I don't get why it's open hunting on intentionally distorting Christianity, but 'cultural insensitivity' for using other cultures in works of fiction? Like JK Rowling getting bashed for "culturally appropriating" native american lore in an entirely unmalicious way.


Apparently we're supposed to have cultural diversity portrayed in our works, while also only ever depicting the culture we're personally from.  :rolleyes:


Ofcourse there's also the benefit of sticking with what you know, and what you are familiar with. I suggest you just approach it with respect, and learn about and research what you are going to depict (if for nothing else than inspiration), but otherwise do your thing. It's practically guaranteed that you'll be bashed by some parts of the public no matter what you do. Probably people who haven't even played your game, and aren't even from the culture you are portraying.  :rolleyes:

People seem to enjoy finding things to be offended about nowadays, so I'd just be prepared with pre-planned responses, and otherwise dismiss them. If they make a good point, then say, "Hmm, that makes sense. Thanks for bringing that to my attention! I'll remember that in the future."


Pursing humor in different cultures is a much more tricky tightrope to walk:


"A foreigner is a man who laughs at everything except jokes. He is perfectly entitled to laugh at anything, so long as he realises, in a reverent and religious spirit, that he himself is laughable. I was a foreigner in America; and I can truly claim that the sense of my own laughable position never left me. But when the native and the foreigner have finished with seeing the fun of each other in things that are meant to be serious, they both approach the far more delicate and dangerous ground of things that are meant to be funny. The sense of humour is generally very national; perhaps that is why the internationalists are so careful to purge themselves of it. I had occasion during the war to consider the rights and wrongs of certain differences alleged to have arisen between the English and American soldiers at the front. And, rightly or wrongly, I came to the conclusion that they arose from the failure to understand when a foreigner is serious and when he is humorous. And it is in the very nature of the best sort of joke to be the worst sort of insult if it is not taken as a joke." - GK Chesterton


I haven't watched the Simpsons in, well, probably close to a decade now. But I used to watch it very frequently. I greatly enjoyed the humor surrounding the greedy lacking-in-faith Reverend Lovejoy as well as hyper-conservative Ned Flander. But there was two kinds of humor often depicted: One was laughing at the absurdities of Christianity from an outsider's perspective - observational humor (and sometimes situational). This was very enjoyable, because it was true observational absurdity. It is humor that Christians and non-Christians can both enjoy together. The other type is bashing or jabbing at the Christian religion to appeal to non-Christians. This is an intentional attack on part of your audience to appeal to the other part of your audience. That kind of humor I don't enjoy, and by it's very nature is divisive and disrespectful.


People can get offended at anything, so my suggestion is not to be offensive - not to make attacks (even as "jokes"), but don't worry too much about non-attacking portrayals and usage - people will get offended, so be prepared to give a friendly non-aggressive response.

#5304554 Can Render Triangle And A Quad, But More Complex Shape Results In Segfault

Posted by on 07 August 2016 - 06:55 PM

There's six indices

You're right; the spacing between them confused me.

Things are being done very manually here though, because it's a utility method that creates a primitive.
The idea being that all the magic numbers are hidden inside a method call.

All magic numbers ever, are "hidden inside" a function or class or source file. The point is to explain the magic numbers (and gain the benefit of strongly-typed variables), as well as centralizing the location to change, so that different pieces of code relying on the same value don't have to be manually updated if the value changes in the future.

I don't think it would makes sense to introduce a constant called NUM_VERTICES_IN_A_TRIANGLE or something like that.

Actual lines from my code:

static const size_t VerticesPerQuad = 4;
static const size_t IndicesPerQuad = 6; //Two triangles, sharing 4 vertices, have 6 indices.

The point is, when I see something like this:

glVertexAttribPointer(1, numVertices, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const void *)3);

I go, "wait, what is '3' supposed to represent in this context?"

'1' is fine, though.



For example, isn't the final parameter of glVertexAttribPointer() supposed to be an offset in bytes? Why are you hardcoding a byte offset into your vertex structure?

[Edit:] Bah, I'm super distracted in multiple browser tabs. sirapalee already mentioned that.


Also, my OpenGL skills are very poor, but I don't think the second parameter is the number of vertices.  :ph34r:

#5304536 Problem With Cs:go Sensitivity C++

Posted by on 07 August 2016 - 03:47 PM

Well, maybe it's set to 0.0220009 (or whatever), but the display only shows up to six decimal places.

#5304365 Alternative To Equipment In Rpg

Posted by on 06 August 2016 - 11:45 AM

Just equip materia onto each ab of your monk's six-pack.  :P 

You can collect and equip things that are purely "conceptual" - Paper Mario has you collecting and equiping 'badges', but you can easily use gems, rings, or even non-physical "essences".

#5304300 Only 12 Enemies, And My Fps Drops To 30, Why Is That?

Posted by on 05 August 2016 - 10:24 PM

But the real reason is that I really didn't have the desire to test it because there was so much stuff that could go wrong and I didn't want to turn 30 minutes into 2 days, because this is what happens most of the time when I make moderately big changes to my code.

Sounds like you need a source control system. Most people use git and github; I personally use hg and Bitbucket.

This allows you to "rewind" your sourcecode days, weeks, or months, so you can spend a week experimenting, and if it didn't work, rewind to what previously worked. Basically, you can have multiple different historical branches of your code saved (and backed up online, privately, for free).

#5304299 Problem With Cs:go Sensitivity C++

Posted by on 05 August 2016 - 10:16 PM

Do not take this as offensive, but you look a little confused on this matter and I will not continue to answer you

Seeing as he took the time to try to help you, and made very reasonable assumptions, that is offensive. It's unfortunate he didn't have the perfect answer for you (none of us do), but this is exactly the methods programmers use to find answers.


His point about the command console is important to: The command console likely will display 0.022 and 0.022000 in the exact same way, depending on whether the value the console is displaying comes from (internal to the game) strings or float variables.

I seek help in relation to the performance of both values ​​and not supostes guesses among other unrelated aspects you referred to.

Debugging is the process of making intelligent guesses, and then following up those guesses with verification.

Seeing as none of us are interested in fully debugging it for you, we've offered intelligent guesses, but you have to debug it yourself.
I've basically put in as much effort as I care to.

#5304220 Only 12 Enemies, And My Fps Drops To 30, Why Is That?

Posted by on 05 August 2016 - 10:04 AM

Guys, you still haven't answered my question about precalculating and storing the matrices that hold the interpolated transformations in order to save some cpu on skeletal animation. What do you think about that? :huh:


I think it's possible it could be slower (because the CPU is fast, accessing RAM is slower, so sometimes it's faster to calculate things on the fly, depending on how much you are processing, where it's located in memory, and the cost of the calculations), but that there's a chance it could be faster, so measure it.


Also, optimize at higher levels of abstraction first (big-picture program flow) - you get some of the best performance gains there.

#5303858 Theory Behind These Uncharted 4 Bullet Trails

Posted by on 03 August 2016 - 03:20 PM

I don't know how they achieved it, but when people want thicker textured lines, sometimes they use long narrow quads.


Since the line gets distorted, imagine you had a collection of line-segments attached to vertices, with each segment actually being a thin quad.


As the wind blows on the bullet trail (or rather, as you randomly pertube the trail), you distort the line vertices in-equally, distorting the appearance trail. Further, you also fade out the quads to make the trail fade into non-existence, and don't forget the quads themselves can be animated (with subtle smoke animation).

#5303835 Mapping C++ Entrypoint Into Dll

Posted by on 03 August 2016 - 11:14 AM

The SDL api uses a #define:

#define main SDL_main

So the user's int main() becomes int SDL_main(), and SDL's library has int WinMain() vs int main(), and etc, based on the OS...


SFML does it without macroes (except on iOS), using this method:


Most of SFML offers the choice of DLLs or static libs, but for one library sfml-main is static linked, and contains the entrypoints and then calls a user-provided standard entrypoint (int main()).


#include <windows.h>

extern int main(int argc, char* argv[]);

    return main(__argc, __argv);


So if one part of your library could be statically linked (or perhaps the whole library, if you don't have any licensing kerfuffles), you could define WinMain() there, and have WinMain call main().

#5303831 Problem With Cs:go Sensitivity C++

Posted by on 03 August 2016 - 11:01 AM

Well, without seeing CS:Go's source code, it'd be hard to know the cause for sure. I was looking through Source SDK 2013 on github, but it was rather hard to follow using the github interface, and I don't want to invest the time to download it, so I'm not positive if it went through the atof() code path or not. Note: atof() does convert it to a double, and then it's cast down to a float by Valve's code; and because I didn't download the entire code, I wasn't 100% positive if it was standard atof() or a custom implementation.


But since it is values loaded from config files, I'd hold on to my initial guess that the problem is in the text-to-float conversion function.


However, judging from Source SDK 2013, it shouldn't matter during multiplayer if sv_cheats is off, and sv_cheats shouldn't be on if the server disabled it.


If you are claiming that CS:Go allows you to speed up your mouse movement by tweaking the config file, while playing multiplayer on a server with sv_cheats disabled... if all four of those variables are true: different speeds, via config files, in multiplayer, on cheat-disabled server, then that is a bug that should be complained about to Valve, because it's directly something their code (or at least the Source SDK 2013 code) explicitly attempts to prevent, but apparently fails.


Or are you claiming that CS:Go's mouse speed is different than CS:Source's? If so, comparing the two games (rather than the same game with merely different configs), that's an entirely different issue.

#5303740 Problem With Cs:go Sensitivity C++

Posted by on 02 August 2016 - 08:33 PM

You're saying, there seems to be a difference between "0.022000" and "0.022" where no difference should actually exist.


My question is, where are you finding these values?


If they are in a configuration file (a text file that the game loads), then it goes through different code logic than if the values are directly found in a source code file.


If it's in a code file (usually with the file extension: .c, .cpp, .h, or .hpp), then there shouldn't be a difference between the two, as far as I known (but I'm not particularly knowledgeable of floating point binary representations).


But if it's in a config file, then that means "0.022000" and "0.022" are text that Valve's code has to read and interpret. It's perfectly possible that Valve's code has a bug in it, when interpreting from the text symbols "0.022000" to the actual number 0.022. Maybe when trying to eliminate superflous zeros, it accidentally removes one extra character and results in 0.02 instead, for example.


Because it's odd to add extra zeros after the decimals, it's possible the bug escaped notice for quite some time.


This is pure speculation, but would be where I'd begin looking. It'd be very easy to test, with Halflife's public source code.


[Edit:] It looks like they are just using (float)atof(str), so that's a dead end. For multiplayer, they do force it to be either -0.022 (for inverting mouse controls) or 0.022, if sv_cheats is turned off.



Are you positive there is a real difference in speed between the two, or is that just a rumor?

#5303726 Character Alignment In Single Player Rpg

Posted by on 02 August 2016 - 05:45 PM

I'm going to offer some criticism, but just to be clear, this doesn't mean don't pursue your idea, it just means think about what benefits you actually gain, and whether the detriments are worth it.

In most RPGs the player is the archetypical hero fighting to slay the big bad.

Solution: Write a better story.

I envision a system where you are asked a series of alignment questions at the start of the game...

At the start of the game? That's often the worse time to ask any question.

One game design guideline is, "Don't ask players to make choices before they are knowledgeable enough to give informed answers."

(Note: Guidelines are default lines that guide you to better design, but not absolute rules. You should feel free to break out of the guidelines after you comprehend the "why" of the guideline and make an intentional decision to design outside of it for rational well-thought out reasons. But if you don't understand why that's a good guideline, then you breaking out of the guideline will likely be handled poorly)

...and that is how your character starts out.

One of the major reasons some people play RPGs is for the ability to make choices and customize their player.

This could also be done with a short series of quests, where the way you complete them determines your starting alignment.

Why not just ask me what alignment I want to play as?

Knights of the Old Republic tried to detect my alignment, but kept posing scenarios that often gave stupid options that I'd never pick, so I was forced to choose something that rarely lined up with my actual motives.

I'd often make decisions that I felt was reasonable and not-evil, and it'd give me dark-jedi alignment points for them, because the game tried to detect my motive (which was impossible for the game to know) based off my actions. You're making the same mistake.

As the story progresses, it may turn out that you are the big bad, attempting to overthrow the emporer and rule the land.

So, by branching the paths, you're quadrupling your workload, because you are making alot more content that most of your players will never see if they only play a single playthrough (and I'd guess less than 10% of your players will play more than one playthrough).

As you progress through the game, your alignment would affect things such as what kind of magic is made available to you.

That's terrible. You're removing my choices.

"Games are a series of interesting decisions" - Sid Meier

Instead of empowering me, the player, by offering me important real decisions, you're trying to have your computer detect what I would want or should have based on entirely unrelated actions I took much earlier in the game. No thanks!

Think of it: Suppose you see me kick a dog. Humans are already terrible at detecting my motive (alignment) for doing so. But not only are you terrible at detecting my motive, you're going to write code that's even WORSE at detecting my motive, AFTER limiting my choices down to three or four arbitrary dialog choices that you force on me that I'd never have chosen anyway, and use that to try and detect my motive, and then use that failed detection to try to determine how my character should behave, what he'll become, and what rewards he'll get. You're taking everything about role-playing out of RPGs.

I get it if you write a really good story, so now I'm playing the role that you have defined for me. Great! That's what books (and many RPGs) do.

But if you pretend I'm playing my own character, defined by my choices, and then keep forcing decisions on me based off of your flawed interpretations of my earlier decisions, then I'm no longer playing my character. It'd be like me trying to play my character, and you keep on overruling what I'm wanting my character to do by making decisions for me, while continually trying to pretend it really is my choice.

Although I appreciate the extra work involved, I am aiming for this game to be procedurally generated with automated quests whose goals adapt towards your alignment.

So now we have a human who is terrible at judging my actions writing code that's worse at judging my actions, and using it to generate quests that are absolutely horrendous at judging the motives of my actions.

You'd probably have better accuracy flipping a coin to determine whether I'm playing a good or evil character.


If you are using the famous D&D alignment system, Lawful and Good are on two separate axes. They aren't the same thing.

D&D has two separate axes:
Lawful <-> Chaotic
Good <-> Evil

Most villains are Lawful Evil, like Darth Vader.
Some villains are Chaotic Evil, like the Joker from Batman.

Some heroes are Chaotic Good, like Robin Hood.

Lawful/Good? Get an invitation from the order of Paladins.  Evil? Get approached by a necromancer, etc.

And what if I want to be evil and infiltrate the Paladins? e.g. Emperor Palpatine from Star Wars.

What if I want to be good, but want to try to sway the Necromancer away from the dark arts? Or what if I just go to the necromancer, not for anything malicious, but merely because he happens to be good at sewing corpses together, and I want to be a medic?

Obviously I'm not expecting you to script every possible option. All I'm saying is, if I go with the Necromancer and you ASSUME it's because I'm evil, you are making the exact same mistake KOTOR made.

Some that I've thought of are theft and assassination

Both which can be done for non-evil reasons.

NPCs will also interact differently with you.  Perhaps you get a discount from the local blacksmith because you saved his son in a side-quest, or you are shunned by the town and need to go to the black-market underbelly.

This is fine, because just as you personally are terrible at determining my motive based on my actions, so are NPC villagers. If they mistakenly think I was being evil when I killed their inn-keeper, that's a legitimate interpretation for the NPCs to make, and that legitimately can govern their behavior and actions towards me.

Party members may only join your party if your alignments are compatible (or you have high charisma to trick them into joining you).  As you adventure together the choices you make may force some of them to leave your party or even attack you, while others will "have your back".

Overall, my suggestion is not to think in terms of alignment. I believe in black-and-white morality, but I also believe your interperations of my morality based on my actions is heavily suspect.

Instead, have your world and NPCs react to actions, and constantly remember that your interpretation of the reason for those actions is always wrong. No, I really do mean always wrong. Because for any action you put in the game, if a thousand people play your game, every "evil" action will be chosen by someone for a good morality reason, and every "good" action will be chosen by someone for a bad morality reason.

The best way to handle it is for every situation where some NPCs react in a negative way, do some good writing and make some NPCs "see where [the player] is coming from".
Jeff Vogel talks about this (coming from a different angle) in his RPGs.

Here's him talking about one of his games (Geneforge):

"The Geneforge games are very morally open-ended. I have long been annoyed with fantasy's over-reliance on characters who are all-good or all-evil. I wanted to write a game where you could play through the whole storyline looking for this guy who is evil, meet the guy, listen to his side of the story, realize he has a point, and join him. And I did. It's called Geneforge.

The Geneforge games are full of factions you can join. Some are sensible. Some are insane. Some are peaceful, and some are violent. Only a few of them are truly bad people, trying to do horrible things. I tried to be truly even-handed when making the factions. When writing them, I always had them make the case for their point of view as clearly and convincingly as possible. When I wrote a faction, I was really trying to convince the player to join it.

This is what I am most proud of about Geneforge: I have gotten many e-mails that said, "I loved the games, but I had one problem. I joined [some faction], but I thought you made it too obvious that [that faction] was the right faction and I was supposed to join it." They were all convinced that I was secretly supporting their own pet faction. Hee!


Compare this with my experiences playing KOTOR 1 and 2 (which, don't get me wrong, were great games!).

KOTOR: Girl asks me to train her as a Jedi. Sure! -> MASSIVE dark side points. Apparently she was from an order that swore an oath to never learn jedi powers. I just offered to help her because: A) She asked politely and B) She was was rather cute and was basically flirting with me.  :P

She made a great apprentice though - I taught her how to dual-wield frost-blue lightsabers and had her specialize in anti-droid combat. By the end of the game, her morality was higher on the light-side than mine was.


KOTOR: Guys in shiny armor ask for my help in overthrowing a tyrant. Sure! -> MASSIVE dark side points. Turned out the people in shining armor were evil (they were nice enough to me!), and that the "tyrant" was loved by her people. K... so I made a massive mistake that NPCs should react negatively to. That's absolutely awesome. What's not absolutely awesome is KOTOR using that to try and determine that I'm playing an evil Jedi (I wasn't), and using that to limit my future options, which two hours of gameplay later seriously lead me to have zero choice but kill a half-dozen benevolent Jedi masters in some absurd bid to wipe out the Jedi order, which had ZERO to do with my actual motives and choices earlier in the game.

The two major lessons here is,
1) No matter how well you think you are setting up choices to be clearly good or evil, you still can't determine any player's moral alignment from that.
2) If you're a terrorist trying to bomb an airport, just ask me to hold your bags for you, because I'm super gullible when it comes to helping people.

Determining public reputation? That's fine. Limiting my future actions (and taking away choices) purely because you think you know what I want to do? Not fine.

#5303721 Problem With Cs:go Sensitivity C++

Posted by on 02 August 2016 - 04:43 PM

CS:GO Default:
m_pitch 0.022000
m_yaw 0.022

but if you change m_pitch from 0.022000 to 0.022 there is a difference in sensitivity which makes it a bit slower


If those are values entered into a config file, it's possible their text-to-float conversion functions are buggy, and interpret 0.022 and 0.022000 differently.