Jump to content

  • Log In with Google      Sign In   
  • Create Account

Servant of the Lord

Member Since 24 Sep 2005
Offline Last Active Oct 20 2016 09:42 AM

#5315745 When you realize how dumb a bug is...

Posted by on 18 October 2016 - 06:15 PM

Many times I talk to my friend about what I programmed and what it does (or doesn't because of a bug) just in the sake of telling someone what I did "today" even when my friend has no clue about any sort of programming.


That's sometimes called "rubber ducking", because some people use a rubber duck or a portrait of a famous computer scientist like Donald Knuth of John Carmack to "explain the problem to".

#5315343 When you realize how dumb a bug is...

Posted by on 15 October 2016 - 10:52 AM

Like an artist becomes "blind" to his work and can't see the mistake when others can. That happens sometimes to me, can't see the mistake in my own code when I've been working on it hours and hours straight.


An artist trick is to hang your painting on a wall somewhere where you'll see it by accident before you remember it's there, and it'll let you take in the whole picture for a moment before you get into "artist mode".


I wonder what an equivalent programmer trick might be? Maybe it'd help if there was a switch in the IDE that swapped to a different color-style and a different spacing/curly-bracket style, (and maybe randomize the variable names to animal names ("tiger = 27", "aardvark = (panda - dragon);"), so you temporarily feel like you're reading someone else's code. Hit the switch, go for a ten-minute jog, come back and read "Bob's function" which you have to learn fresh.

#5315342 Running both server and client on one PC causes lag despite ping < 1 ms.

Posted by on 15 October 2016 - 10:30 AM

Seems enough for now. I hope there aren't any floating point errors that can accumulate and mess up my timers with time.



(the article the image is taken from - interesting read, but the war isn't over yet)

#5315065 Bulk key purchase price

Posted by on 13 October 2016 - 03:49 PM

Thanks all! It's a reputable site (not a reseller) that works like a bundle, and has featured titles such as DX:HR, Alien Isolation, Wolfenstein New Order etc.


That just means they got a hold of several Steam keys for those games, not that the developers/publishers of those games are willing to work with them.




They're responding with how much marketing and buzz it will do but... I don't know, I was part of some small give aways and one bundle so far and can't quite say I noticed much of an impact, viability-wise


Some developers even in big bundles like Humble Bundle claim they didn't get any significant exposure boost (but that the cut of Humble Bundle profits can be nice).


If a random internet user wanted to buy N copies of your game ("to sell on ebay!"), what price would you offer him?

What minimum quantity of keys would you make them buy before getting a slightly better discount?

#5314760 Running both server and client on one PC causes lag despite ping < 1 ms.

Posted by on 11 October 2016 - 06:07 PM

This is how I do the packet sending in my server. Done every 75 milliseconds. Timer starts counting when the server application is started.

void NetworkManager::serverSendPackets( vector<Player>& players )
    //Create a bitstream and broadcast all players' positions to every connected client
    RakNet::BitStream bsOut;
    bsOut.Write( ( RakNet::MessageID )ALL_PLAYERS_POSITIONS );

    for( int i = 0; i < players.size(); ++ i )
        glm::vec3 vec = players[ i ].mainCam.getCurrentPosition();
        bsOut.Write( vec.x );
        bsOut.Write( vec.y );
        bsOut.Write( vec.z );
    peer->Send( &bsOut, IMMEDIATE_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true );//Broadcast set to true.

And the client sending is absolutely lightweight, I just send a few RakNet::MessageIDs which are of type 'unsigned char'. Done every 75 milliseconds. The timer starts counting when the client application starts.

void NetworkManager::clientSendPackets( vector<Player>& players )
    RakNet::BitStream bsOut;

    if( myPlayerID >= 0 && players.size() > 0 )
        if( players[ myPlayerID ].moveForward == true ) { bsOut.Write( ( RakNet::MessageID )PLAYER_MOVE_FORWARD ); }
        if( players[ myPlayerID ].moveBackwards == true ) { bsOut.Write( ( RakNet::MessageID )PLAYER_MOVE_BACKWARD ); }
        if( players[ myPlayerID ].moveLeft == true ) { bsOut.Write( ( RakNet::MessageID )PLAYER_MOVE_LEFT ); }
        if( players[ myPlayerID ].moveRight == true ) { bsOut.Write( ( RakNet::MessageID )PLAYER_MOVE_RIGHT ); }

    if( bsOut.GetNumberOfBitsUsed() != 0 )
        peer->Send( &bsOut, IMMEDIATE_PRIORITY, RELIABLE_ORDERED, 0, serverGUID, false );

EDIT: or maybe this RELIABLE_ORDERED stuff slows something down?


EDIT No.2: ApochPiQ, I was randomly changing values I don't understand and I suddenly found the right one: I changed RELIABLE_ORDERED to UNRELIABLE_SEQUENCED, and IMMEDIATE_PRIORITY to MEDIUM_PRIORITY. I tested it, there is no lag now. But every 4-5 seconds I get a dropped packet and my game freezes for 50 ms, which sucks





I timestamped the position packets that are sent from the server and the time varies from 22ms to 36ms and it's mostly 26-27ms. And I'm using to connect. I think this is too much for two 3D vectors, am I right?




EDIT: Another weird problem. When I start the server, and then the client, sometimes the timestamping is 24-32ms as I told you earlier, but sometimes it gets to 52ms, 52ms, 51ms, 52ms and something like that. It depends on which time I start the client app.


Good news: This has nothing to do with your network or laptop.


If every 75ms the client sends it's location to the server, and every 75ms, the server sends its location to the client, that means purely based on your code, your game can artificially delay for between 0 and 150ms.


Imagine your position is PosA, and the client sends PosA, and 5ms later the client processes the "move up" key (you're now at PosB). Oops, you have to wait 70ms before the client decides to inform the server of the new position. Finally, years later, the client tells the server "I'm at PosB", but the server's update tick happened 5ms ago, so now the server pointlessly waits 70ms before sending back to the client the new authoritative position. Round trip in this example: 140ms.


Toss in graphics VSyncing, and RakNet deciding to hold onto packets for a few extra millaseconds, and an occasional dropped frame, and then it seems like your game "randomly" chooses a new round-trip time.



The solution is to make the client use whatever information it has at its disposal to make the game visually look smooth, which means, yes, move your character instantly (doing client-side collision tests) even while waiting for the server to respond with the authorative position.


The server must be the authority. The client can't tell the server "I am here, trust me!", but the server tells the client, "You are here, trust me". So the server has to check collisions also (though you can get by with less accurate checking, simply to detect cheating). But processing the client's move client-side should begin instantly.

#5314290 How to make console-like GUI

Posted by on 07 October 2016 - 04:23 PM

I'm making a text adventure game in C++ with VS2015, hoping to make a console-like GUI, where I plan to add some visual effects with OpenGL later. Similar example would be the control panel in Fallout, which is shown below. I'm hoping to create a content-only GUI, without the window edges, like Qt applications have. I'm wondering what GUI libraries could be best for these objectives? 


A) You want this console window *inside* your game, or is this console window going to *be* your game?

B) You mentioned a "content-only GUI, without the window edges", could you show a screenshot of what you mean?

C) You mentioned Qt. Are you using Qt?

#5314289 Billboard Particle Sorting

Posted by on 07 October 2016 - 03:59 PM

Distance to eye (pythagoras)


If you do that, don't forget that you only need to compare (A2 + B2), you don't have to get the real distance (sqrt(A2 + B2)).

Save yourself a few hundred thousand square roots.  :)


Do you even need to sort them? Have you already tried just disabling depth-writing (but still depth-test), and see how it looks? Sure, it won't be accurate, but it might look good enough to satisfy you.

#5313654 How to implement a object manager class?

Posted by on 02 October 2016 - 07:55 PM

One of the pitfalls for your current method is that you're likely going to be writing a lot of "GetType() checks" (and other various virtual calls) in your code as you iterate across your entities vector.  A way around this is to organize your object lists in a way that minimizes or eliminates the need for virtual calls.     Employing a Component/Entity/System approach can help achieve this.


Seeing that so many intermediate programmers get snared on CES, either by overabstracting and over-engineering, or simply not understanding it, I'd suggest the OP holds off on exploring that avenue.  :)


Probably the easiest way forward, depending on the number of different entity types, is simply to have a different container for each broader type.

Player player;
std::vector<Wall> walls; //If a box is just a wall that can be moved, then pass a bool 'movable' to the Wall class.
//There can be different types of enemies, defined by passing variables into the Enemy class without the need for inheritance.
std::vector<Enemy> enemies;

To the OP: Since I'm not sure how many completed projects you have under your belt already, I'd suggest a primary goal of completing a game rather than engineering it perfectly, and then using that knowledge to figure out what went right and wrong in the big picture. Code cleanly, but from an architectural standpoint, I'd suggest KISS.

#5313527 How do desginer design their game to be fun?

Posted by on 01 October 2016 - 04:36 PM

Just understand that not all gameplay needs to be like that. It can even be exhausting for the player if you require constant focus on solving difficult problems.


Good points! We don't want to wear the player out with repetitive things that aren't engaging.

Though It's interesting that even exhaustion can be enjoyable if handled correctly by a game.

#5313438 Talent Systems Discussion

Posted by on 30 September 2016 - 09:35 PM

I haven't played WoW, so I'm not 100% sure what Talents even are (are they skills?), but the director of WoW said their talent system didn't work as well as they had hoped, and instead praised Call of Duty: MW2's system as superior (in some aspects). Note: The company that owns Call of Duty (Activision) merged with Blizzard to form Activision-Blizzard, shortly before he had said that, so he wasn't praising a competitor's game (which would carry even more weight in my mind).


One of my favorite games from my childhood is Quest 64. In Quest 64, when gain enough experience, you get a single point to put into your magic. You can put it into four different categories: Fire, Water, Earth, Wind. My family each chose a different element.


Two things were exciting about this system:

A) You can find skill points (called 'wisps') scattered around when exploring the world. Real skill points. That's pretty crazy, but very enjoyable. You find a wisp, click on it, and it's exactly identical in behavior as if you had just leveled up. Even catching a glimmer of a wisp was exhilerating.


B) You didn't know when a new skill would be unlocked. You'd gain a new skill for every 4 points you put in that element, but it might be three or five or even six points before you get a new skill. So after every point put in, we'd scramble through our sprawling non-linear skill menu checking if any new skill was unlocked, which built anticipation, like looking for an Easter egg. It was very pleasurable to finally see one in the menu!


C) Finally, you didn't know what that skill would be! Once a skill was unlocked, it'd just say it's name ("Water pillar" or "Hot steam"), and you'd have to actually use it in battle to learn what it did, and how to properly direct it at enemies (there was no targeting system).


(This was in the era where we barely had the internet, and while using GameFAQs on occasion, we tended to avoid spoilers).


D) This was my first RPG ever, so at the time we didn't know what 'experience' was. As far as we were concerned, we'd randomly get level ups when defeating enemies, which was another burst of exhilaration any time it occurred. 

It took us awhile to realize that this sucker wasn't tracking the day/night cycle:  :P



Even after knowing what it tracked, it was still exhilarating to level up, because the experience bar wasn't constantly visible on the HUD. To paraphrase Sean Connery in Finding Forester: "The key to a gamer's heart is an unexpected gift, at an unexpected time."



Another system I loved was Fable's. Fable discarded leveling up entirely, and instead let you accumulate experience, and use experience as a currency to (effectively) "purchase" new skills (in a skill tree), or purchase level ups for those skills.

Further, there were three separate skill trees: Dexterity based, Magic based, and Strength based (or something like that - it's been awhile). If you used mostly Strength-based experience against an enemy, it'd give you General experience (spent on whatever tree you wanted) as well as Strength experience (spent only on the Strength skill-tree). So there were three types of experience based on what types of skills you were actually using, plus a general experience spent however you wanted.



A third system I enjoyed was Paper Mario's (a Mario turn-based RPG).

It was broken into two system:

1) First, you gained experience from enemies and leveled up (like many RPGs), and upon each level up, gave you three choices: Increase your max HP, Increase your max MP, or Increase your max Badge points.


2) Badge points let you equip badges. Badges are skills - either usable or constant effect (so you can equip constant-effect skills that are continuously on at no MP cost). You find badges in the world through exploration and so on (some merchants sell a few of them). There's a fixed number of badges in the world, almost all of them unique, but a few have duplicates, and they can be stacked.


By having badges instead of skills, Paper Mario lets you continually reconfigure/reequip what 'skills' you have (similar to, say, Final Fantasy 7's material). Different badges take different number of badge points to equip, so you have to make choices based off of trade-offs ("I can have this really powerful attack, but it takes five badge points to equip! I only have 14 badge points, so that'd mean I probably wouldn't be able to equip my constant-effect health regen badge, or my badge that reveals hidden items as I'm exploring... Or the badge that lets me use two inventory items (necessary for healing) on one turn...")



[Edit:] Could you go into detail about how WoW's Talent system works, and what you enjoyed about it? I'd love to hear what parts of it made it so enjoyable to you!

#5312674 MVC understanding

Posted by on 26 September 2016 - 09:40 AM

MVC should help to organize code, but for now it turned my code into complete mess.


When you get into design patterns in general (of which MVC is just one of many), then you need to quickly learn that design patterns aren't applicable everywhere, they don't have to be implemented exactly as described, and they aren't legos that you build with (they are shorthands you use to describe concepts).


What this means is:

A) Is this the appropriate place to use MVC?

B) What is the best way to implement it in this situation?

C) Are you using it just because you've heard about MVC, or are you using it because you have a genuine need for MVC?


Also, MVC is primarily about separation of concerns, not necessarily code organization.


Some people implement MVC as a View, with the Model also being the Controller. Sometimes the Model and the View are both controllers. There are other good implementations too. It's important to realize that different projects have different needs, and there's not "One True Implementation" that solves everything for every problem.

Often, you don't need to pass messages to the View, just give the View a pointer/reference to the Model, otherwise you'll be duplicating the same data in two different locations.


I would argue that, in this situation, making 'Game' have separate Model, View, and Controller is overkill. With Player is could be overkill, but might not be. With Board it's often a good idea.

#5312594 the dreaded "escort" quest

Posted by on 25 September 2016 - 08:43 PM

how about a "deliver message" (or whatever) type quest, and they give you a couple of warriors (temporary followers) as bodyguards, and you get quest encounters with double (or at least higher than usual) number appearing. would that be ok? that _would_ make it a quest - as opposed to a player initiated action.


That could work, if, for example, you have five people guarding you, and you suddenly get ambushed by 12 or so enemies trying to intercept the message, so you have to escape out of danger (with close to zero chance of defeating all the enemies), with your escort trying to buy you time to escape ("We'll hold them off - hurry and get out of here! Our tribe's survival depends on you delivering that to <allied tribe>!").


I don't think that can be pulled off more than once (or twice) in one game though.

#5312335 the dreaded "escort" quest

Posted by on 24 September 2016 - 12:20 PM

One of the most memorable COD missions is a reverse escort quest :D


That was fun. They pushed some of those missions a bit too much in later CODs though.


I think another nice twist on escort quests, would be quests where you are "escorting" specific NPCs from afar, by covering them with a sniper rifle or helicopter, or heck, a bow and arrow. I'm sure there are some examples of that, but I don't remember any off-hand. Usually the COD "overlord" missions were more shooting fish in a barrel type of fares, rather than focusing on covering specific individuals even if that was ostensibly what you were doing.

#5312334 the dreaded "escort" quest

Posted by on 24 September 2016 - 12:10 PM


you would have to rely on a more powerful character who is escorting you through an area full of extremely powerful enemies or environmental hazards

but what would be the reason for the player to enter such an area?


To get to the other side?

Imagine you are in Valley A, and you are trying to get to Valley B, which is also your level, but between the two is Really Dangerous Canyon of the Cockatrices, so you need an escort.

You are merely trying to get through a very difficult area.

Another reason is because you are trying to collect something in a cave, filled with noxious gases (or darkness), and you need to stay close to the mage who casts a barrier of good air (or light).
^ This becomes a collection quest, but with an added mechanic that makes it feel different.


Or maybe it's a "Kill <Specific Enemy>" quest, but the specific enemy is way above your level, so it turns that boss-fight into a "survive the boss for enough time for <Your Powerful Escort> to kill the boss", which is an interesting twist on regular boss-fights, AND acts as a power-benchmark for the player looking forward to the future when he's powerful enough to kill the same species of boss (i.e. a large dragon).

it would probably play out much like a regular escort quest. you stick to the NPC like glue, not so they won't die, but so you won't die.

But conceptually, and practically, it is different:

A) When you wander outside of the escort's purview, you have ZERO nagging feeling that the AI is going to get killed.
B) You feel awed at the dangerous creatures around you.
C) Because you are in a really dangerous area, you feel extra tension and concern for yourself.
D) You are more likely to like the NPC as a character, writing-wise, then if he was a nuisance to you. Psychologically, you might even feel gratitude or admiration.

It's a very significant twist - I wish I could upvote Demiurgic_Amon several more times for suggesting it.  :)

#5312179 Leveling up through mini-quests?

Posted by on 23 September 2016 - 05:20 PM

Because you're building your stats because on the quests you do. Rather than the number of enemies you've killed or number of times you've used a weapon, skill, or magic.


If you want to be a warrior, you'll do quests that will strengthen strength, attack, physical defense. If you want to be a thief, you'll do quests that will strengthen intelligence, agility, stealth.


In 'Fable' (one of the first two - I haven't played the others), you have four different experiences that act as currency:

- General experience can be spent on anything

- Three different attribute-specific experiences (I think they were Strength-based skills, Dexterity-based skills, and Magic-based skills).


When defeating an enemy, depending on what abilities you used to defeat it, you'd get that same kind of attribute-specific experience as well some general experience, providing a mix of freedom to develop your character how you want (using general experience), and also growth in the same area you are actively using (the other experience types).




Kill 10 slimes in a normal RPG would add EXP points and going to the next level will up all your stats. Move 10 rocks will increase your strength only. Kill 10 bears will increase only your strength and your stamina.


So to try to put it another way, the events (as I call them) only increase a particular stat (or two depending on the quest).


What if I take the "Kill a bear" quest, and I kill him by pushing rocks over a cliff edge onto his head? Your quest wouldn't recognize it, because it sounds like you are designing your quests to force the player to approach them a specific way. 


Suppose I kill the bear via dousing it in gasoline and lighting it on fire? Or kill it with arrows from 100ft away? How is strength involved?

Suppose I kill the bear by running away from it, and luring it to try to cross a rope bridge, and then it falls to its death when I cut the rope?


Obviously not all these mechanics will be implemented in your game - my only point is underlining that your are forcing players into "one true way" of solving the quest, or at least rewarding them as if there is only one true way. i.e. your quests aren't a challenge of choices and thought, but a challenge purely of action, with the solution pre-prescribed.


When I "Kill a bear", regardless of how I accomplish it, the game pretends I really did "Kill a bear with a sword in close-combat while within 20 ft of its starting location."



Your design could certainly be made to work for a game or two, but as a general improvement over existing experience systems, I feel like there are too many cons and not enough pros.