its interesting that they are doing that with SQL Server but I kind of just assumed that SQL Server was doing something with memory and not just constantly hammering the disk
Timezones are easy. I had to implement time synchronization at one point on some craptastic embedded network. (I don't remember why we couldn't just use NTP. Whatever the reason was, it was so stupid that I blocked it out.) The ordeal convinced me that time, as a concept, is bullshit.
Later, I read Relativity, by Einstein, which reinforced this belief.
We actually have an internal document we can wave in front of management/customers about the mathematical underpinnings of NTP whenever they ask us to try to make it do something that it just can't do. Some of that shit makes my brain leak out of my ears.
Anyone here familiar with the party game Mafia (or as we call it here, Phalla)?
I'm writing a Mafia engine for a challenge I want to run on another site, where people will write bots that play Mafia and try to win the most. Obviously communication is a major part of the game, and obviously computers aren't so great at communication, but I want there to be at least enough that the bots can do a bit of strategy (things like "remembering who claimed to be the cop and what their reports were, and then trusting that player more if lynchings confirm their reports, or voting for them if someone else dies and is revealed to be the cop"). I feel like the way to make that easiest on everyone (and not require a Watson-on-Jeopardy level of natural English parsing skill) would be to have a set of predefined messages the bots can say publicly or in whispers to each other. In theory this is fine, the only problem is making sure those messages are widely defined enough that the bots can say whatever they want to say. What else can I add to this list?
No
Yes
I think this player is suspicious: (!)
I trust this player: (!)
Do you think this player is mafia? (!)
I am a cop
I am a doctor
I am a normal villager
I tried to save this player: (!)
I successfully saved this player: (!)
I investigated this player and found that they were mafia-aligned: (!)
I investigated this player and found that they were village-aligned: (!)
Will you please use your power on this player tonight? (!)
I think this player is the cop: (!)
I think this player is the doctor: (!)
I think this player is a normal villager: (!)
I think this player is mafia: (!)
Messages with "(!)" will have the name of a player attached to them. The only roles are cop, doctor, villager and mafia.
Pokémon X | 3DS Friend Code: 0490-4897-7688
Friend Safari: Fighting - Machoke, Pancham, Riolu | In game name: Jessica
Official Weather Gym Leader of the G+T Pokémon League. @me to try for the Climate Badge!
Is there a technical reason why every single programming language I can think of with functions (I'm hesitant to say "all" considering the sheer number of languages there are out there) stops executing a function when it hits a return? Is it more difficult to write a language where these two functions are the same?
I feel like it would probably be less convenient than the alternative most of the time, but sometimes you would want it that way. Are there languages that do it that way?
I only ask because I had to write a() today and was curious.
undergroundmonorail on
Pokémon X | 3DS Friend Code: 0490-4897-7688
Friend Safari: Fighting - Machoke, Pancham, Riolu | In game name: Jessica
Official Weather Gym Leader of the G+T Pokémon League. @me to try for the Climate Badge!
Typically you would reorganize "A" so that return returns the final state of what you need.
Hardly would you ever want to return an object, and then do more work on it, without changing the state of that object previously. I think you're working from a different perspective than you should be there, and focus more on logical and procedural way of doing things.
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
In def b() what does the return even mean if you want it to execute the item on line 8 anyway? I'm not sure I get what you are trying to solve.
For example, I wrote a function that returned the contents of a file and emptied the file. I needed to use the contents of the file elsewhere, so I returned that value, but I still had more I had to do in the function so I had to store it in a temporary variable for a bit.
I'm not even saying this is a good way to do it, I'm just curious if there are any languages that do it that way.
undergroundmonorail on
Pokémon X | 3DS Friend Code: 0490-4897-7688
Friend Safari: Fighting - Machoke, Pancham, Riolu | In game name: Jessica
Official Weather Gym Leader of the G+T Pokémon League. @me to try for the Climate Badge!
In such a case, you would send a copy of the contents to another function, then return it.
Depending on your language you have a few options. C/C++ allow you to pass by value or pass by reference, reference would mean you're working with live data, where value means it does a shallow copy IIRC.
Python I think uses pass by reference unless the object is immutable (string?) and assignments are mostly about handling references rather than copying data.
So in such a case you'd want your code to probably be something like this:
Is there a technical reason why every single programming language I can think of with functions (I'm hesitant to say "all" considering the sheer number of languages there are out there) stops executing a function when it hits a return? Is it more difficult to write a language where these two functions are the same?
I feel like it would probably be less convenient than the alternative most of the time, but sometimes you would want it that way. Are there languages that do it that way?
I only ask because I had to write a() today and was curious.
You want coroutines, and the usual terminology there is to yield (return, save state, can be resumed)
As for languages, lua is the first one that springs to mind. Python does something very similar with its iterators
Anyone here familiar with the party game Mafia (or as we call it here, Phalla)?
I'm writing a Mafia engine for a challenge I want to run on another site, where people will write bots that play Mafia and try to win the most. Obviously communication is a major part of the game, and obviously computers aren't so great at communication, but I want there to be at least enough that the bots can do a bit of strategy (things like "remembering who claimed to be the cop and what their reports were, and then trusting that player more if lynchings confirm their reports, or voting for them if someone else dies and is revealed to be the cop"). I feel like the way to make that easiest on everyone (and not require a Watson-on-Jeopardy level of natural English parsing skill) would be to have a set of predefined messages the bots can say publicly or in whispers to each other. In theory this is fine, the only problem is making sure those messages are widely defined enough that the bots can say whatever they want to say. What else can I add to this list?
No
Yes
I think this player is suspicious: (!)
I trust this player: (!)
Do you think this player is mafia? (!)
I am a cop
I am a doctor
I am a normal villager
I tried to save this player: (!)
I successfully saved this player: (!)
I investigated this player and found that they were mafia-aligned: (!)
I investigated this player and found that they were village-aligned: (!)
Will you please use your power on this player tonight? (!)
I think this player is the cop: (!)
I think this player is the doctor: (!)
I think this player is a normal villager: (!)
I think this player is mafia: (!)
Messages with "(!)" will have the name of a player attached to them. The only roles are cop, doctor, villager and mafia.
Since communication publicly + privately may be more difficult and isn't consistent with the in-person base game, you could consider just having public only. If you did, you'd want to have an additional name in some of those messages for who it is being directed to. Probably a good idea even if you go public + private, so that they could be used by bots publicly.
Anyone here familiar with the party game Mafia (or as we call it here, Phalla)?
I'm writing a Mafia engine for a challenge I want to run on another site, where people will write bots that play Mafia and try to win the most. Obviously communication is a major part of the game, and obviously computers aren't so great at communication, but I want there to be at least enough that the bots can do a bit of strategy (things like "remembering who claimed to be the cop and what their reports were, and then trusting that player more if lynchings confirm their reports, or voting for them if someone else dies and is revealed to be the cop"). I feel like the way to make that easiest on everyone (and not require a Watson-on-Jeopardy level of natural English parsing skill) would be to have a set of predefined messages the bots can say publicly or in whispers to each other. In theory this is fine, the only problem is making sure those messages are widely defined enough that the bots can say whatever they want to say. What else can I add to this list?
No
Yes
I think this player is suspicious: (!)
I trust this player: (!)
Do you think this player is mafia? (!)
I am a cop
I am a doctor
I am a normal villager
I tried to save this player: (!)
I successfully saved this player: (!)
I investigated this player and found that they were mafia-aligned: (!)
I investigated this player and found that they were village-aligned: (!)
Will you please use your power on this player tonight? (!)
I think this player is the cop: (!)
I think this player is the doctor: (!)
I think this player is a normal villager: (!)
I think this player is mafia: (!)
Messages with "(!)" will have the name of a player attached to them. The only roles are cop, doctor, villager and mafia.
Statements about communications with other people: I told X: <statement> and X replied: <statement>. And the generic "X is truthful/lying"
In def b() what does the return even mean if you want it to execute the item on line 8 anyway? I'm not sure I get what you are trying to solve.
For example, I wrote a function that returned the contents of a file and emptied the file. I needed to use the contents of the file elsewhere, so I returned that value, but I still had more I had to do in the function so I had to store it in a temporary variable for a bit.
I'm not even saying this is a good way to do it, I'm just curious if there are any languages that do it that way.
VB! :P
function VBBad (...)
VBBad = somecall_with_sideeffects()
call do_something VBBad, other_call()
end function
You return a value by assigning to the function name at any time (0 to many times). But then you're coding in VB so...
Oh ask them whether they removed HA Mirroring support in SQL 2014? I know they are pushing to using HA AlwaysOn Availability Groups in 2014(available in Enterprise only) and people were worried that they would force people to move to Enterprise to have any HA but I'm also reading that they didn't pull the trigger yet on removing Mirroring in 2014. A clear answer would be nice.
We discussed that yesterday. Mirroring is deprecated, you'll definitely want to look at AlwaysOn AG though if you're on 2014. Deprecated, not removed, yet.
We discussed that yesterday. Mirroring is deprecated, you'll definitely want to look at AlwaysOn AG though if you're on 2014. Deprecated, not removed, yet.
That's good. Gives us a few more years to figure something out for the customers that want HA but only pay for SQL Standard edition. With bigger customers we already are starting to deploy using AlwaysOn AG's with Enterprise Edition.
We discussed that yesterday. Mirroring is deprecated, you'll definitely want to look at AlwaysOn AG though if you're on 2014. Deprecated, not removed, yet.
That's good. Gives us a few more years to figure something out for the customers that want HA but only pay for SQL Standard edition. Big customers we already are starting to deploy using AlwaysOn AG's with Enterprise Edition.
Yeah, AG beats the pants off Mirroring (we setup some active failovers, and you can have read-only access to secondaries even when the link is down now) but you need Enterprise.
It isn't clear how long Mirroring will be an option for Standard, but it definitely is in 2014. I think that it will stick around as long as HA AG is Enterprise-only, due to customer demand.
Seriously, the Standard licensed businesses would jump ship instead of upgrading if it was dropped.
I thought of a question... What version of the .NET CLR is SQL 2014 running? I know they updated to .NET 4.0 for SQL 2012(Our assemblies are all still .Net 2.0 cause most of our base is SQL 2008 R2)
In def b() what does the return even mean if you want it to execute the item on line 8 anyway? I'm not sure I get what you are trying to solve.
For example, I wrote a function that returned the contents of a file and emptied the file. I needed to use the contents of the file elsewhere, so I returned that value, but I still had more I had to do in the function so I had to store it in a temporary variable for a bit.
I'm not even saying this is a good way to do it, I'm just curious if there are any languages that do it that way.
VB! :P
function VBBad (...)
VBBad = somecall_with_sideeffects()
call do_something VBBad, other_call()
end function
You return a value by assigning to the function name at any time (0 to many times). But then you're coding in VB so...
I think pascal returns values in the same way too
(technically you can return values before doing other things in python using try/finally, but that's for making sure stuff runs even if you're not handling an exception, and it's also more typing, so don't abuse it unless you want those semantics)
End on
I wish that someway, somehow, that I could save every one of us
I thought of a question... What version of the .NET CLR is SQL 2014 running? I know they updated to .NET 4.0 for SQL 2012(Our assemblies are all still .Net 2.0 cause most of our base is SQL 2008 R2)
Is there a technical reason why every single programming language I can think of with functions (I'm hesitant to say "all" considering the sheer number of languages there are out there) stops executing a function when it hits a return? Is it more difficult to write a language where these two functions are the same?
I feel like it would probably be less convenient than the alternative most of the time, but sometimes you would want it that way. Are there languages that do it that way?
I only ask because I had to write a() today and was curious.
You want coroutines, and the usual terminology there is to yield (return, save state, can be resumed)
As for languages, lua is the first one that springs to mind. Python does something very similar with its iterators
Ruby does the same thing with blocks. In fact, that's exactly why file handling in Ruby is done using blocks by default.
Is there a technical reason why every single programming language I can think of with functions (I'm hesitant to say "all" considering the sheer number of languages there are out there) stops executing a function when it hits a return? Is it more difficult to write a language where these two functions are the same?
I feel like it would probably be less convenient than the alternative most of the time, but sometimes you would want it that way. Are there languages that do it that way?
I only ask because I had to write a() today and was curious.
Essentially, you are designating that "temp" is the agreed upon return value to the function. Matlab also performs essentially what you are describing where you state up-front the variables to be returned from the function. From there, you can proceed like b() with the post-condition that the variables will contain the values that you want to return when the function completes execution. Going further back, Pascal has somewhat similar semantics:
Underneath the covers, the return value is copied to an agreed-upon location by the function being called. You can think of the Matlab (and likely more accurately, the Pascal code) as exposing these semantics directly to the user. The C-style return statement can be thought of as an optimization of the common case where you assign-and-return immediately.
@TwitchTV, @Youtube: master-level zerg ladder/customs, commentary, and random miscellany.
I got Javascript: The Good Parts today and boy was that a quick read
To further elaborate: 100 pages, another 50 pages of appendices.
I quick-read through all of it in two hours. Interesting stuff, all of which I have no idea how to use practically. But I'm sure it'll be very helpful once I get a more solid foundation to work from.
Huh, compiling c# from command line is super easy. Kind of wish C++ was this easy.
I wanted to have my project in DLL form to drop into utility folders for using their internal components. So I made a bat to compile the whole thing into a DLL. Pretty neat.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Huh, compiling c# from command line is super easy. Kind of wish C++ was this easy.
I wanted to have my project in DLL form to drop into utility folders for using their internal components. So I made a bat to compile the whole thing into a DLL. Pretty neat.
Huh, compiling c# from command line is super easy. Kind of wish C++ was this easy.
I wanted to have my project in DLL form to drop into utility folders for using their internal components. So I made a bat to compile the whole thing into a DLL. Pretty neat.
Timezones are easy. I had to implement time synchronization at one point on some craptastic embedded network. (I don't remember why we couldn't just use NTP. Whatever the reason was, it was so stupid that I blocked it out.) The ordeal convinced me that time, as a concept, is bullshit.
Later, I read Relativity, by Einstein, which reinforced this belief.
We actually have an internal document we can wave in front of management/customers about the mathematical underpinnings of NTP whenever they ask us to try to make it do something that it just can't do. Some of that shit makes my brain leak out of my ears.
At one point in the 1970s, it became clear that the network of atomic clocks was getting out of synch by a few nanoseconds because they were at different altitudes, and therefore at different depths in Earth's gravity well, therefore time itself ran at slightly different rates in these different locations (specifically, slower at lower altitudes) due to general relativity.
After I read that I decided that ten microseconds was the best they were going to get out of this system and they'd need to deal with it.
Up until the point where some silly goose starts writing code that doesn't take into account timezones - and then starts adding more code to make up for their lack of understanding. Slowly, oh so slowly, your code base is infected by hideous hideous hacks that circumvent and subvert all those beautiful libraries that gracefully handle time issues for you and instead replaced with milliseconds multiplied by 60 and 24 and 1000 and string parsing being added everywhere.
i solved the only memory leak in my game last night
i was creating roughly 60 font objects per second and not freeing any of them. probably not optimal.
I've been trying to cut down on my CPU usage but I find the Gprof profiler that comes with C::B to be totally useless compared to what I am used to with Apple Instruments
I don't get full call stacks and I don't really get a breakdown of what inside the given function is being so slow
Don't worry about CPU usage on a PC platform, it's not at all indicative of how your game is profiling whatsoever. It's likely windows is devoting more resources to you because you're the thing using memory and CPU power at that point. There are still games from the late 90s that eat up ~100% of a CPU on an i7 to put it in perspective, and it's mostly a side effect of moving data between the CPU and GPU anyways and nothing you'll ever be able to control.
Mobile platforms are a bit more unique because you've got to take into account "if my app uses too many resources my game and the device will crash."
PC platforms, conservatively, you've got about 2 gigs worth of memory and about ~12 billion (i7 can go up somewhere near 20 billion) operations per second on a modern current gen PC. And that's just the CPU.
Unless you're dynamically generating everything in your game or calculating insane physics (kerbal space program) you're probably kosher.
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Well it depends. The classic read input, update world, draw frame approach is simple, but can get stuck at a few points.
It's inherently single threaded, and while modern CPUs will allow one half to use resources from the other half, the other cores will be idle, so you won't get your 12 billion instructions, more like 3-4. Memory access patterns from a game, particularly a game world for updates can thrash the cache pretty good. Lots of little branches can overwhelm the branch predictor. During the draw the world portion of it, you could easily be GPU-bound
Yeah I really simplified that explination a bit. Even at 4 billion instructions per second, that's a lot of maths. It helps to know what kind of design you're using. A game that is a dark souls ALLTP type game doesn't seem like it'd thrash the cache terribly much if at all.
I think he's safe. If I were pegging constantly at 80% on one core, then I'd be concerned. Maybe.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
I always thought that old games ate CPU because they weren't vsynced
I am using vsync in mine not only because it will eat less but also because running it at 300FPS heats up my laptop
It runs butter smooth but I just figure... the game is so simple right now it shouldn't be eating 20%CPU, because when I start generating dynamic light maps, I'll need to able to afford to make mistakes there with efficiency
I always thought that old games ate CPU because they weren't vsynced
I am using vsync in mine not only because it will eat less but also because running it at 300FPS heats up my laptop
It runs butter smooth but I just figure... the game is so simple right now it shouldn't be eating 20%CPU, because when I start generating dynamic light maps, I'll need to able to afford to make mistakes there with efficiency
That's part of it. They're typically generating frames beyond what is needed. I was looking through the code of one and it was generating about 600 or so "frames" per second in memory, regardless if the monitor or GPU could handle that.
The lighting is going to hit your GPU anyways, and completely ignore the CPU for the most part.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Yeah, CPU in a game engine is mainly how many objects (and to what detail) you have and how well you juggle.
The good part is that it is usually stuff you can rewrite and optimize without too much trouble. Eliminate/consolidate objects, pool resources, switch out data structures, etc. Whatever makes working with a frame update efficient.
Posts
I guess my expectations are too high
We actually have an internal document we can wave in front of management/customers about the mathematical underpinnings of NTP whenever they ask us to try to make it do something that it just can't do. Some of that shit makes my brain leak out of my ears.
Ok in memory db with SQL Server is actually cool/interesting.
I couldn't tell with the initial post if you were being serious or sarcastic.
Nintendo ID: Incindium
PSN: IncindiumX
I'm writing a Mafia engine for a challenge I want to run on another site, where people will write bots that play Mafia and try to win the most. Obviously communication is a major part of the game, and obviously computers aren't so great at communication, but I want there to be at least enough that the bots can do a bit of strategy (things like "remembering who claimed to be the cop and what their reports were, and then trusting that player more if lynchings confirm their reports, or voting for them if someone else dies and is revealed to be the cop"). I feel like the way to make that easiest on everyone (and not require a Watson-on-Jeopardy level of natural English parsing skill) would be to have a set of predefined messages the bots can say publicly or in whispers to each other. In theory this is fine, the only problem is making sure those messages are widely defined enough that the bots can say whatever they want to say. What else can I add to this list?
Messages with "(!)" will have the name of a player attached to them. The only roles are cop, doctor, villager and mafia.
Friend Safari: Fighting - Machoke, Pancham, Riolu | In game name: Jessica
Official Weather Gym Leader of the G+T Pokémon League. @me to try for the Climate Badge!
I feel like it would probably be less convenient than the alternative most of the time, but sometimes you would want it that way. Are there languages that do it that way?
I only ask because I had to write a() today and was curious.
Friend Safari: Fighting - Machoke, Pancham, Riolu | In game name: Jessica
Official Weather Gym Leader of the G+T Pokémon League. @me to try for the Climate Badge!
Nintendo ID: Incindium
PSN: IncindiumX
Hardly would you ever want to return an object, and then do more work on it, without changing the state of that object previously. I think you're working from a different perspective than you should be there, and focus more on logical and procedural way of doing things.
I'm not even saying this is a good way to do it, I'm just curious if there are any languages that do it that way.
Friend Safari: Fighting - Machoke, Pancham, Riolu | In game name: Jessica
Official Weather Gym Leader of the G+T Pokémon League. @me to try for the Climate Badge!
Depending on your language you have a few options. C/C++ allow you to pass by value or pass by reference, reference would mean you're working with live data, where value means it does a shallow copy IIRC.
Python I think uses pass by reference unless the object is immutable (string?) and assignments are mostly about handling references rather than copying data.
So in such a case you'd want your code to probably be something like this:
def a(): retVal = a_thing() another_thing_that_needs_to_be_done(copy.copy(retVal)) return retValYou want coroutines, and the usual terminology there is to yield (return, save state, can be resumed)
As for languages, lua is the first one that springs to mind. Python does something very similar with its iterators
Since communication publicly + privately may be more difficult and isn't consistent with the in-person base game, you could consider just having public only. If you did, you'd want to have an additional name in some of those messages for who it is being directed to. Probably a good idea even if you go public + private, so that they could be used by bots publicly.
Let me know how this goes.
Statements about communications with other people: I told X: <statement> and X replied: <statement>. And the generic "X is truthful/lying"
VB! :P
You return a value by assigning to the function name at any time (0 to many times). But then you're coding in VB so...
Both. Mostly just saying what I've been covering in this course so far.
I am in the Microsoft offices right now so I'm serious, if you have a question, let me know because I'll answer it or ask it.
Nintendo ID: Incindium
PSN: IncindiumX
Yeah I just found this
http://msdn.microsoft.com/en-us/library/cc645993(v=sql.120).aspx#High_availability
That's good. Gives us a few more years to figure something out for the customers that want HA but only pay for SQL Standard edition. With bigger customers we already are starting to deploy using AlwaysOn AG's with Enterprise Edition.
Nintendo ID: Incindium
PSN: IncindiumX
Yeah, AG beats the pants off Mirroring (we setup some active failovers, and you can have read-only access to secondaries even when the link is down now) but you need Enterprise.
It isn't clear how long Mirroring will be an option for Standard, but it definitely is in 2014. I think that it will stick around as long as HA AG is Enterprise-only, due to customer demand.
Seriously, the Standard licensed businesses would jump ship instead of upgrading if it was dropped.
Nintendo ID: Incindium
PSN: IncindiumX
I think pascal returns values in the same way too
(technically you can return values before doing other things in python using try/finally, but that's for making sure stuff runs even if you're not handling an exception, and it's also more typing, so don't abuse it unless you want those semantics)
The lab copy is running version 4.0
Ruby does the same thing with blocks. In fact, that's exactly why file handling in Ruby is done using blocks by default.
Essentially, you are designating that "temp" is the agreed upon return value to the function. Matlab also performs essentially what you are describing where you state up-front the variables to be returned from the function. From there, you can proceed like b() with the post-condition that the variables will contain the values that you want to return when the function completes execution. Going further back, Pascal has somewhat similar semantics:
http://en.wikibooks.org/wiki/Pascal_Programming/Syntax_and_functions
Underneath the covers, the return value is copied to an agreed-upon location by the function being called. You can think of the Matlab (and likely more accurately, the Pascal code) as exposing these semantics directly to the user. The C-style return statement can be thought of as an optimization of the common case where you assign-and-return immediately.
To further elaborate: 100 pages, another 50 pages of appendices.
I quick-read through all of it in two hours. Interesting stuff, all of which I have no idea how to use practically. But I'm sure it'll be very helpful once I get a more solid foundation to work from.
I wanted to have my project in DLL form to drop into utility folders for using their internal components. So I made a bat to compile the whole thing into a DLL. Pretty neat.
Come on it is super easy.
At one point in the 1970s, it became clear that the network of atomic clocks was getting out of synch by a few nanoseconds because they were at different altitudes, and therefore at different depths in Earth's gravity well, therefore time itself ran at slightly different rates in these different locations (specifically, slower at lower altitudes) due to general relativity.
After I read that I decided that ten microseconds was the best they were going to get out of this system and they'd need to deal with it.
(not knowing the specifics, I feel like "not hard" is probably relative)
(heh)
Up until the point where some silly goose starts writing code that doesn't take into account timezones - and then starts adding more code to make up for their lack of understanding. Slowly, oh so slowly, your code base is infected by hideous hideous hacks that circumvent and subvert all those beautiful libraries that gracefully handle time issues for you and instead replaced with milliseconds multiplied by 60 and 24 and 1000 and string parsing being added everywhere.
I made a game, it has penguins in it. It's pay what you like on Gumroad.
Currently Ebaying Nothing at all but I might do in the future.
i was creating roughly 60 font objects per second and not freeing any of them. probably not optimal.
I've been trying to cut down on my CPU usage but I find the Gprof profiler that comes with C::B to be totally useless compared to what I am used to with Apple Instruments
I don't get full call stacks and I don't really get a breakdown of what inside the given function is being so slow
Mobile platforms are a bit more unique because you've got to take into account "if my app uses too many resources my game and the device will crash."
PC platforms, conservatively, you've got about 2 gigs worth of memory and about ~12 billion (i7 can go up somewhere near 20 billion) operations per second on a modern current gen PC. And that's just the CPU.
Unless you're dynamically generating everything in your game or calculating insane physics (kerbal space program) you're probably kosher.
It's inherently single threaded, and while modern CPUs will allow one half to use resources from the other half, the other cores will be idle, so you won't get your 12 billion instructions, more like 3-4. Memory access patterns from a game, particularly a game world for updates can thrash the cache pretty good. Lots of little branches can overwhelm the branch predictor. During the draw the world portion of it, you could easily be GPU-bound
20% is not when you should be worried though
I think he's safe. If I were pegging constantly at 80% on one core, then I'd be concerned. Maybe.
I am using vsync in mine not only because it will eat less but also because running it at 300FPS heats up my laptop
It runs butter smooth but I just figure... the game is so simple right now it shouldn't be eating 20%CPU, because when I start generating dynamic light maps, I'll need to able to afford to make mistakes there with efficiency
That's part of it. They're typically generating frames beyond what is needed. I was looking through the code of one and it was generating about 600 or so "frames" per second in memory, regardless if the monitor or GPU could handle that.
The lighting is going to hit your GPU anyways, and completely ignore the CPU for the most part.
The good part is that it is usually stuff you can rewrite and optimize without too much trouble. Eliminate/consolidate objects, pool resources, switch out data structures, etc. Whatever makes working with a frame update efficient.
How those show up isn't so much CPU bound as GPU.
but my reading of SDL2 is that I will actually have to use the CPU to generate a full-screen lighting mask and overlay it on to my scene
so I will render out the scene to a texture, then mash my texture together with my light mask
SDL2's rendering abstraction doesn't support GPU shaders. so I have to do it on the CPU to maintain platform independence