Jump to content

  • Log In with Google      Sign In   
  • Create Account


LorenzoGatti

Member Since 25 Nov 2005
Offline Last Active Today, 04:08 AM
-----

#5108648 Question about Program Counter

Posted by LorenzoGatti on 12 November 2013 - 04:20 AM

From what I read the Program Counter can hold the address of the current instruction or the next instruction.

1) Does that mean it can only hold one of the two at one time? If so, why is this?

The program counter and the accompanying notions of current and next instructions are abstractions, very useful to define what the various jump instructions do (choose the next instruction to execute, overriding the default of the one after the current instruction) but not necessarily related to how a processor actually works. Instructions can be executed out of order and simultaneously, making these concepts something that is merely emulated from the point of view of the program.
You can trust a processor to hold the address of an instruction it's fetching for as long as it's needed and then forget it, but there can be a queue of instruction addresses to fetch (possibly shared by multiple hardware threads or multiple cores) or something even more different from a program counter register.

I also read an instruction needs to get fetched, is the program counter doing the fetching too? I thought it was its job is to hold address of an instruction. blink.png

Fetching data from memory is the job of specialized hardware, including the instruction cache. Registers simply hold addresses, which are sent to the appropriate parts of the microprocessor.

2) When an instruction gets fetched: what does it mean for a program counter to increased its stored value by 1? Is it as easy as adding the number 1 to this value?

If you pretend the program is a sequence of instructions, you go to the next one; at the abstraction level of memory addresses you need to account for the length of encoded instructions, which is often variable.

3) Is the address of the instruction binary or hexadecimal? Is it encoded beforehand before the program counter fetches it?

Circuits and registers count in binary (high/low voltage); hexadecimal is only a human-friendly representation of binary numbers that, unlike decimal numbers, doesn't involve carry. But actually it's none of your business, the only addresses you need to read and write correctly are the ones in your program (which can have a far more complex structure with segments, offsets, implicit or discarded bits, etc.).

4) If the program counter is holding the address of the next instruction, is the instruction register holding the address of the current instruction?

The IR is an abstraction (what's the processor doing?) that doesn't correspond directly to microprocessor operation; the instructions being executed are represented implicitly in the configuration of what each register and execution unit do at each clock cycle. Moreover, what's executed is usually a sequence of low-level operations, not the complex instructions in the program.

5) Who does the decoding of any of the two addresses of the instructions?

Usually, dedicated address decoding units (hence the famous historical repurposing of the x86 LEA instruction to do arithmetic); on the cheap, the same ALUs used for general arithmetic (a lot slower). The result is the same, so it doesn't matter for the programmer.


#5108640 Mechanic for internal struggle of an empire (strategy)

Posted by LorenzoGatti on 12 November 2013 - 03:35 AM

On a more serious note, just managing nobles seems meh to me. As King of Men said, if you want to manage nobles go and play CK2, it portrayed it very good. I don't think I woulod be able to do it much better than they. Plus, I lean more towards a bureaucratic empire, like there is this emperor and organizations, guilds, corporations, social struggle, spreaders of dangerous ideas. Less feudal and more modern (not that they can't be nobles there, I don't have anything agains them, but just limiting it to nobles seems not so great to me).

You imply that managing nobles in a bureaucratic empire is inappropriate, but you can focus gameplay on handling specific important people (as opposed to giving abstract orders to faceless organizations) in any social structure.
If nobles have a limited importance for the Empire and the Emperor (e.g. as sources of succession by assassination plots, as marriage fodder and as trusted diplomats), the game can bring to the forefront other types of important people: generals and heads of bureaucracies, political or religious leaders, scientists and artists, entrepreneurs and managers, and all other relevant types of powerful or influential special persons (e.g. fairies or alien visitors, artificial intelligences, superheroes of all sorts, wizards...).


#5106878 Can programming screw my computer

Posted by LorenzoGatti on 04 November 2013 - 04:25 AM

I would recommend the latest version of Python 2 (currently 2.7.6) rather than Python 3, simply because most of the libraries you might be likely to use still support the older version, and because there are still currently more resources available for learning 2.7.

I prefer the opposite perspective: use the latest Python 3 version because the language and standard library are improved, and you don't want to depend on third party libraries that are demonstrating obsolescence and lack of maintenance by not having a Python 3 version.
Enough time has passed since the introduction of Python 3 to give library maintainers a fair chance, and important libraries like Numpy and PyOpenGL have been ported without trouble: libraries without a Python 3 version are either abandoned, developed by someone too clueless to care, or legacy software that should only be used for maintenance of projects from the Python 2 era.


#5104286 Strictly Dominant Strategies and the Tech Tree

Posted by LorenzoGatti on 25 October 2013 - 02:55 AM

 

Some tech trees offer 'upgrades' that serve the same function and are an improvement in every way to their predecessor -- a strictly dominant strategy, and therefore it's not a choice, it's a no-brainer.


No, not really. For example, miniaturized weapons that perform as well as the respective older models but use less spaces, crew, energy etc. are strictly better, but they are dominant only if they are the only weapon type in the game.
Ordinarily, rock-paper-scissors structures are perpetuated with better rock, better paper and better scissors.


Upgrades often provide a tradeoff between quality and quantity (do you want to win battles with more casualties or with more expensive ones?) and a reason to invest enough on technology to keep pace with enemy developments that could make player assets suddenly obsolete (e.g. you'd better invent Teleporting Nukes before the enemy improves Point Defense Lasers enough to make short work of your stealthiest Nuclear Missiles).


#5103605 What dev tools should I use ?

Posted by LorenzoGatti on 23 October 2013 - 01:47 AM

Nope, I'm not regarding to the language. I'm pretty versatile, i just need something solid enough to make my game run fine. I'm even ready to drop dollars in the engine if I need too. 

 

My game is not that complex, it's pretty similar to Street fighter 3 third strike, with more animation. I think that should help you to answer my question ^^ 

Any good 2D engine should be appropriate for a fighting game; genre-specific features are something you can develop gradually and iteratively on your own. Therefore, to select a particularly suitable engine and ensure the project is feasible, experiment with the general-purpose features you are going to rely on, for example:

  • How do you import, organize and edit sprites? You'll need an awful lot of them. (While you are at it, include your graphics editors and file organization in the evaluation.)
  • How do you define and use collision silhouettes? You'll need to tweak them a lot, and every pixel counts.
  • How do you author and preview animations? They are going to be at the top of the complexity scale, with state management, branching, timeouts, etc.
  • How are collisions handled? You are going to process and prioritize a lot of different event types. 



#5103060 Metagame in Competitive FPS

Posted by LorenzoGatti on 21 October 2013 - 02:47 AM

What you are describing is not metagame, it's only the layering of "scientific" learning (weapon data) and advanced team skills (tactical awareness, communication) over basic single-player skills (running, shooting). All this knowledge, and all skill layers you describe, apply strictly to the game itself. Metagame, on the other hand, is outside the scope of the game's rules. For example, knowing how and when and where and why you should use various kinds of anti-tank weapons is a game skill at all level of sophistication; equipping your team with a lot of anti-tank weapons because you expect the other team to use a lot of tanks is a metagame decision. So the real question is whether, for players, figuring things out for themselves is fun and/or instructive (how do you ensure that they learn from expert players but have fair fights with someone at their level?) and whether the things to be figured out are worthwhile (for example, if your M16A3 is so good, maybe you should remove other disappointing assault rifles, or explicitly demote them to handicap weapons that nobody should use competitively, or nerf the M16A3 to make the choice of assault rifle more difficult and important).


#5102072 Any ideas for the "perfect game design tool"?

Posted by LorenzoGatti on 17 October 2013 - 02:25 AM

You might want to revise your thread title, because from what you ask you seem to be concretely working on a practical tool, not daydreaming about a meaningless perfect one (as is typically the case for "I have an idea" forum threads). While you are at it, can you narrow your generic request for feature suggestions by explaining what does your "game design and non-linear writing tool" do and how does it compete with pencil and paper, with spreadsheets, with text editors, with diagram-drawing software, etc.? Telling which features could be appropriate is very difficult.


#5101756 My quick RPG storyline

Posted by LorenzoGatti on 16 October 2013 - 01:50 AM

1. A woman named Sheila is born in a tribe of only women and is to be eaten by a dragon because she is a virgin.

If women do it to each other, it isn't sexist! Just kidding, of course: this virgin business remains quite inappropriate for a game that's presumably meant for a younger audience and likely too silly for a kinky "adult" game.
You might keep the rather traditional human sacrifices to appease the monster, but why and how Sheila has been selected as a sacrifice? Who is she?
Is the tribe of women important or just a simple way to preserve Sheila's virginity? Did you consider the implications and complications, like disposing of male children, finding men in order to reproduce, and unavoidably common homosexuality?

She must travel to find someone to lose that quality to so she doesn't get eaten.

Traveling to put some distance between herself and the dragon and/or her tribe seems simpler and far less silly (not to mention more adventurous if someone is, or might be, following our heroine).

2. A warrior has the power to slay the dragon and is the Chosen One, but his fear of ghosts holds him back.

What chosen one? What does it take to kill a dragon? For example, Siegfried kills Fafnir because he is well equipped and, more importantly, he doesn't know fear; your dragon and your warrior need to be at least as meaningful as them.
There's also the unfortunate implication that if the dragon is an important force of nature the warrior that can kill it is somehow evil and unnatural.
What do the ghosts do, other than hanging around the dragon?

What he doesn't realize is the ghosts are on his side because they are all the souls of women eaten by the dragon.

Not obviously important: how can the ghosts be a threat to the dragon?

3. The dragon is eating women because their beauty he consumes gives him the energy to keep the world beautiful.

Extremely bizarre, both for the jarring dissonance between a story of normal or slightly special folk and this cosmic mystical power and because it makes little sense. If the dragon is portrayed as evil, he should do something worse than "keeping the world beautiful"; if he is portrayed as good, people would be proud to be a human sacrifice and there would be no reason to fight.

The characters decide to kill the dragon anyway.

Then the dragon should be evil and/or dangerous. But apart from consuming sacrifices, what has it done? Also, what ties Sheila and the warrior together? Romance is implied, but how does the plot require them to join forces?

4. At the end of the game, Sheila decides to split her form in two, and morph one of the two forms into a dragon, and eat her other form, to restore beauty to the world.

Horribly cheap, and implying that, all along, Sheila was a goddess or the like, the dragon's equal at the very least. Can I suggest gods turning either Sheila or the warrior into a new dragon instead?


#5101236 Illegal Instruction, possible causes?

Posted by LorenzoGatti on 14 October 2013 - 04:08 AM

A function pointer into garbage memory, as pixelartist suggests, seems the most likely cause: from your description, you seem to be compiling the program properly.

Can you detail the difference between a test program that runs and a test program that crashes? Do you link to different libraries? Do the two development environments on your two computers produce different programs? (They shouldn't.)




#5099849 how to write a mind blowing Technical Design Document?

Posted by LorenzoGatti on 09 October 2013 - 02:05 AM

thanks, seeing as this is my first official project that counts towards my final marks i want it to be perfect / mindblowingly so, biggrin.png  i really appreciate the help and direction im getting here, thank you, 

 

question... would a TDD contain example coding for say some sort of AI and then explanation of why i have structured certain aspects in such a way? 

Excessive details about how the game works are going to be worthless in a TDD, because they are volatile and because they are only interesting for coders who are going to work with the authoritative actual sources and data files, not with your incomplete and potentially obsolete quotations and summaries.

 

Provide an overview of the important technical choices and their reasons, without neglecting the options you discarded; you'll need such "theory" as a starting point to revise those decisions (possibly in another project) and/or as evidence that your decision-making process was sound and diligent (both to convince yourself that your TDD is finished and down the road when your technical choices turn out to be disappointingly bad or unfit for unforeseen requirements).

For example, suppose that at the beginning of development you chose a middleware that does what you need, and then halfway through your project the company that should provide updates and support for it suddenly evaporates. Can you show your manager that when you researched that solution you found nothing but popularity, customer satisfaction, timely updates and good support? Or does your TDD show that you neglected the less technical aspects of the software selection process?




#5099490 Composite pattern with parent pointer in C++

Posted by LorenzoGatti on 08 October 2013 - 01:59 AM

My first choice would be avoiding parent pointers, because both normal component operations (e.g. update or draw yourself and your children recursively) and "special" operations (e.g. delete a Component but place its children, if present, in a sensible Composite) shouldn't need them, and placing all Components in a single structural hierarchy seems wrong (what if you need different groupings for the same objects, e.g. pieces of articulated objects grouped by position for drawing and collision detection and by "limb" connectivity for physical simulation and animation?).

 

Can you clarify what you are unable to do without parent pointers? For example, why do you want to actually delete Components given only a pointer to them? You can instead set a "deleted" flag on the component, which should be good enough for the purpose of pretending the component doesn't exist, and later visit components recursively to delete their flagged children.

 

I'm not sure about a Composite abstract class a it appears in your code sample: it is almost trivial, and there can be many other Composite types beyond those with an array containing an arbitrary number of undifferentiated children. 

 

Another bad thing is the use of unique_ptr and of containers that own child Components. It's another enemy of multiple Composite hierarchies and of flexible destruction of Components; a std::vector or individual variables of type Component* would let you move child components to other composites or delete them as you need when you delete or recycle a composite.




#5098457 Need advice for Programmer about to pay for freelance pixel art

Posted by LorenzoGatti on 03 October 2013 - 07:35 AM


i dont want to pay to someone for an art, and when i start selling the game get a response from this person saying "i doesnt allow you to use my work this way, i will sue you", i want to avoid that cases.

 

That's the whole point of "work for hire": it isn't his work (i.e. he doesn't have copyright) because he agreed to work on your project, assigning the copyright of whatever he makes while working on your project to you. The contract needs to define and state clearly what transfer of copyright takes place to avoid the exact scenario you are already worrying about, and that's why you need a lawyer.




#5097775 What is your dream weapon upgrade system for a game?

Posted by LorenzoGatti on 30 September 2013 - 02:21 AM

It depends. In many combat games any kind of weapon upgrade would be wrong, because standard weapons are the best possible ones and anything else would be less fun (e.g. an hypothetical guided missile upgrade in Space Invaders), or because any improvement is an unfair or excessive advantage over non-upgraded opponents (e.g. an hypothetical ROF or damage boost in a pistol only FPS deathmatch).

 

 

If you want advice, why don't you explain what sort of game you want to upgrade weapons in?




#5096573 How to design progression?

Posted by LorenzoGatti on 25 September 2013 - 01:41 AM

Collecting materials and treasures that can be put to good use between battles is a good idea, but it doesn't depend on explicit RPG-style exploration.
The player's army can search the battlefield and its vicinity for useful stuff after winning a battle, implicitly, instantaneously and offscreen (you can list what has been found in end of battle summary panels).

If you want exploration for its own sake, it can be integrated within the turn-based battles: an obstacle-rich large environment can require a lot of movement before contact with the enemy. The "battle" could be finding something in a dungeon without dying or grabbing as much as possible before a flood drives the heroes away.

Technologically, the only requirements for exploring in battle are scrolling a partial view of the battlefield (rather than showing a fixed full view of a small battlefield) and fog of war.


#5096092 Cheat prevention?

Posted by LorenzoGatti on 23 September 2013 - 02:48 AM

 


I got into this conversation with a friend, and he suggested modifying the compiler to use fewer registers, preserving "important stuff" in those newly unallocated registers.  It's a very heavy-handed way to go about it, will lead to serious repercussions in performance, and still isn't fool-proof, but it's damned hard to get around because it requires a lot of inside knowledge to know what gnarly asm to inject.

Wat?

Using "fewer registers" doesn't make any sense. First of all, that means more stuff will be spilled to stack memory, where it's actually easier to find and modify. Secondly, it's going to be transiently limited to the runtime of a single function at most, so those values still have to go back to stack or free-store memory at some point. Finally, on platforms like x86-32, there's already so few registers available that this is just... not smart to try.
The high level view of "using fewer registers" and putting data in "unallocated" registers is that it cannot obfuscate anything.
The same data is read and written in arbitrary memory location and registers of your choice using exactly the same instructions. Compare these two x86 code fragments:


POP ECX
MOV EBX, EAX
ADD EBX, ECX


POP EBX
MOV EDX, EAX
ADD EDX, EBX


Which one is harder to comprehend and hack?




PARTNERS