Jump to content

  • Log In with Google      Sign In   
  • Create Account


Khaiy

Member Since 27 Jan 2010
Offline Last Active Jun 11 2014 10:11 PM

#5072138 Action RPG WASD Controls

Posted by Khaiy on 22 June 2013 - 09:36 PM

I've seen countless shooters and shooter hybrids that use a control scheme like you describe. I feel like "Action RPG" is a pretty thin term these days. Would you include Elder Scrolls and Bioshock to be "Action RPGs" for the purpose of your question?

 

Assuming that they are close enough, I've seen such games use hotkeys (typically the number keys at the top of the keyboard) to activate an immediate effect (use an item, activate a skill), change equipment, or to queue up the effect of clicking a mouse button. But these are all functions that the player would do far less often than moving with WASD or clicking a mouse button.




#5072131 Basic Concepts of Programming

Posted by Khaiy on 22 June 2013 - 09:19 PM

First, you may be interested in this book.

 

 

But I want to know exactly when I should be using void, and when I should be returning a variable.

 

 

You should take the following with a grain of salt, as I'm one of the less experienced coders here, but it sounds to me like you're getting too caught up in the idea that there's a "right" way to do everything. The only real consideration is what you need from your code. If you don't need a function to return a value, then return type void is appropriate (this type of function is often called a routine). That the possibility exists to return an integer doesn't mean that using a routine is bad. But if you can't think of a reason or design to use an integer return value, then you don't need one. There's not exactly a rule that you're violating, just a need you don't have and an approach you're not using.

 

Additionally, I don't think you're in the "basic concepts of programming" realm any more. This would also explain why you aren't finding the answers you want in tutorials and books. A major design approach isn't basic, and a book that tells you what a float is probably assumes that you aren't ready for that information. And there is enough contention in the design and architecture theory space that you shouldn't count on there existing a canonical, objectively "best" practice all the time.

 

 

 

I know that it's more effective to use a single instead of a double when you're working with a smaller number, but why?

 

 

From this line, I'd say that you don't know that a single is better suited to a small number than a double at all. You've heard it, but haven't evaluated the statement. Think about it. Google things you're unsure about, like "what exactly is a double? What is a single?". When you get stumped, which will happen from time to time, this and other communities exist so that you can ask a clear, pointed question.

 

If you've reached the extent of what the average programming tutorial can teach you, then you've reached the point where you will need to take a more active role in developing your knowledge and skills. As you learn more, there is less pre-packaged material (like tutorials) available to tell you what you want to know. And while research is good, experimentation is even better. If you're unsure about something, slap together a test program that will let you examine the question yourself.

 

Your knowledge base builds up one piece at a time. There isn't some pile of information that can be dropped onto you that will do what you're asking.

 

 

in terms of coding and their core foundations and reasoning behind its basic principles. Just the silly things that nobody bothers to elaborate on as I explained above.

 

 

Bolded section: That's the stuff careers are made of. Professional computer scientists conduct meticulous studies and write formal papers about programming theory. If you're looking for video tutorials on this sort of thing, I think you're going to be frequently disappointed.

 

The rest: They aren't "silly little things". They're foundational computer science, and a book on them is more likely to be a CompSci 101 textbook than anything else. The people who "bother to elaborate" on them are professors and other instructors. jbadams' post has good information about how you can get to that kind of information.




#5071922 How on earth do I start a game?!

Posted by Khaiy on 21 June 2013 - 08:50 PM

But the thing I'm wondering about is what do I need to make a game... APIs, game engines, libraries etc to make a very basic game. (And whether I even need them... it's 2D btw.)

 

What you need is what's already been said: a language that you know and a compiler/IDE in which to use it. And then, you'll need experience coding. You need nothing else. You can and in many cases should use various APIs, engines, libraries, etc., but you don't need any particular one. Which ones are even options depends on what specifically it is you'd like to make.

 

From the information you've provided so far, I'd say SFML is a great library to use. C++ is fine, though I think you'll get off the ground more quickly with C#.

 

Beyond this your question is pretty vague, which may be why the answers you are getting don't appear to be quite what you're looking for. If you want to code your own game (as opposed to using game-making software) you're going to be building just about everything I think you mean by "game" by yourself and out of nothing. Have you designed any specifics of what you want your game to be yet? If not, doing so will really help you break down the tasks that you still need to do.

 

A good first step might be to open a window. Does your game use a GUI-style menu? Sketch out some ideas on how you would do that using your language of choice and any libraries you plan to use. How you start a game is the same as how you make any other part of it: you identify a task that needs to be done, and you figure out a way to code it up. It's always overwhelming at the start, and getting to work is the only way through.

 

 


but the tutorial doesn't even tell me

 

This strongly suggests to me that a 2D game might be a bit advanced of a project for you right now. It's not that you can't do it, it's more that people tend to radically underestimate how much stuff there is to do to make the game they're imagining. You'll know your experience level better than any of us. Have you done much coding yet? If not, a simpler game might help you get a handle on the game-making process without seeming so daunting.




#5059184 Remove any items from a list while iterating

Posted by Khaiy on 04 May 2013 - 09:58 AM

It's not especially elegant, but you could build a new list and copy any elements you don't want deleted to it. Then you can replace the original list with the new one. If you want an in-place solution, it's unfortunately beyond me to think of one that hasn't been mentioned yet.




#5058236 Minimal ship customization in 4X games?

Posted by Khaiy on 30 April 2013 - 09:30 PM

For me, most of the fun of designing my ships is that I can make up an objective and play with different combinations of parts to see how well I can accomplish that objective. It allows for emergent gameplay and creates some really interesting strategic decisions. I can't just have a big fleet of all top-of-the-line models. I'll either need to produce fewer but higher quality ships and be really careful with them, or compromise and use some older components to keep the production and maintenance costs down.

 

Removing the ship design aspect, and the tactical control from battles, really locks in play styles for species. There's flexibility, but (to continue with the StarCraft example) it's more a matter of using a specific build and successfully identifying what builds your opponents are using. What makes this work is that the game is really tightly balanced. In a 4x game, the balance seems like it would be even trickier because each faction will have a broader set of variables than just a unit list. Plus, a StarCraft match is ~45 minutes at the outside. A 4x game might play out over weeks. The "locked in" feeling might be worse if you're stuck with it for longer.

 

What might sell me on it is removing nearly all of the tactical portions of the game and replacing them with a good set of strategic considerations. If instead of worrying about individual battles I have to worry about fronts, supply lines, reinforcements, and so on, there could easily be enough to keep me engaged without worrying about individual ship-to-ship combat. And even if my fleet had certain predilections that were hard to get around they would mostly influence what strategic objectives I would pursue. Using my ships for something they aren't well suited to would have to be worth the risk. I'd have to really want that objective.

 

I'm reminded of the differences between a JRPG, like Final Fantasy, a tactical RPG, like Final Fantasy Tactics, and an "SRPG", like the SNES Battle Ogre or Soul Nomad. In the SRPG's there's little or nothing you can do to influence a given battle, but you can try to control factors like where battles take place, when, and the specific composition of your squads. It felt weird to me at first, losing the direct control over battles, but I really enjoyed the newer strategic elements.

 

As for games similar to what you're describing, maybe Sins of a Solar Empire? It's not quite a 4x, but it's 4x-ish.




#5058235 "Research" System in 4X Games

Posted by Khaiy on 30 April 2013 - 08:54 PM

Interesting question. I would imagine this would require a different assembly line of some kind, but its quite possible that only a few subcomponents of the laser would be affected.
As a reference, building a whole new car requires a genuinely new assembly line whereas a 2013 iteration of the 2012 model might just make a few adjustments so to speak. I imagine both are viable approaches, although, from a gameplay perspective, the investment should be sizeable.
The investment in resources doesn't necessarily need to translate to physical components changed in the assembly line. It could represent time spend by a "lean" team to iterate on the current assembly line, or as you pointed out, greater energy intake.

 

This makes me think of your idea in a new light, and one that is even more intriguing than the original idea. It's not the research that matters (although you could easily have a research component if you wanted) or even your production capacity, but your production facilities that are the key. So if you can make Laser 5, it might take a significant amount of resources and time to retool each individual factory to make them. So even if your society can pump out Laser 5 units pretty quickly, you have to make a substantial upfront investment of time and resources to begin producing them at all; it's a major decision to put your Laser 5 tech into production. That means that you would want to have an overarching strategy for any tech you want to actually use.

 

Do you want the advantage of deploying Laser 5 enough to lock yourself into it for a while? Is it worth the risk that an opponent might put Laser 6 into production soon after, leaving you with an inferior weapon for a period of time? If you need to produce more units than you can afford with a Laser 5 weapon for whatever reason, you still have to invest time and resources to retool for Laser 4 even though once you've done so you can produce more individual weapons. That adds a really interesting layer, well beyond correlating research points and construction points.

 

This would also account for my self-contained weapon systems question. The interesting decision isn't really deployment or installation, but specialization of your production capacity and high cost for switching.

 

Interestingly enough, having laser 9 tech should also cost a lot more resources to implement once researched. The idea is that only few ships will benefit from that top tech. Most games assume researches as linear upgrades that affect previous ship retroactively at no cost, not further increasing ship production costs. That's the aberration I'm trying to solve.

 

In most of the 4x games I've played, retroactive upgrades are pretty limited. When they're even possible they require a refit at a shipyard, and its often more practical just to have a fleet of slightly outdated ships headed by newer models. New ships cost more than older ships, but it's often not noticeable because your economy is ramping up at the same time new techs become realized. There are some exceptions (new drives tend to be included with all ships, and cost doesn't increase), but to stay competitive you need new weapons, shields, and so on, all of which are more expensive as they advance.

 

The one that I'm worried about is population growth. I mean, I would hardly imagine population to increase more than 3% over the span of a single year, so it could make each crew lost that much more important. Crew shortage could be an issue that needs balancing, but I'm ok with that. I've rarely lacked population in any 4X so far, thus it might be refreshing (there was a Star Trek Armada game though where pilots were actually trained over time and always in short supplies as far as I can remember).

 

This sounds fun to me. On a shorter timescale it might be more fun to use the population as a limited resource. You have 1,000,000 individuals, maybe 35% of which are prime military aged. You can draw from the population to crew your ships and fill out your military infrastructure, but every soldier you lose represents a serious loss that will take a long time in-game to replace (if you ever can). The population doesn't grow very much, but your forces can absolutely shrink.

 

I'm really warming up to the game you're describing. I think it has tons of potential to be novel and fun while still playing like the 4x games I already love.




#5057948 "Research" System in 4X Games

Posted by Khaiy on 29 April 2013 - 08:20 PM

I like the idea. Before getting into the meat of my response, I have follow-up questions:

 

-How do related technologies fit into the retrofitting scheme? I mean, how much is involved in going from Laser 2 at a starbase to Laser 3? I would have to imagine that it's not a dramatic change, maybe the base needs more power to use Laser 3 and obviously the physical weapon itself, but does that cost compare with, say, adding a new facility to the base?

 

-How would you handle more self-contained technologies? A rail gun needs power, but otherwise really just needs to be mounted into a window or general turret bay.

 

-What is required to re-fit a ship or station? Better weapons might need more power to operate, but I'm having trouble imagining what other major work would need to be done to install a new weapon system that has already been manufactured? By major, I mean large enough that it would register in a 4X as something that would take a turn. Maybe something like training operators to use the new system?

 

As for the concept, I admit I've never been bothered by either of the issues you raise. The time-scale for a turn usually isn't consistent across all applications within a single game (explicitly so in games like Civ, where the year is shown and each turn causes a varying number to pass), and the amount that it's possible to do in a turn is based around your empire's capacity to do them. So if you invest a lot in manufacturing capacity you can crank out facilities, ships, etc. very very quickly.

 

The "research race" aspect only becomes really heavy for me in longer games. A game of Master of Orion II can be won with poor research capacity as long as it's offset by something else, like high production capacity or espionage skill. A shorter game, involving a smaller map, causes non-research elements to be more important as you can't rely on executing a turtle-and-tech strategy. What's more, I feel like a heavy research lead should confer a serious advantage elsewhere. Having Laser 2 while your enemy only has Laser 1 shouldn't decide the game, but Laser 9 vs. Laser 2 probably ought to.

 

For me to feel comfortable with a system like this I would expect the game to have an explicitly short timescale, like, a whole game encompasses less than a century of simulated time. Production, population growth, and travel time would also have to be tweaked to fit. A standard 4X game typically encompasses centuries or millenia; I expect radical technological progress to be available over that span and I also expect there to be at least some differences in research capacity between groups. I might just be overly biased by the standard game model, but a game with a mechanism like you propose sounds like it would need to be structured very differently from other 4X's in most other respects as well.




#5056801 Need Help With rogue-like problem

Posted by Khaiy on 25 April 2013 - 07:50 PM

like i said i am doing this to learn and i don't know how to do that and no its not going to be 1 square at a time.

 

I don't understand what you mean. Paradigm Shifter's post tells you how to do "that", and it does everything your initial post suggests you need. If it is inadequate for what you're trying to achieve, please explain how so (if movement isn't one square at a time, how does it work?). If you don't understand something that is posted, ask for more information. Is there a specific piece of Shifter's post you don't understand?

 

Posting more information about what you've already got will be helpful also. What constitutes a "player", "enemy", "wall", or "boundary" in your code as you've currently designed it?

 

by the way if your thinking i should know this code like the back of my hand im mainly working on this as a learning thing so please don't be rude.

 

Try to avoid being rude yourself. Even if you don't mean to sound harsh or ungrateful, a poorly chosen word or phrase that sounds like you are can dramatically reduce the number of replies you get. Bear in mind that you're asking people to help you, for free, and in their spare time. I've always found people here extremely helpful, regardless of the question asked, as long as it is asked nicely and with a bit of humility.




#5056789 how to make In-Game command and control panel?

Posted by Khaiy on 25 April 2013 - 07:13 PM

In general, you would define a shape at the bottom of the screen (say, a rectangle) and then dedicate specific parts of it to do what you want. So in the panel, you have a rectangle in the lower left which loads a portrait when a unit is clicked, a set of shapes that respond when clicked for command buttons, and so on.

 

So you'll have to define the screen areas, draw the shapes, set up event hooks to populate the shapes with the correct pictures when a unit is clicked, and set up event hooks to carry out the right commands when buttons are clicked. It's not really any different than setting up any other graphics on the screen that the player can interact with, and if you've ever coded a menu or any graphical interface you've probably already got the techniques that you need.




#5045667 Beginner Programmer Help

Posted by Khaiy on 22 March 2013 - 12:26 PM

If I were to use a Dictionary to set the item and price, then store what the user selects into a List, would I be able to reference the item back to the Dictionary if the user wants to sell that item back for what he paid?


I'm imagining the dictionary as a persistent variable that is referenced as needed for buying and selling, and inventory is stored separately. So the Buy interface doesn't add or remove an item from the dictionary but only accesses it to get the price for that item. Inventories, like a store's current stock, would be something different (potentially another dictionary with the item as a key and the number in stock as the value, or any other arrangement you like).

If the item/price dictionary variable is named priceList, the Buy interface would get the price for itemX by accessing priceList[itemX].

When the player buys an item, you deduct int price = priceList[itemX] from their current money supply and add the item to their inventory (player.Inventory.Add(the item), if the inventory is a list). To sell the item back, the player's money supply is credited with priceList[itemX] dollars, and the item is removed from the player's inventory (player.Inventory.Remove(the item)).

Does that help? I'm back on my phone, so again my post quality is taking a hit.

 

EDIT: Home again. Here's a quick sample of what the code might look like if you have a dictionary for storing price information, a list for inventory, a dictionary for store stock, and items represented only as strings:

 

 
// A class defining a player:
 
public partial class Player
{
     // Fields
     public List<string> inventory;
 
     int money;
}
 
// A class defining a store
 
public partial class Store
{
     // Fields
     public Dictionary<string, int> priceList;
 
     public Dictionary<string, int> itemStock;
 
     // Methods
     public void DisplayStock()
     {
          // Code to display the items for sale
          foreach (string s in itemStock.Keys)
          {
               Console.WriteLine("{0} costs ${1}.", s, priceList[s]);
          }          
     }
 
     public void BuyItem(Player p, string itemPurchased)
     {
          if (p.money >= priceList[itemPurchased])
          {
               p.money -= priceList[itemPurchased];
               p.inventory.Add(itemPurchased);
               itemStock[itemPurchased]--;
          }
 
          else
          {
               Console.WriteLine("You don't have enough money.");
          }
     }
 
     public void SellItem(Player p, string itemSold)
     {
          p.inventory.Remove(itemSold);
          p.money += priceList[itemSold];
          itemStock[itemPurchased]++;
     }
}
 



#5045393 HP vs a Limb and organ system for a text based game combat damage

Posted by Khaiy on 21 March 2013 - 04:31 PM

I'm thinking along simillar lines as Nypyren. The granularity of the system has to match what characters can do, and still have meaningful differences between options. How much difference is there between screwing up nerves in an arm and disabling it versus just obliterating the arm? How precise are the choices I can make in terms of trying for either effect? Is there ever a point to crippling an enemy instead of killing it? These are all questions meant to focus the role of your system in your game, not to directly address anything about the system itself.

In a text based game in particular, I would question how well the player can target specific limbs or organs and compare that to the ease and intuitive-ness of the battle/targetting system, but I think there are ways it could work very nicely.

It may not mesh with your plan, but I'm imagining something like skills a character can use with different odds of different effects. So a character who is really accurate with a gun can do something like cripple an enemy via one particular skill chosen instead of the normal "attack" command, or something like that. As long as the game has mechanics where there are more significant than "dead" and "not dead", it could be really cool.


#5045080 Beginner Programmer Help

Posted by Khaiy on 20 March 2013 - 06:09 PM

Thank you both for the great advice. Would it be easier to store the players inventory in a multidimensional array in order to store the objects name and price?

 

 

It depends on how you want to represent the items that would be in the inventory, but that sounds a little over-engineered to me. What you are describing would work, but I would prefer either a Dictionary with a string key and an int value or a distinct Item class with a string field for the name and an int field for the price.

I can flesh this out a bit more, but later; my phone limits my post quality :/

 

EDIT: Home now, let me expand a little.

 

I think that creating an Item class would be a good, intuitive, direct approach to take. That way all of the information relevant to the items in your program are grouped together to be conveniently used as you need.

 

If you had something like:

 

 

public class Item
{
string name;
 
int price;

}

 

then you could have a List<Item> to represent inventory and another List<Item> to represent the store. An array of items (Item[]) would also be fine, though the size would be fixed.

 

The player's inventory doesn't seem like it would benefit from having item prices, so unless the price is included as a field in an Item class I wouldn't include it in the inventory at all. If you don't use an Item class, I would have the player's inventory be a List<string> or an array of strings, similar to above. The Buy interface is the only place that really needs the prices, so you could use a Dictionary<string, int> where the string is the item name and the int is the price as a field in the Buy class definition.




#5044790 Beginner Programmer Help

Posted by Khaiy on 19 March 2013 - 11:57 PM

I see a couple of things. First, it looks like the playersInventory field only exists in an instantiation of the Buy class. Second, you are creating a couple of different Buy objects, one in the MenuScreen method of the MainMenu structure and another in the GenerateList method of the List class. When you are displaying the player's inventory you're displaying the playersInventory field of the Buy object created in GenerateList(), not the one in the Buy object created in MainMenu. List's Buy object never has its BuyStuff method called and so its playersInventory field will never have any strings in it.

 

I think that your class layout might be causing some confusion. You have two classes, Buy and List, both of which currently exist only to execute routines. There's nothing inherently wrong with that, but the playersInventory field doesn't really belong in such a class. There are lots of ways to arrange things, but I would suggest creating the playersInventory array in Main. From there you can try things like passing it into the appropriate methods in Buy and List. Even better would be to create an Inventory class which has methods that allow it to do the things you want (methods like Inventory.ListItems(), Inventory.AddItem(), etc.).

 

I would also suggest that you not name a class "List", as List is already a type in C#.




#5044118 What language do I use?

Posted by Khaiy on 17 March 2013 - 09:37 PM

You should use the language you know best, which in your case sounds like C#. Plus, you already know some of an API that works with C#. That's a great recipe that you won't have with any other language or API right now.

 

The quality of games you make has everything to do with your skill as a coder and a game designer, and virtually nothing to do with the language you choose. The other factors you're hinting at are irrelevant at this point in your skill development.




#5042570 Hey I've learned C++ and SFML, but I can't find a book or tutorial

Posted by Khaiy on 12 March 2013 - 08:37 PM

Dragonsoulj's information is good, but I would expand it slightly to suggest that you look up all of the things you want to learn (tile mapping, collision detection, animation, etc.) individually. The more specific your combination of tools is, the less likely it is that there will be detailed tutorials, including books, that do everything you want with exactly the tools you've chosen.

 

Also bear in mind that SFML exists to do things like handle input and push pixels to the screen. It does not exist to do things like tile mapping and animation. Those types of capabilities are mostly independent of the things SFML does for you, and once you've written a tile mapping system it's fairly trivial to have SFML blit the result to the screen. SFML function calls will be involved in your specific implementation of those features, but the concepts will be the same regardless of the API you use.

 

If you look around for information on tile mapping, collision detection, sprite animation, etc., in C++ and drop the SFML requirement you'll find tons and tons of helpful information.

 

EDIT: Serapth, I can't believe I forgot your tutorial series! I tried to upvote you, but the site wouldn't let me.






PARTNERS