I would probably make a game state class rather than doing all those switch statements in your GameEngine functions.
This could either be a polymorphic class, or a template class with an integer template argument, or a class that does these switch statements for you.
I would do a polymorphic class. vfunc overhead should be negligible as the gamestate should rarely change.
same with map location.
nfries88Member Since 11 Nov 2006
Offline Last Active May 23 2016 11:47 PM
- Group Members
- Active Posts 581
- Profile Views 6,227
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
Posted by nfries88 on 28 March 2016 - 08:12 PM
I would probably make a game state class rather than doing all those switch statements in your GameEngine functions.
Posted by nfries88 on 28 March 2016 - 07:03 PM
It's also using three xors to swap two variables, instead of using std::swap(), which is much more readable (and probably faster too).
(for pointers and integer types, the performance of three xors would be the same as std::swap on most processors. the three xors method avoids a temporary and may perform marginally better in some cases)
I am trying to understand the line:
if ( ++count > n/2-1) break;
how it works with regards to n. The variable n is incremented in the first do...while loop. If n is found to be odd then there is truncation.
n is the number of expressions entered.
count is the number of times expressions have been "merged" with parenthesis
since this code only appears to group two expressions and one operator per set of parenthesis, and because at least one expression must be an operator, it can have at most ((n / 2) - 1) groupings.
I must say, this is an awkward piece of code, it assumes all operations are associative, and it took me a minute to just understand what it was supposed to be doing, it took me a few more minutes to understand why it was breaking the loop that way. This was in a textbook??? If I encountered a piece of code as awkwardly written as this in a project I was working on, I would probably leave that project.
Posted by nfries88 on 27 March 2016 - 07:17 PM
A minor in business administration would certainly help you with your own business, but it's not a strict requirement. I know a handful of small business owners who have obtained varying levels of success and only one of them has any formal business education. If you wanted to take business administration courses just to get the knowledge, you could always do this after completing your degree.
Since you want to make educational games, a minor in education might be appropriate as well. This might also help you to be selected over another candidate in some company working on educational games.
I have no musical talent. I understand that [...] it could be beneficial to know how to make music for my own game.
I can't play musical instruments, but I do have a good ear; it probably takes me longer than it would a practiced musician, but I've used various tools to make great musical loops. It might be worth investigating.
Posted by nfries88 on 27 March 2016 - 04:49 PM
You do not need a copy constructor to pass a parameter by value.
Then how would it be copied?
Move construction is used when an rvalue or xvalue is passed by value and the type has a move constructor.
@OP: Are you calling this function like Node::addAction(std::move(upAction))? Otherwise "upAction" (or whatever unique_ptr variable you're passing into the function) should be seen as an lvalue by the compiler and copy construction will be attempted (Visual C++ might be allowing it because the function is inline).
Posted by nfries88 on 26 March 2016 - 08:22 PM
gravity is applied to Y speed, not Y position. The Y speed low value pattern makes sense.
This speed is then subtracted from the Y position - (Y position low -= Y speed high; Y position fraction -= Y speed low).
Y position low and Y position fraction are, together, a normal 16-bit integer in which the lower 8 bits are representative of a fraction of a pixel.
Y speed high and Y speed low are the same - Y speed low is also a fraction of a pixel.
Posted by nfries88 on 25 March 2016 - 08:58 PM
- Your game will not be confused with or believed to be related to or come from the same source as this other game
- Opportunity for the game to have its own unique brand
- Easier to find your game by search
- (Personal opinion) you can probably come up with a better name
- Would require code changes
- The people already interested in your game will have to remember it under a new name now.
Personal view: continue using Fireworks Factory as a working title, and change it shortly before release, to minimize risk of another totally unrelated game using your new title and having to change the title AGAIN
Posted by nfries88 on 25 March 2016 - 08:20 PM
Maybe have NPCs at the starting point offer to show you how to do this or that, and you can choose to take advantage of their guidance or not. This makes each step of the tutorial both optional and repeatable. Legend of Zelda: Ocarina of Time had a tutorial along these lines (except you had to actively seek out people for guidance, they weren't simply presented to you).
Or you might want to consider delaying the introduction of gameplay elements in order to avoid overwhelming a first-time player. Brutal Legend is the first game that comes to mind.
Posted by nfries88 on 25 March 2016 - 07:52 PM
if you don't need to quantify how much a person feels towards you about a specific thing, and instead can get away with a set of true/false opinions, you can capture this in a bitset.
You could also capture NPC personality in a bitset.
[bitset of history with player]
bit0 = 1 if insulted
bit1 = 1 if victimized (if your game allows stealing or assaulting NPCs)
bit2 = 1 if intimidated (if your game allows intimidation, blackmail, etc)
bit3 = 1 if not intimidated
bit4 = 1 if last persuasion attempt failed (if your game has a persuasion feature)
bit5 = 1 if last persuasion attempt succeeded
bit6 = 1 if player has helped the NPC by completing their quest
bit7 = 1 if player has failed the NPC's quest
[bitset of NPC personality]
bit0 = 1 if easily offended
bit1 = 1 if vengeful or judgemental
bit2 = 1 if fearful
bit3 = 1 if challenging
bit4 = 1 if unreasonable
bit5 = 1 if reasonable
bit6 = 1 if grateful
bit7 = 1 if vengeful or unreasonable
You can then mask these two bitsets (opinion & personality) to obtain a useful approximation of the NPC's feelings toward the player as a third bitset.
You can then use additional response masks to determine if an NPC should be angry, fearful, respectful, amicable, etc towards the player. Using the above examples:
angry = 1001 1011
afraid = 0000 0100
respectful = 0110 0100
amicable = 0110 0000
If you need a way to quantify these feelings to determine what face an NPC should make or the tone of their responses to the player, you could use a combination of population count (= number of reasons an NPC has to be angry, afraid, respectful, amicable, etc) and a multiplier (= NPC's relative valuation of the reasons for each emotion).
I've never used such a system or know of it being deployed previously, so I don't know how well it would work in practice. I just like bitsets.
Posted by nfries88 on 25 March 2016 - 07:15 PM
It's like he declare a variable of type LTexture.
Yes, that's exactly what he's doing. LTexture is a class type, his gSpriteSheet is a variable of type "class LTexture".
Posted by nfries88 on 25 March 2016 - 07:11 PM
I don't know your game. All I can do is give you some general advice.
Do you have game objects that do not require all of these features? If not, then the features that are not universally necessary probably don't belong in that class.
It looks like this is becoming a "god class". It does everything. If your game is relatively complex, having a "god object" might become a pain to manage. It might help to separate these features into their own classes, and then have your "god class" inherit from these classes, or have each instance contain an instance (or pointer to an instance) of these classes. The latter version is generally the best; it helps with many common situations, like having multiple game objects with the exact same physical appearance then can share an instance of a "Visual" class.
Posted by nfries88 on 25 March 2016 - 07:00 PM
It might help to delay the broadcasting of messages for a short time (like 1ms) to wait for messages with earlier timestamps to come in, and then broadcast messages in proper time-order. This would require time stamps with greater than 1ms precision though.
The problem could be because of how you're sending the data to begin with. For example, if you're sending position updates instead of velocity updates, it might minimize the issue to do velocity updates.
Posted by nfries88 on 25 March 2016 - 06:46 PM
The fraction pattern is actually right, and that's what's bugging me, honestly. If it wasn't for those values, I'd get the idea.
Why don't you post the every position value (high and low, not just the fraction) and maybe I or someone else might see the pattern more clearly. No point in me duplicating the work you've already done just to help you finish, right?
Posted by nfries88 on 24 March 2016 - 11:17 PM
and whether the parties' goods and/or services are sufficiently related that consumers are likely to assume (mistakenly) that they come from a common source.
Yes, if someone was downloading a software package named "google", one could very well assume that Google created it, until actually researched.
It passes the Moron in a hurry test, because even a reasonable person in a hurry might get confused.
Again, I'm not a lawyer, maybe "the intended audience would be able to tell the difference at their first attempt to use the product" would not be a valid defense.
the defendant's intent in adopting its mark;
I'm pretty sure they mean "intent" as "reasons for", like if the defendant's reasons for adopting the mark were to benefit from the popularity of the plaintiff, then obviously it's trademark infringement.
The only difference between a package named "Google" and a package named "kik" is that both you and I are very familiar with Google, whereas both you and I aren't the user demographics of kik, and so never heard of it until now. But seeing that it has 240 million user accounts (let's assume 40 million active accounts), that's a very huge number.
The strength of the plaintiff's mark is very strong, being in use since 2009, registered since 2010, with 240 million users, and, according to the company, "used by approximately 40 percent of United States teenagers".
Actually, as we're both programmers, we kind of ARE the target audience of both products that were vying for the same name. If neither of us have heard of kik before this, does it really have "strength" with us?
I really doubt that argument would hold up in court. But it makes sense to me.
Posted by nfries88 on 24 March 2016 - 10:39 PM
I agree with Servant here, you would benefit from having game states to separate the combat game state from the "running around" game state.
And assuming you have graphics (this isn't text based) and aren't going super basic - like Dragon Quest combat basic - you're also going to want your player characters and enemies to be finite state machines for sanity's sake. You wouldn't want an enemy to launch its own attack before it's recovered from being knocked back by a player's attack, would you? (assuming this doesn't lead to some weird bug, it just winds up looking wrong).
I was planning on making a turn based RPG, looking at your reply this is what I'm thinking I could take a Combat instance that takes the function from the objects into a function? So just as an example say we label the combat function processTurn() where it takes in attack(), magic(), defend(), item(), run() from both the monster and player or would it be easier to bundle those all into say action()? I am probably overthinking this xD, if I'm even making sense.
Presumably you'll have a list of spells here, not just one, right? So a single magic() function doesn't work like it does for attack/defend/run. You have lots of options - you can add a function for each spell, you can try to pack spells into a "universal format" of some sort as a struct or class and pass that into a magic() function, which uses that data to do the math. Or you can do magic(spell id) - which then calls the function for that spell by lookup. I definitely recommend you do that last one for items.
If you have limited options to begin with, it doesn't make any sense to multiplex them into a single function just to demultiplex again within that function. Let the input handler / enemy AI figure out which function to call for this turn, and then call it at the appropriate time.
Posted by nfries88 on 24 March 2016 - 09:17 PM
Without knowing what type of game you're making: typically players and enemies will have multiple combat options, not just one. It might be simpler to have separate objects (or even just functions) for each combat type, which take relevant data from the originator of the combat event, does some math, and then applies damage (and displacement and whatever else is needed) to the target.