Jump to content

  • Log In with Google      Sign In   
  • Create Account


Nypyren

Member Since 19 Aug 2002
Offline Last Active Today, 11:32 AM
*****

#5135251 code -> .data & data -> .code

Posted by Nypyren on 27 February 2014 - 08:00 PM

Jump tables for switch statements are technically data which are typically stored in the code section after the end of the function which contains the switch statement.
 
Microsoft compilers output files organized like so:
 
 
Headers
Code Section (the headers designate this section as Execute+Read)
    Function 0
        Instructions
        Optional: NOP or INT3 padding
        Optional: Case mapping table (and optional padding to the next pointer-sized boundary)
        Optional: Case block pointers (and optional padding to the next 16 byte boundary)
    Function 1
        Instructions
        ...ETC...
Initialized Data Section(s) (the headers designate these section(s) as Read+Write or just Read)
    Data!
Import Section (readonly after the loader finishes with it)
    Data!
Export Section (readonly after the loader finishes with it)
    Data!
Relocation Section (discarded after the loader finishes with it)
    Data!
Resource Section (readonly)
    Data!
(etc...)
Other compilers (or binary compressors such as UPX) are free to rearrange anything besides the main header that they want to.


#5134603 Can you talk the programming techno talk?

Posted by Nypyren on 25 February 2014 - 06:59 PM

I always just tell them to "Tighten up the graphics on level 3."




#5133165 Better way to write this code

Posted by Nypyren on 20 February 2014 - 11:03 PM

Apparently its not working. "nodes" is a 2d array


Ahh, I see. The primary set of LINQ methods work with IEnumerable<T>. 2D arrays appear to only implement IEnumerable but not the generic version of the interface. That's kind of strange considering the array rank doesn't affect whether it's homogenous or not...

In that case, you could add one more step if you REALLY wanted to do it this way:
 
return nodes
    .Cast<Node>() // Quick way to convert from IEnumerable to IEnumerable<Node>
    .Where(n => n.Number == number)
    .Select(n => n.Coordinates)
    .Cast<Coordinates?>()
    .FirstOrDefault();
(Personally, that's a lot of LINQ for such a simple operation. I would stick with the foreach loop.)


#5132997 Better way to write this code

Posted by Nypyren on 20 February 2014 - 11:44 AM

Linq might work for you if nodes is IEnumerable.


Anything that you can foreach is IEnumerable, so it will definitely work. smile.png
 
public Coordinates GetNodeCoordinates(int number)
{
     return nodes.FirstOrDefault(n=>n.Number==number)
}

This is similar to what I was going to write (above), but then I noticed that nodes in the collection contain the .Coordinates member, making First/FirstOrDefault not what you'd want (because you'd have to null check the node you get from that, then get .Coordinates from it, which ends up being one step more complex than doing the loop yourself). So I edited my post to agree with boogyman since that's exactly what I would write instead.


#5131170 stack overflows: why not turn the stack upside down?

Posted by Nypyren on 13 February 2014 - 08:34 PM

(Singing) "Whichever way the stack grows doesn't really matter to me!"


The heap grows the other way though... stack at one end, heap at other, of addressable memory. When they meet in the middle it's Bummed In The Gob Time ®


This doesn't apply to many modern systems. Consider that each thread in a multithreaded system needs its own stack.


#5130976 C# Scripting or Programming

Posted by Nypyren on 13 February 2014 - 01:01 AM

Those are just YOUR assumptions. I would especially never assume any particular compiler when talking about C++, after having used nine different C++ compilers so far (DJGPP, Intel, Watcom, Borland, MSVC++, clang, SN Systems, gcc, and CodeWarrior).

I would wager that the first time someone experiences using multiple compilers or execution environments, they stop making such assumptions.


#5130857 C# Scripting or Programming

Posted by Nypyren on 12 February 2014 - 12:22 PM

If you've ever written programs that integrate four different languages at once (C++, C++/CLI, C# and F#), "scripting" starts feeling like a totally inadaquate description of what's going on.

 

The different parts of a program are all just as important as the rest.  There is no "main" language.  If the core game loop, rendering, and physics code happens to be implemented in C++, but the remaining 80% of the code is in C#, does the concept of "scripting" have any useful meaning anymore?




#5130750 How much planning do game programmer before writing a single line of code and...

Posted by Nypyren on 12 February 2014 - 02:08 AM

My typical planning process is:

- Get assigned a task.
- Think about it a bit. Doesn't seem that bad...
- Suddenly realize how terrifying the task actually is.
- Panic for a while.
- Discuss concerns with teammates (this is the actual planning phase where we systematically address the scary bits).
- Overcome my terror and begin writing my plan *as* code.
- Iterate on the "plan" until it becomes the final implementation.


#5130199 How does one practice Scrum on himself/herself?

Posted by Nypyren on 09 February 2014 - 11:26 PM

Scrum is a buzzword - companies and teams will use the term even when their process is completely different than other companies/teams. There is no point practicing something as nebulous as that (especially without an actual team). You first need to find out what implementation a team is actually using.

I've experienced several different teams who all had different ideas of how scrum should function. Essentially, the only common theme is that there are morning meetings where everyone on the team wastes the majority of the morning describing what they've been working on (which 80% of the time is either "the same thing I worked on yesterday" or "bugs". The other 20% of the time there's actually some coordination discussion happening).

The more efficient teams I've worked with separated the morning meetings by department: A programmer-only meeting, an artist-only meeting, and a designer-only meeting. The different departments very rarely need to tell each other what everyone on the team is doing every day, so reducing the number of people per meeting means that the round-the-room goes faster and those people can get back to work sooner. Even better if the different meetings are in parallel, but unfortunately the producers typically need to be at each one, so the meetings are staggered throughout the morning.

As a non-management person, the only thing you'll do in the morning meeting is say what you're doing (during Beta phase this will literally be just "Bugs." until the managers get bored with that and reduce the meeting frequency to once a week). If anything's blocking your progress, mention that. Then it continues to the next person.

As a management person, you'll be taking notes about what each person says during every meeting, thinking about scheduling and load balancing tasks to workers. You'll be announcing any important news and reminding people of particular deadlines, and potentially setting up 'normal' meetings to actually discuss specific features/goals with the appropriate people.


There's nothing special you need to practice (unless you have a phobia about speaking in a room full of people), and without an actual team, there's no real way to practice.


#5129879 how to prevent save cheating? (for games where saving is NOT allowed)

Posted by Nypyren on 08 February 2014 - 12:58 PM

...code some vital parts in machine code...


I honestly laughed out loud...

Bro, do you even compile?


#5129701 human intelligence

Posted by Nypyren on 07 February 2014 - 03:44 PM

 

Actually the brain performs computations pathetically slow, being clocked at roughly 12-15Hz in rest and 30-50Hz under heavy load and having a "wire speed" of roughly 100-120 m/s (as compared to 3GHz and 300,000km/s in a computer).

Could you post a link to where you saw this because i'm certain that i read the brain is like an 18000MHz or more processor and the reason it can't perform certain mathematical calculations very fast is because of the body systems it manages.

*edit* make that the brain is over a 1,680,000 MHz processor and does up to/more than 100,000,000 MIPS so there is no way the brain is nearly that slow.

 


Are you the kind of person that considers a 6 core processor with each core running at 3 GHz to be the same as a single 18 GHz core?




#5129486 What algorithm would minimize repeat loading of every member of nxn grid+neig...

Posted by Nypyren on 06 February 2014 - 10:07 PM

I guess the algorithm I would use is:

- Load the first row.

- Load the second row.
- Process the first row.

- Load the third row.
- Process the second row.

- Unload the first row.
- Load the fourth row.
- Process the third row.

(repeat)

You only load each cell once, but your memory requirements are 3*n.

If those memory requirements are too high, then instead of a full row, load as much as you can in ways that minimize the amount of overlap when you move to the next loadable region.

If you load anything less than whole rows at once, I believe you will have to load at least one cell multiple times. The larger amount of cells you can keep loaded at once, the less redundant loads you'll have to make.

Another benefit of keeping lots of cells loaded at once is that you could parallel process them.


#5129167 Visual Studio Questions

Posted by Nypyren on 05 February 2014 - 04:58 PM

@frob to the above post I stated that the 20 something different programs it installed were automatically installed. Without my permission. And I find it hard to believe to write, compile, and debug C++ and C# in visual studio that it needs to install 14 MySQL programs to operate properly. If that's the case I have no idea why that would be the case. Why they would program it in a way where each component relies on all the others to be installed. Even if that component serves no purpose to the other. It's even more important when you do have all those different components to make them modular. To function independently. I mean think about it if that's the case then if just one  component fails then it's like an avalanche where it takes out all the others.


I think the reason is because they have a lot of different programs which share the same components.

Let's say you install SQL Server Express first. Then you install VS2013 Express, which may include SQL Server Express. Their installers and uninstallers are set up so that they don't install redundant copies of the same thing multiple times. Unfortunately this also means that they usually don't UNINSTALL everything either, because some other program might still need them (no ref-counting I guess?). I don't even want to think about how nasty the COM dependencies in the registry are.

Visual Studio in particular has had complicated problems related to uninstall for at least the past decade due to things like this.


#5128333 Why would devs be opposed to the PS4`s x86 architecture?

Posted by Nypyren on 02 February 2014 - 11:30 PM

Imagine you have just spent eight years and many million dollars developing a library of code centered around the Cell architecture. Would you be very happy to hear you need to throw it away?

Imagine you have spent eight years hiring people, and your focus has been to include people who deeply understand the "supercomputer on a chip" design that Cell offered, which is most powerful when developers focus on the chip as a master processor with collection of slave processors, and now find that all those employees must go back to the x86 model. Would you be happy to hear that those employees will no longer be necessary?


The parallel architecture is a little more tricky to develop for, but considering all the supercomputers built out of old PS3s it should make you think. Building parallel algorithms where the work is partitioned across processors takes a lot more of the science aspect of programming, but the result is that you are trading serial time for parallel time and can potentially do significantly more work in the same wall-clock time.


Why would you throw away such a library? There is still good money to be made from PS3 ports of new games, just like there was of PS2/Wii ports of 360/PS3 games.

If I had a large number of employees who understand how to write PS3 games very well, the transition to x86 is not a catastrophe. The primary change that occurred with the PS3 was it forced people without multicore processing experience to learn it. The new processors are not going back to a single-core model, so the primary skills that those PS3 developers learned are still relevant.

If I were smart, I wouldn't get rid of the existing engineers at such a company. I would spend some extra time and money to get them up to speed on x86-64, just like that spent to get them experienced on the PS3. Also, after 8 years of working together, these people will have become a well-oiled machine of teamwork, and that is just as important as their technical abilities.


If the hypothetical library is written entirely in assembly, then yes, I would be bummed (for various other reasons as well - why is it entirely assembly in the first place?!). But if the majority of the library was written in C or C++ with some small sections in assembly, then I would not be bummed.


#5128305 how to prevent save cheating? (for games where saving is NOT allowed)

Posted by Nypyren on 02 February 2014 - 08:34 PM

You could use an NTFS alternate data stream.  Very few people know about them, and it would take someone with a disk I/O monitor to realize what you're doing.

 

To make it harder for someone to notice the ADS in a disk monitor, you can put the ADS *on the folder itself* with the same name of a standard, red herring file in the folder.

 

Example:

 

Folder:Save1.dat   <- this is the ADS

Folder/Save1.dat   <- this is the red herring (just write a ton of random bytes to it to make it look encrypted)

 

The : and / will be hard to spot in the disk monitor and it may appear to the cheater that only one file is being accessed.

 

Here's the fun part:  Copy/pasting something with an ADS attached to it *does not copy the ADS*.  This means that if the player makes a backup of their save folder, then restores it later, the original ADS will either be unmodified or completely lost.

 

 

The most obvious downside is that people unaware of the ADS will not be able to make any kind of backup of it.  If they try to copy the game to a new computer, their game will be lost.

 

It's not perfect, but it'll probably confuse the hell out of people for a while.  Still, it only takes one person leaking the information about how it works for the technique to be ruined.






PARTNERS