Glak

Members
  • Content count

    460
  • Joined

  • Last visited

Community Reputation

315 Neutral

About Glak

  • Rank
    Member
  1. Thank you for the replies.   Waterlimon, I agree that have a SortedDictionary of Lists is probably the most elegant way from a user of the class standpoint.  I would definitely do it this way if I were making a general-purpose priority queue class.  C# should include such a class.  However I don't want to dedicate the time to working out all of the corner cases so I'm going to go with my more hacky approach, though improved based on the feedback that I am getting here.   Krypt0n, yes I think that bitshifting makes more sense for the reasons that you stated.  I rarely use bitshifting so I was hesitant.  I just edited my code above to be a bitshifting version.  Also I included the code showing how it will be used.
  2. Thanks for the response.  I edited my code to add clarifying comments and renamed "id" to "arbitrary"   Basically the problem is that SortedDictionary is almost a priority queue, but since it requires unique keys I can't use "time" as the key (since multiple events can take place on the same tick).  My solution is to tack on a small fraction onto each time to make them into unique keys.  I don't actually care about the ordering of events with the same time, but SortedDictionary does.   Using doubles (which are nicely truncated with the converstion to int) seemed easier than working with bitshifting.  I'm pretty sure that max_int will never be approached.
  3. I was surprised to find that c# does not contain a priority queue (also known as a "heap").  The closest thing seems to be SortedDictionary, but that requires unique keys.  I decided to create the simplest possible priority queue.  (note: I have edited this a few times since originally posting)     public class PriorityQueue     {         //SortedDictionary is like a priority queue, but unfortunately it requires unique keys         SortedDictionary<int, Event> events = new SortedDictionary<int,Event>();         //this is used to generate unique keys from possibly non-unique times         int arbitrary = 0;         //schedule an event at the specified time         public void add(int time, Event e)         {             int key = (time << 16) + arbitrary;             events.Add(key, e);             ++arbitrary;         }         //returns true if there are one or more events scheduled for the current time, this will be a loop condition         public bool ready_now(int time)         {             return ((events.First().Key)>>16) == time;         }         //pulls an item out for processing, this will be in the body of the loop         public Event pop()         {             var f = events.First();             events.Remove(f.Key);             return f.Value;         }     } and here is how it will be used: while(events.ready_now(current_time)) { Event e = events.pop(); e.happen(); } What do you think?  Any subtle (or not so subtle) bugs?
  4. depicting culture on the map

    Thank you. I think that your ideas have helped me. The key is that I don't have to show everything in every view, nor do I have to hide everything in an inaccessible window. Here is what I am currently thinking: On the main map each tile will have something to indicate its dominant culture, either a colored border, layer, or something. Perhaps it will be simply a "team color" as in an RTS: all of the little details will be that color. If no culture is dominant then no team color will be shown, instead it will be gray or whatever. Realistically most places will have a dominant culture with a splash of something else, there will also be recently conquered areas and border areas. These regions will be obvious to the player simply because he will remember conquering the Purples or whatever. If you want to bring up more cultural information you will be able to bring up a series of maps. Maybe there will be a way to select a person and it will show you a map of all of the people who have the same culture. Then when you click on a tile it will show you all of the people and their cultural traits. This will be either colored garments, flags, or whatever.
  5. So I'm working on some ideas related to how you would handle culture in a Civilization style game. Each tile will have its own population rather than there being a central city managing the tiles in its radius. I will group the tiles by province for some things but basically it will be based on tiles. So there will be farm tiles, suburb tiles, etc.... Now here is the thing, not all tiles will have the same density. So a farm might have 3 population and a town might have 20. So I guess that i can't really show people on the map. I want each population point to have three distinct culture slots. So I was thinking that people would display their culture by wearing colored garments. One person might have blue pants and a blue shirt and and orange hat. Another might have a blue hat and a blue shirt but orange pants. Both populations would have 2/3 of their loyalty to the blue culture, and 1/3 to the orange culture, but in different ways. I was also thinking that I could depict this using tricolored flags. The reason that I want three distrinct slots is it works with my cultural diffusion/evolution model. So any ideas? My idea seems almost unworkable from a UI perspective. I would be willing (happy?) to go to a system where there is one population point per tile, but then I get problems of density. It also makes the growth and migration model trickier.
  6. If your game is about killing animals "hunting" works better than "hunt". In English (and probably other languages) one kind of wordplay is to insert part of another word into the middle of your word. So if take the middle of the word "adventuring" and insert it into the word "hunting" we get Huntventuring. Such a name would imply that you are hunting in an adventuring manner. This name isn't all that great but is decent enough for anything other than a big-name game. Even still, Starcraft is an extremely popular game but if you look at the name you will soon realize that it is nonsense.
  7. analogue stick, movement in water afterwards?

    Store your velocity as a 2d vector. So an x and a y. If your character is going left it would mean that his x is negative. When you need to calculate the speed take the length of the vector, and when you need to find the direction use the atan2 function. Just handle as much as possible in vectors, so your velocity, desired velocity, acceleration, position, etc...
  8. Population, buildings and land

    why are people producing money? Shouldn't the buildings and land produce the money? Then you need people to work them.
  9. design feedback

    > My question is 'would you play this game? No, of course not. Your game sounds like Farmville so I don't expect that you'll get much positive feedback here. However millions of regular people love Farmville so your game could be super popular with that audience. Like Acharis said, the Farmville crowd has never heard of the old RPGs so there will be no nostalgia value to using those graphics. Also, to reach that audience you have to make your game into a facebook app so you will need to worry about copyright. So yeah, your game could be super popular but only if it is a facebook app. It won't be as popular as Farmville because Farmville targets women and women are the main audience of this genre of game, whereas your game won't attract women as well because of the RPG combat theme. You will probably get more even demographics with a mix of men and women.
  10. Game designs of questionable ethics

    games are about satisfying our instincts. We play FPSs because it is in the nature of man to hunt and kill the most dangerous game. We play RTSs because war is an essential part of the human condition. We play RPGs because going on errands and managing inventory are another part of being human. We play Wii Fit because attempting to become more attractive is part of human nature. All games, if they are good games, appeal to our base nature. We are not satisfied if we do not engage in these activities. Some suggest that the drop in crime since the 80s is partly because of the rise of video games. People are indoor killing monsters and online killing each other rather than feuding with the guys on the next block. By making a game about genocide you are satisfying humanity's completely natural and healthy yearning for genocide. By making such games you are potentially preventing genocide. I suspect that WWII would never have happened if the Germans were busy playing Blizzard games.
  11. Evolution game

    here is what I would do: start with a nice little landscape with some primitive creatures. The player can edit the map by planting seeds from a menu, changing the climate, causing mountains to form, etc... the important thing is to give the player some tools to manipulate the environment. In this landscape he can grab creatures and move them around, and kill them instantly (bolt of lightning?). His first goal is to get his creatures to split into two species. This opens up several more landscapes (perhaps we will call them ecologies). One will be to create as many species as possible in a small ecology. Players can approach this in different ways but I imagine that most players will settle upon a system of islands, and trying to make each fertile enough so that predators will evolve to eat their specific prey. Each time the player gets to a new level of species it recognized this achievement. The player will also be able to bring his creatures from other ecologies to this one. If the species survives for three generations it counts towards the ranking. Another ecology might be called back to the sea. The goal is to get a species to live in the water. This one is timed. It will have a button to reset the scenario so you can try to improve your time. All of these different landscapes will have a different challenge, and beating certain ones will unlock others. You will be able to take species from one to put into another most of the time, but sometimes you will be forced to start with primitive creatures. In some you can move creatures around and kill them, in others you can't. In some worlds you will be able to alter the climate, plant seeds, etc... but each world will have something that will make it special. Maybe one world is a city filled with humans and you have to evolve pests. While you are playing one world the other worlds still continue to evolve. If this takes too much processing power, even without the graphics being rendered, just have the game catchup when the player reenters. Then of course there is multiplayer. Each player gets to place 20 creatures (probably of 3-5 species) into a large, empty world. After 20 minutes the game determines what percentage of the biomass each player controls and awards victory. It also awards medals for adapting in response to a predator and other things. So the multiplayer would basically be evolving your guys ahead of time, dropping them into an environment and seeing what happens. You would be trash-talking each other on chat the whole time.
  12. Magic or No Magic

    I would try to do it without magic if I were you, but depending on your game you might end up resorting to adding magic. If so the best way is to add only one kind of magic. So if you decide to go with necromancy you could add Necromancer, a Death Knight, a Shadow Assassin. Or if you go with elemental magic you could make a class for each element. You could make it so that magic relates to people's bloodline, perhaps magic works better if you know someone's lineage, and you would have magic related to blood, maybe Veins of Fire would be spell or something. You could make all magic relate to the sun, the moon, and the stars. That would be pretty amazing actually. You could have combos (called constellations). Anyway if all magic comes from one source (or maybe two) it makes it much easier to integrate the flavor into your world. Think of the classic fantasy novels. Magic is mystical and comes from something. It isn't just a bunch of class abilities.
  13. MMO RTS Trade System

    Servant of the Lord, Another problem is that your system is easy to game. If I buy 100 wood 20 times then the price of the last 100 wood is 200. I can then sell all of the wood at 90% of the current price, netting me 190*20. However I only paid 100+105+110....+190+195+200. It would be pretty easy to make infinite money this way.
  14. So it looks like my system got a lot of discussion. I'll address the responses in order Tommy, your system involves a centralized system of if-else statements. It is very explicit and so it makes clear the relationships in your code. That is the upside. There are two serious downsides. The first is that your system doesn't scale. If you had a game with archers, cavalry, and infantry then you have 6 relationships to deal with: infantry attacking infantry, infantry attacking cavalry, infantry attacking archers, cavalry attacking infantry, etc... and it would be entirely doable. The problem is when you have more than three unit types. The game that I was designing had 60 different unit types, which means that your system would have 60*60-60 relationships = 3540. 3540 is far, far too many. I noticed that you said something troubling: "Add more variables. What about a 4th type, a nail, add more variables. That's programming." No, it isn't programming, it is data entry, which is the opposite of real programming (though we must all do it sometimes). The second problem is that you have all of this data. How do you maintain it? How do you generate it? How do you communicate it to the players of your game? TechnoGoth, could you divide it into different arcs? Yeah probably, but either you are doing something far more complicated or something different. The equation that I supplied is basically the sin function, but distorted so that the max and min appear different places. How would you plug a range into a function that normally takes a single value? I can think of a few ways inspired by fuzzy logic and probability but they wouldn't add anything. Perhaps you meant something completely different, in which case I think that your idea is pretty cool. Are you saying that total armor would be represented by having your armor arc be the full circle? And that say you had a weapon that was the top half of the circle vs an armor that was the bottom half, then the armor would do nothing? If so that is pretty cool. Platinum_Dragon, I thought of doing something similar, though I was going to use an if statement to simulate the wrap around. However I wanted a function that was curvy like the sin function. sooner123, you are right, a weapon vs armor system is an intuitive approach to generating a counter system. However it is much harder to balance. For example, what if during testing you discover that your Mage vs Rogue matchup needs to be tweaked? You want to make Mages a little stronger vs Rogues so you give them more hp. Well now Mages are also stronger vs Warriors. Ok so you put the hp back to what it was and you then decide to make the value of low armor stronger. Now you realize that all of your units with low armor are stronger. This can go on forever and will require a lot of play testing to get right. When you finally balance it you will have accomplished a great deed and your game will be awesome. However it will only be after lots of work. When working on my game I determined that it would be too much work and so I decided against it. I implemented my rock-paper-scissors equation and that aspect of combat was working fine. I eventually stopped working on the game because it was just too much for me. I would have quit even sooner if I had attempted to balance 60 units using a combination of armor type, armor amount, attack speed, health,, range, etc..
  15. MMO RTS Trade System

    the market IS an auction. That's what the market price is The only complication is that there a merchants that buy for the purpose of reselling, rather than buying for their own personal consumption. So to simulate it have a warehouse. If it is half full the price stays the same. If the warehouse is completely full the price drops. It if it empty the price goes up. You might want the price to update after every purchase, but it seems like you would prefer for it to change once per day. In that case make the warehouse size big, maybe 10 times as much as you expect to trade that day. Then if everyone wants to buy a lot the inventory might drop to 30%, The merchant will raise the price in an attempt to get it back to 50%. If the demand stays strong and inventory drops to 20% the price increases more. If the inventory shoots to 60% the price can drop a bit.