Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
HaB
Jan 5, 2001

What are the odds?
So I started reading this thread at the beginning a few days ago, but once the age of the first posts registered with me, and everyone was still talking about XNA 2.0 (and I just grabbed 4.0) I skipped ahead to posts from this year at least.

Anyway....some great advice so far from what I've seen. I have dabbled in game programming before, but the last 4-5 years have been doing almost exclusively .NET CRUD web apps in C#/Linq/etc.

I have conceived what seems like a solid idea for a game, and based on some things in this thread - it has mutated somewhat into improvements over the original concept.

So after having the "write a game, not an engine" mantra firmly wedged into my wazoo ;) I grabbed Unity this morning and worked through the 2D platformer tutorial and will be working through the 3D one as well.

As an aside: I have the following to say about Unity: It's very very slick, and I assume once I get into actually scripting my own game logic for the prototype I will feel like I'm getting more education out of it. But really - using prefabs and ready made scripts and such I don't feel like I'm learning a THING so far about actual game architecture. I get how it all works in Unity. You can attach Thing A to Thing B, and set properties on both Things that get updated, etc. But I dunno - it almost feels like just a more complicated version of GameMaker or something built for non-programmers.

That being said, I think it will be a useful tool to prototype my game - and assuming the idea is sound - go from there.

Another maxim I have picked up in this thread is "what engine should I use for my game?" is best answered by "depends on your game." So here's what I'm shooting for:

Turn-based strategy game, with 2 main "interfaces":

World Map - sort of like Risk. Top down (or fixed angle) camera, movement only in XY axes. The map is divided into territories, and at one end you have a base which generates new units at a rate which depends on how much territory you actually own. The only functions which are handled here are:
- moving units from territory to territory (either by group or individuals)
- queuing up which units you wish to build

Since the view is from a fixed height and encompasses the entire (scrollable) world map - I may not even bother with 3d models here save for buildings and maybe not even then. Everything is designed to just be representational in a strategic planning sort of way. Anyway, when each player has had a turn moving Units on the World Map, any territory which they BOTH have units in is considered "contested" which leads to the other interface:

Battle Screen - sort of like Battle Chess or even Archon if you can remember that far back. 3D space, player controlled camera. 3D models for each Unit. The combat is based on a grid, so the grid would be overlaid on top of the terrain, and each player is allowed to place their units on their own side of a Neutral Zone in the middle of the playfield. Once both players have placed units, the skirmish begins. For each player's turn, each unit can either Move or perform an Action (attacking, special ability, etc). Rinse-repeat until one side is defeated, at which point that Territory is now under control of the winner. Return to the World Map and if there are any contested territories left, the winner picks where the next skirmish occurs, until they are all decided. Play then returns to the World Map where the strategy turn occurs.

The nice thing about it all being turn-based is: aside from models colliding with the floor, I don't need much at all in the way of collision detection. All attacks/abilities have a range and area of effect measured in grid squares. If say an explosion has a radius of 5 squares from the target square, then anything within that area of effect is affected. Easy peasy.

SO - all that being said, and assuming the prototype doesn't suck and it's something I wish to proceed forward with - can anyone recommend an engine that might be suitable for handling that kind of stuff?



And before I get berated for trying to do too much: my plan is to prototype the World Map first, with only ONE type of Unit, with any combats being resolved by toss of the dice. Then I will prototype Combat, again with only ONE unit type. I use an Iterative approach in my daytime programming job, so will be shooting for the same thing here. Baby steps. Hell, a friend and I are going to sit down and tweak the combat rules using miniatures and dice before I do ANYTHING else. I understand my goals are lofty ones. :)

Adbot
ADBOT LOVES YOU

HaB
Jan 5, 2001

What are the odds?

roomforthetuna posted:

I'm not sure I understand your complaint - Unity is too easy?

Is there something about your game idea that you feel Unity can't do? If there's no part it can't do, and the performance will be fine (which obviously it will for a turn-based game), and you find it easy, then surely the engine you should use is Unity?

I was eyeing Unity for my next project, but since I want to use a custom input device I suspect I'd need the expensive super-pro version that supports custom plugins, which is an unfortunate limitation that counts against it for me, but I don't see anything like that in your idea.

Wasn't really a complaint so much as an observation. I guess I will see how well Unity performs for what I want to do when I get far enough along. I guess I'm just used to being a coder - so the drag and drop thing is sort of alien to me.

HaB
Jan 5, 2001

What are the odds?

Paniolo posted:

I'd suggest deciding if you want this project to be about making a game, or programming a game. Because if you're turned off by not writing code, then my advice is to just work on a programming project, like a hobby engine or tech demo. If you actually want to make a finished game then use Unity or GameMaker or mod an existing game or whatever is at your disposal, because actually making a game is such an enormous amount of work that an individual simply cannot afford to not take every shortcut possible.

Well, I will probably go ahead with prototyping on Unity at least. If the game ends up being awesome enough to warrant going with a more ground-up route then we can address that when the time comes. I'm working with one other developer and are talking to a few artist friends. Both of us devs have 10+ years of C# experience, but he has ZERO game programming experience and as I've said - I've only dabbled. I'm hoping that doing it in Unity and getting it up and working will give us some idea of how we might implement on our own, should we go that route.

HaB
Jan 5, 2001

What are the odds?
Anyone got a good recommendation on a decent HLSL reference book?

Don't really need a "Teach Yourself...." just more of something like a Cookbook.

HaB
Jan 5, 2001

What are the odds?

Rocko Bonaparte posted:


Since I thought doing this would actually be easier I have concluded it's not helping and have about given up. So then I figured maybe I could model something really simple in Blender, like a cube person or something. Except that all the modeling videos are done by people talking through retainers that assume you already know how to use Blender, and basically imply you already know how to do everything they're showing anyways. So I've gotten a little bit frustrated. I have done level editing in Radiant before so I thought I'd have some basis for this, but I can't even figure out what views and magic keys I need to make a model with some basic animations.

And all this before I really write any code! :(

Can't help with your model loading/animating problem, but having ZERO 3D modelling experience myself, I set out to learn Blender and found this, which worked pretty drat well:

http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro

I dunno about all the way to "Pro" but I definitely go from "Noob" to "Passable" using that.

HaB
Jan 5, 2001

What are the odds?

Mustach posted:

Then use an engine like libtcod instead of writing one from scratch.

This. libtcod is really nice, can be called from nearly any language you can think of and let's you concentrate on what you JUST said - taking your ideas and turning them into something concrete. You will hear it repeated ad nauseum in this thread: make a GAME, not an ENGINE, unless as already pointed out - you want to be an engine developer.

I messed around with libtcod and had something up and running about literally an hour.

HaB
Jan 5, 2001

What are the odds?
Messing about with some Minecraft stuff, and I feel dumb for asking this, but I can't think of a way to create the algorithm.

MC's world is divided into square chunks: 16x16x128 regions of the world. I am trying to run a search for X number of chunks away from a specific chunk. So if I am on Chunk A, and my search radius is 1, then the search should encompass A + the 8 surrounding chunks. Search radius of 2 would add the next "ring" outside that for a total of 25, etc.

I'm sure there's some way I can leverage the fact that these are all odd numbered squares (3x3, 5x5, 7x7, etc). But heck if I can figure out how to. I have access to functions like "GetNorthNeighbor()" but it seems tedious and silly to go A -> North -> East -> South -> South -> West -> West -> North -> North. And even sillier to keep doing that the further out I go.

Suggestions? C# is the language I'm using if that helps.

HaB
Jan 5, 2001

What are the odds?

PDP-1 posted:

Assuming the chunks are indexed in some way, would this work?

code:
List<Chunk> GetChuncks(int xCenter, int yCenter, int radius)
{
  List<Chunk> = new List<Chunck>();

  for(int i = xCenter - radius; i <= xCenter + radius; ++i)
    for(int j = yCenter - radius; j <= yCenter + radius; ++j)
    {
      if(i and j are valid chunk indicies) chunkList.Add(chunk[i,j]);
    }

  return chunkList;
}

They are stored by coordinates. Apparently MC uses a few internal coordinate systems. I am trying to figure out how to convert world coords into chunk coords so I can figure out which chunk the player is in, since that's where I want my search to be centered.

HaB
Jan 5, 2001

What are the odds?
I don't see a Minecraft-related development thread, so I figure I'll ask here just in case.

Does anyone know the method by which Minecraft generates the initial player spawn based on the seed? All I can find from googling is a general "picks a location within a few hundred blocks of (0, 0) and tries to spawn, if it fails, it increments until it finds a valid location"

And that's all well and good except it's not random. If I start a world with a particular seed, open it up, check my spawn coords, then delete the world and re-create using the same seed, I get the same spawn point.

So...does anyone know what method it's using to choose? Thanks in advance.

HaB
Jan 5, 2001

What are the odds?

Zhentar posted:

In this context, "seed" is short for "random seed". The whole point of entering the seed is that exactly the same "random" numbers will come up when you use it.

Yeah I know. What I mean is, Minecraft is using that seed in some equation that sets the spawn point. I'm trying to see if anyone knows what that equation is.

HaB
Jan 5, 2001

What are the odds?

ShoulderDaemon posted:

It is as you described. Minecraft picks a random point within a few hundred blocks of (0,0) until it finds one that's an acceptable spawn location.

If it's random, then it wouldn't be the same every time the same seed is used. That's what I'm saying. Here's a test to prove it:

Load Minecraft.
Create a New World, Select More World Options
Enter 1 as the seed
Create World
when it loads, don't move and hit f3 to look at your coordinates.
You are standing at: (251.5, 65.6, 232.5)

If it's random, then how do I know where YOU are standing?

It's based on the world seed. I'm trying to figure out HOW.

HaB
Jan 5, 2001

What are the odds?

Orzo posted:

I'm not sure I follow. The algorithm which generates worlds is using a random number generator with a seed. The algorithm which places the player is using the same seed. So it appears 'random', although it is deterministic when you give it a certain seed. As for what the algorithm is, you'd need the source code.

Jeez, guys. I know how pseudorandom number generators work! The same as they have worked since time immemorial. I bolded the ACTUAL answer above. But I know other people have already decompiled and deobfuscated the code, so I was just asking if anyone knew the algorithm offhand or could at least point me in a direction other than "this is how random number generators work." :downs:

MonsterUnderYourBed posted:

There is a minecraft modding thread in Games which would probably be more able to answer your question.

Ah-ha! I only looked in Cavern of COBOL. Thanks.

HaB
Jan 5, 2001

What are the odds?

westborn posted:

:psyduck:
Could you people get of your high horses for a second and actually read his initial question. He clearly does know how the seed for the terrain generation works. He was asking how the spawnpoint is determined afterwards, as Minecraft has/had the tendency to not always spawn you at the same point on the same seed.
That's why the web is telling him it's a "pick some random locations near 0,0,0 till you find sand" approach, but his observation is that it's not.
So he thinks it's probably connected to the seed and therefor not random at all.

Somehow some of you only read every second word and post to form "Hey guys, wtf, this seed generates the same terrain every time, how does it do that?"
The post you quoted was him showing the spawn isn't random, not him trying to show the world generation with the same seed isn't random and trying to figure out why...

Bless you, sir. :)

ZombieApostate posted:

It's probably just doing something along the lines of x = randomNumber(), y = randomNumber(), z = randomNumber(), in which case, all you need to know is how random numbers are generated. It might be incrementing the coords by the random numbers or something so you don't repeat or run through all the spaces in whatever limit you supply your random number generator, but that isn't really much of an algorithm, which is, I think, why everybody is giving similar answers about how random numbers are generated.

I spent a few hours last night wading through the Minecraft sources, but following the chain backwards from where the player is actually spawned only leads me to one spot where it's grabbing 3 int values from an NbtTree (which seems to work like a hashtable but can return multiple types instead of just one). I assume the tree is populated using the map seed but hell if I can figure out where that's happening. Specifically:

from WorldInfo.java:
code:
spawnX = nbttagcompound.getInteger("SpawnX");
spawnY = nbttagcompound.getInteger("SpawnY");
spawnZ = nbttagcompound.getInteger("SpawnZ");
If I can just find where nbttree["SpawnX"] is actually getting populated, I'm there.

HaB
Jan 5, 2001

What are the odds?

Red Mike posted:

No, he clearly doesn't. Here:


It's pseudo-random, and it uses the same seed, so it always spawns you at the same point on the same seed.

It just uses the generator as it does when it creates the terrain. This uses x numbers from the pseudo-random series. The next 3, x+1, x+2, and x+3 are used to generate the first location it tries to put the player on. These are always the same if you use the same seed, because of how pseudo-random generators work. He clearly does not understand this, or he wouldn't be asking why they're the same every time.

And yes, you misread and thought he was arguing that it doesn't spawn at the same point for the same seed, next time read a little further.

To answer you, it uses the first 3 numbers it gets after generating the world, then, if they aren't valid, increments each one by 1 until it gets a position that works. Considering the same seed will give you the same sequence of 3 numbers after world generation every time, obviously you'll get the same position for the same seed.

:psyduck:

I have no idea how this derail got so far so fast. I assure you, several condescending explanations aside, I know exactly how pseudorandom number generators work.

Picking the coordinates for spawn is obviously not as simple as "hurrrrrr get the next number from the generator" because NOTHING in Minecraft is that simple. Chunk generation uses an algorithm which goes beyond "hurf durf here's another number from the generator." It uses a bunch of constant values PLUS the random numbers and does something that eventually results in a chunk full of blocks.

It does the same thing with the spawn point, not just "grab 3 random numbers and check if that's valid, increment if it doesn't"

In my second post I said:

quote:

Yeah I know. What I mean is, Minecraft is using that seed in some equation that sets the spawn point. I'm trying to see if anyone knows what that equation is.

So FORGET I ever mentioned the words "seed", "random" and "pseudorandom". I REALIZE it's deterministic based on the seed provided to the random number generator.

So let's pretend x, y, z are numbers pulled out of thin air. Minecraft then does something to those 3 numbers that results in Spawn.X, Spawn.Y and Spawn.Z. ALL I want to know is - what is something in this instance.


And as I have already determined on my own, Minecraft loads up a hashtable (NbtTree) of all the pertinent game values, and then spends the rest of the time just doing lookups in that hashtable. I have found where it does the lookup in the table for spawn x, y, z. What I can't find is where those 3 values get populated into the hashtable.

And as far as your "answer" - can you point me to the lines in the MC source where it does that? Or even just the class file it's in?

HaB
Jan 5, 2001

What are the odds?

Pfhreak posted:

I think I see what's going on here. Most of us are abstracting your question of "How, exactly, does Minecraft generate a starting location?" into, "How do games typically generate a deterministic random set of variables?" For most of us, and for most of the questions in this thread, working at the abstraction level is pretty common for helping someone understand whatever problem they are working on.

It sounds to me like you have a project in mind ("I would like to be able to predict a start location for a given seed so I can use that value in my mod/hack/web thing/whatever.") But you haven't really talked about what it is, so it sounds like what you are asking is for general details about random world generation, of which Minecraft is an example.

I agree with you, so let me be specific about what I am trying to do.

I'm basically writing a map search/view utility. I am using Substrate which a C# library someone wrote for use with Minecraft. (Yes, I already am discussing this in a thread on the minecraft forums with the developer of Substrate). So basically, instead of needing to load a level.dat file, I am generating the map in memory from the seed. The map itself is generating perfectly. That's all Substrate built-in functions for the most part. However, the dev seems to have glossed over the setting of the initial spawn location part, because he just sets it to (0, 64, 0) and leaves it at that. So if I save my generated map and load it in MC and compare against the MC version, everything is the same except for the spawn point, because mine is always (0,0) and Minecraft is picking a different one.

My search utility will search within a certain number of chunks from the player's location, or if it's a new world, from the spawn point. So I need to be able to determine the spawn point based on the world seed - which is how everything else is determined.


ShoulderDaemon posted:

World.java has getInitialSpawnLocation() which boils down to this:

code:
Create random number generator seeded using world seed.
Find all biomes within 256 cells of (0,0) which are one of the 5 valid spawn biomes.
Choose one such biome randomly with equal weight.
Let (x,y) = the center of that biome.
Repeat:
  Find the uppermost block at (x,y).
  If that block is grass, you're done.
  x += rand(64) - rand(64)
  y += rand(64) - rand(64)
The "find all biomes" step is in still-obfuscated portions of minecraft's codebase, so my 5-minute-understanding of it may be mistaken.

Edit: For me, at least, a big part of the confusion with this whole thing is that this is an algorithm I would not be shocked to find described as "picks a location within a few hundred blocks of (0, 0) and tries to spawn, if it fails, it increments until it finds a valid location" so it's been weird that HaB seemed to want something more.


I want something more because I need to duplicate it elsewhere, and that description, while generally correct is useless for writing actual code. I will look at world.java to see if I can find what you're referring to. Thanks.

Edit: one step closer. the 5 biomes returned are: forest, plains, taiga and two still obfuscated ones. That's closer, tho!

HaB fucked around with this message at 18:34 on Feb 18, 2012

HaB
Jan 5, 2001

What are the odds?

Red Mike posted:

:words:

*sigh*

Red Mike posted:

e: Christ almighty, I'm being pedantic and unhelpful. I'll stop this, my apologies.

This. So much this.


HaB posted:

Does anyone know the method by which Minecraft generates the initial player spawn based on the seed? All I can find from googling is a general "picks a location within a few hundred blocks of (0, 0) and tries to spawn, if it fails, it increments until it finds a valid location"

And that's all well and good except it's not random. If I start a world with a particular seed, open it up, check my spawn coords, then delete the world and re-create using the same seed, I get the same spawn point.

So...does anyone know what method it's using to choose? Thanks in advance.

I bolded the only part you really needed to pay attention to. The other part was pointing out that the google results I was seeing kept saying "picks a random location blah blah" and I was pointing out that it's NOT random because I know how pseudorandom number generators work. I even said it's "based on the seed" at which point this dumb derail got started.

K. I will stop now too. Great googly moogly.

HaB
Jan 5, 2001

What are the odds?

poemdexter posted:



I might actually finish a game project for once. I'm using LÖVE (love2d.org) which is Lua + Box2D physics + some graphic stuff. It feels a lot like python and pygame without all of pygame's nice libraries. It's also missing a lot of Box2D functionality (BoundaryListener god drat it) but I'm working around it.

The game plays like an old 5 and half inch floppy game called cannons. Take turns firing at the other player trying to score hits. I wanted to keep it as basic as possible so I'd actually finish it.

I just started playing around with Love also. It's neat. My first Lua experience as well.

Got a question tho, and since some folks in the thread are familiar with Box2D, maybe someone will know.

I'm recreating the old "zombie infestation simulator" since it's complex enough to give you a good handle on the language/framework but not so complicated as to take forever.

So I am generating a bunch of rectangles as buildings, each of which I am giving a love.physics.body and a love.physics.shape. When I go to actually spawn my zombies, I am using building.shape:testPoint() to see if the spawn point is inside a building (don't want). I think it's because I don't understand how the shapes work. The wiki says that the x/y args to newRectangleShape are "the offset along the x/y axis". Offset from what? The Body associated with the shape?

here's my code to generate the buildings:
pre:
function generateBuildings()

	for i=1, buildingCount do
		local w = ((buildingMaxSize - buildingMinSize) * math.random()) + 1
		local h = ((buildingMaxSize - buildingMinSize) * math.random()) + 1
		local x = (mapWidth - w) * math.random()
		local y = (mapHeight - h) * math.random()
		local body = love.physics.newBody(world, x, y, 0, 0)
		local shape = love.physics.newRectangleShape(body, 0, 0, w, h, 0)
		buildings[i] = { Body = body, Shape = shape, X = x, Y = y, W = w, H = h }
	end

end
and the function called to check each spawn point:
pre:
function pointInBuilding(x, y)
	for i=1, #buildings do
		if buildings[i].Shape:testPoint(x, y) then
			do return true end
		end
	end 
	return false

end
I know that pointInBuilding() is returning true SOME of the time, because I have an escape function that tries to spawn X number of times and aborts if it fails. Through some debug prints to screen, I have seen things take multiple times to spawn. It seems like my Shape isn't matching up with the actual Rectangle being drawn on screen. I can't figure out where the disconnect is, so I figured it was the x/y offset thing, since there's no explanation of it.

Anyone? Bueller? Anyone?

HaB
Jan 5, 2001

What are the odds?

poemdexter posted:

shape :words:

So the center of the shape is the top left corner of the sprite? So assuming I offset by width/2, height/2 that should give me what I want, yes?

Edit: yes, that worked. Thanks for the clarification. :)

HaB
Jan 5, 2001

What are the odds?
Blarg. Okay. I need some suggestions/advice. Forgive me, but this will likely be long.

Working on a game that's sort of a mix of an RTS, Risk and say....Blood Bowl.

It's turn-based.

I am still trying to spec out the stats for my units (Good vs Evil) and I am running a bunch of combat simulations to see how well various combinations match up to each others. Right now I am sticking to pure combat units (no spell casters).

So assuming each Unit has these stats:

- HP (hit points/health)
- AttackRating (how likely unit is to hit something)
- Defense (how difficult the unit is to hit)
- AttackDamage (how much damage the unit does when it hits)

There is also a 1 in 10 chance of a Critical Hit (double damage) on a successful hit.

So two example units to start, and these are the weakest units on either side and are fairly evenly matched.:

peasant: HP 5, AR: 50%, Def: 15%, Dmg: 2
goblin: HP 5, AR: 45%, Def: 15%, Dmg: 2

My algorithm for resolving an attack is:
pre:
BaseChance to Hit = Attack.AR - Target.Def

if(Random.Next(100) < BaseChance)
   if(Random.Next(10) == 1)
        CriticalHit();
   else   
        Hit();
else
   Miss();

Also: a game "day" is divided into 4 turns: Dawn, Day, Dusk, Night

So here's the issue:

a 5v5 combat of the above units, selecting the first non-dead unit on the opposing side as a target, with each unit getting to attack once per turn (or 4 times per game day) takes anywhere from 9-15 turns to resolve. Team Good wins slightly more often, as expected since they have a slightly higher AR. But it's pretty even.

That seems.....long to me. Here's why I say so. The game has two main "screens":

A world map, which is divided into territories (10-20), like Risk. All you do here is move units from place to place. More territories controlled = more "build points" to make new units with.

A Territory map, which will be either square or hex-tile based. This is where combat actually happens. When a team moves units into an occupied territory on the world map, it shifts to the territory map to resolve the combat.

Now I know games of Risk can go on FOREVER, and it's not even resolving combat on an individual unit basis. The combat in my game works more like Blood Bowl. Each unit can either move or attack once per turn. That is: either move X number of squares, or attack any single opponent within range. But Blood Bowl games have a limited number of turns per half, which resolves the length problem. I certainly don't want a game that takes real-time DAYS to play a complete game of.

So for perspective: in the above 5v5 combat, each player moves/attacks with each unit each turn. That's 10 actions per turn. Like I said - 9-15 turns to resolve using the params above. That's 90-150 actions. :stare: That's ONE territory dispute, and not even a big one. I can impose limits on how many units can occupy a territory, but even 10v10 doesn't seem unreasonable. So DOUBLE all that and you're talking 200-300 actions to resolve a single territory dispute. So yeah...

So...I guess I'm looking for suggestions on overall design, to make this something that's actually feasible to play in a single sitting.

HaB
Jan 5, 2001

What are the odds?

Rocko Bonaparte posted:

I'm thinking maybe look at Ogre Battle for some inspiration, since I think it's doing a similar thing with multiples attacking multiples.

I'm also thinking about the amount of smacking around that's happening with just one peasant and one goblin. If they just take turns smacking each other, it looks to me like the normal formula would be who hits first wins. So they'd take turns taking away 2 HP each time, going around 5 times before the fatal blow. If that exchange is common then that would be tedious.

Something perhaps to consider is having more personality to the different individual units. I recall how in the original Warcraft, the humans and orcs were practical identical, except a small difference in their projectile attack and their magic attack. In those cases it's mostly a logistics game, and not a tactical one. If it's not tactical, you might as well just take the combined math of everything and declare a winner without the interactive combat.

Well these are just the base units. There are 6 unit types for each side with varying stats/abilities. Here's an example combat run:

pre:
Peasant 1 is attacking Goblin 6
Peasant 1 misses!
Peasant 2 is attacking Goblin 6
Peasant 2 misses!
Peasant 3 is attacking Goblin 6
Peasant 3 misses!
Peasant 4 is attacking Goblin 6
Peasant 4 hits Goblin 6
Goblin 6 takes 2 hp of damage!
Peasant 5 is attacking Goblin 6
Peasant 5 hits Goblin 6
Goblin 6 takes 2 hp of damage!
Goblin 6 is attacking Peasant 1
Goblin 6 misses!
Goblin 7 is attacking Peasant 1
Goblin 7 hits Peasant 1
Peasant 1 takes 2 hp of damage!
Goblin 8 is attacking Peasant 1
Goblin 8 hits Peasant 1
Peasant 1 takes 2 hp of damage!
Goblin 9 is attacking Peasant 1
Goblin 9 hits Peasant 1
Peasant 1 takes 2 hp of damage!
Peasant 1 is dead!
Goblin 10 is attacking Peasant 2
Goblin 10 misses!
day 0, turn: 1
Peasant 2 is attacking Goblin 6
Peasant 2 misses!
Peasant 3 is attacking Goblin 6
Peasant 3 hits Goblin 6
Goblin 6 takes 2 hp of damage!
Goblin 6 is dead!
Peasant 4 is attacking Goblin 7
Peasant 4 hits Goblin 7
Goblin 7 takes 2 hp of damage!
Peasant 5 is attacking Goblin 7
Peasant 5 hits Goblin 7
Goblin 7 takes 2 hp of damage!
Goblin 7 is attacking Peasant 2
Goblin 7 hits Peasant 2
Peasant 2 takes 2 hp of damage!
Goblin 8 is attacking Peasant 2
Goblin 8 hits Peasant 2
Peasant 2 takes 2 hp of damage!
Goblin 9 is attacking Peasant 2
Goblin 9 hits Peasant 2
Peasant 2 takes 2 hp of damage!
Peasant 2 is dead!
Goblin 10 is attacking Peasant 3
Goblin 10 misses!
day 0, turn: 2
Peasant 3 is attacking Goblin 7
Peasant 3 hits Goblin 7
Goblin 7 takes 2 hp of damage!
Goblin 7 is dead!
Peasant 4 is attacking Goblin 8
Peasant 4 hits Goblin 8
Goblin 8 takes 2 hp of damage!
Peasant 5 is attacking Goblin 8
Peasant 5 misses!
Goblin 8 is attacking Peasant 3
Goblin 8 hits Peasant 3
Peasant 3 takes 2 hp of damage!
Goblin 9 is attacking Peasant 3
Goblin 9 misses!
Goblin 10 is attacking Peasant 3
Goblin 10 misses!
day 0, turn: 3
Peasant 3 is attacking Goblin 8
Peasant 3 hits Goblin 8
CRITICAL HIT!
Goblin 8 takes 4 hp of damage!
Goblin 8 is dead!
Peasant 4 is attacking Goblin 9
Peasant 4 hits Goblin 9
Goblin 9 takes 2 hp of damage!
Peasant 5 is attacking Goblin 9
Peasant 5 misses!
Goblin 9 is attacking Peasant 3
Goblin 9 hits Peasant 3
CRITICAL HIT!
Peasant 3 takes 4 hp of damage!
Peasant 3 is dead!
Goblin 10 is attacking Peasant 4
Goblin 10 hits Peasant 4
Peasant 4 takes 2 hp of damage!
day 1, turn: 0
Peasant 4 is attacking Goblin 9
Peasant 4 misses!
Peasant 5 is attacking Goblin 9
Peasant 5 misses!
Goblin 9 is attacking Peasant 4
Goblin 9 misses!
Goblin 10 is attacking Peasant 4
Goblin 10 misses!
day 1, turn: 1
Peasant 4 is attacking Goblin 9
Peasant 4 hits Goblin 9
Goblin 9 takes 2 hp of damage!
Peasant 5 is attacking Goblin 9
Peasant 5 misses!
Goblin 9 is attacking Peasant 4
Goblin 9 misses!
Goblin 10 is attacking Peasant 4
Goblin 10 hits Peasant 4
Peasant 4 takes 2 hp of damage!
day 1, turn: 2
Peasant 4 is attacking Goblin 9
Peasant 4 hits Goblin 9
Goblin 9 takes 2 hp of damage!
Goblin 9 is dead!
Peasant 5 is attacking Goblin 10
Peasant 5 hits Goblin 10
Goblin 10 takes 2 hp of damage!
Goblin 10 is attacking Peasant 4
Goblin 10 hits Peasant 4
Peasant 4 takes 2 hp of damage!
Peasant 4 is dead!
day 1, turn: 3
Peasant 5 is attacking Goblin 10
Peasant 5 hits Goblin 10
Goblin 10 takes 2 hp of damage!
Goblin 10 is attacking Peasant 5
Goblin 10 misses!
day 2, turn: 0
Peasant 5 is attacking Goblin 10
Peasant 5 hits Goblin 10
Goblin 10 takes 2 hp of damage!
Goblin 10 is dead!
day 2, turn: 1
So 9 turns total, and the Peasants win by one guy. And I only see 1 turn where everyone misses.

HaB
Jan 5, 2001

What are the odds?

Centripetal Horse posted:

Is there a reason that simply adjusting the Attack Rating and Defense numbers is not an option? It seems to me to be the simplest way to speed up combat. Glancing at your numbers, it seems that your example leads to around two out of three attacks missing.

Assuming players directly control combat, they may apply strategies such as focusing on a single enemy, which could change the number of turns required to resolve a battle.

Another idea is to use action points instead of one-action-per turn.

2/3 attacks missing with these units, yes. The primary role for both is to hold territories. Each side has a mid-level fighter (Man-At-Arms/Zombie), and a high-level one: (Knight/Wolf). But then there's support units (healing spells) and offensive casters as well.

So like here's an example run between a Knight vs 5 Goblins (should be a blowout for the Knight):

pre:
Knight 1 is attacking Goblin 2
Knight 1 hits Goblin 2
Goblin 2 takes 12 hp of damage!
Goblin 2 is dead!
Goblin 3 is attacking Knight 1
Goblin 3 misses!
Goblin 4 is attacking Knight 1
Goblin 4 misses!
Goblin 5 is attacking Knight 1
Goblin 5 misses!
Goblin 6 is attacking Knight 1
Goblin 6 misses!
day 0, turn: 1
Knight 1 is attacking Goblin 3
Knight 1 hits Goblin 3
Goblin 3 takes 12 hp of damage!
Goblin 3 is dead!
Goblin 4 is attacking Knight 1
Goblin 4 misses!
Goblin 5 is attacking Knight 1
Goblin 5 misses!
Goblin 6 is attacking Knight 1
Goblin 6 misses!
day 0, turn: 2
Knight 1 is attacking Goblin 4
Knight 1 hits Goblin 4
Goblin 4 takes 12 hp of damage!
Goblin 4 is dead!
Goblin 5 is attacking Knight 1
Goblin 5 misses!
Goblin 6 is attacking Knight 1
Goblin 6 misses!
day 0, turn: 3
Knight 1 is attacking Goblin 5
Knight 1 hits Goblin 5
Goblin 5 takes 12 hp of damage!
Goblin 5 is dead!
Goblin 6 is attacking Knight 1
Goblin 6 misses!
day 1, turn: 0
Knight 1 is attacking Goblin 6
Knight 1 hits Goblin 6
Goblin 6 takes 12 hp of damage!
Goblin 6 is dead!
day 1, turn: 1
The Knight's AR is 85 with a def of 75, so the Goblin has basically NO chance of hitting a Knight. I suppose I may have to consider the possibility of a lucky hit or something.

Here's Wolf (AR: 80, Def: 60) vs 5 Peasants:
pre:
Peasant 1 is attacking Wolf 6
Peasant 1 hits Wolf 6
Wolf 6 takes 2 hp of damage!
Peasant 2 is attacking Wolf 6
Peasant 2 misses!
Peasant 3 is attacking Wolf 6
Peasant 3 misses!
Peasant 4 is attacking Wolf 6
Peasant 4 misses!
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 1
Wolf 6 misses!
day 0, turn: 1
Peasant 1 is attacking Wolf 6
Peasant 1 hits Wolf 6
Wolf 6 takes 2 hp of damage!
Peasant 2 is attacking Wolf 6
Peasant 2 misses!
Peasant 3 is attacking Wolf 6
Peasant 3 misses!
Peasant 4 is attacking Wolf 6
Peasant 4 misses!
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 1
Wolf 6 misses!
day 0, turn: 2
Peasant 1 is attacking Wolf 6
Peasant 1 misses!
Peasant 2 is attacking Wolf 6
Peasant 2 misses!
Peasant 3 is attacking Wolf 6
Peasant 3 misses!
Peasant 4 is attacking Wolf 6
Peasant 4 misses!
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 1
Wolf 6 misses!
day 0, turn: 3
Peasant 1 is attacking Wolf 6
Peasant 1 misses!
Peasant 2 is attacking Wolf 6
Peasant 2 misses!
Peasant 3 is attacking Wolf 6
Peasant 3 misses!
Peasant 4 is attacking Wolf 6
Peasant 4 misses!
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 1
Wolf 6 misses!
day 1, turn: 0
Peasant 1 is attacking Wolf 6
Peasant 1 misses!
Peasant 2 is attacking Wolf 6
Peasant 2 misses!
Peasant 3 is attacking Wolf 6
Peasant 3 misses!
Peasant 4 is attacking Wolf 6
Peasant 4 hits Wolf 6
Wolf 6 takes 2 hp of damage!
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 1
Wolf 6 hits Peasant 1
Peasant 1 takes 10 hp of damage!
Peasant 1 is dead!
day 1, turn: 1
Peasant 2 is attacking Wolf 6
Peasant 2 misses!
Peasant 3 is attacking Wolf 6
Peasant 3 misses!
Peasant 4 is attacking Wolf 6
Peasant 4 hits Wolf 6
Wolf 6 takes 2 hp of damage!
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 2
Wolf 6 hits Peasant 2
Peasant 2 takes 10 hp of damage!
Peasant 2 is dead!
day 1, turn: 2
Peasant 3 is attacking Wolf 6
Peasant 3 hits Wolf 6
Wolf 6 takes 2 hp of damage!
Peasant 4 is attacking Wolf 6
Peasant 4 misses!
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 3
Wolf 6 hits Peasant 3
Peasant 3 takes 10 hp of damage!
Peasant 3 is dead!
day 1, turn: 3
Peasant 4 is attacking Wolf 6
Peasant 4 misses!
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 4
Wolf 6 hits Peasant 4
Peasant 4 takes 10 hp of damage!
Peasant 4 is dead!
day 2, turn: 0
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 5
Wolf 6 misses!
day 2, turn: 1
Peasant 5 is attacking Wolf 6
Peasant 5 misses!
Wolf 6 is attacking Peasant 5
Wolf 6 hits Peasant 5
Peasant 5 takes 10 hp of damage!
Peasant 5 is dead!
day 2, turn: 2
I think all the units are measuring up to each other about like I'd expect. It's just taking too long to resolve. A Knight vs 5 Goblins SHOULD result in the Knight not having a scratch on him, but it needs to resolve faster, methinks.

HaB
Jan 5, 2001

What are the odds?

Centripetal Horse posted:

If I read the log properly, the knight killed one goblin per turn, and each goblin took one action per turn. I mean, there is no way to shorten that if everybody gets one action per turn, and turns are evenly distributed. Is an initiative system out of the question? If the knight were acting 1.5x as often as the goblins, things would speed up.

Also, the Wolf battle demonstrates what I was thinking: the Defense numbers might need some tweaking. The wolf is missing a lot, considering he is supposed to be a tier above the peasants.

Yeah. He's 2 tiers above actually. I will have to play with the numbers some more. Time to write that config file loader so I can just edit them in a file. :)

HaB
Jan 5, 2001

What are the odds?

Manslaughter posted:

Yeah about this game HaB, I just want to say misses in a turn-based game are the most fun-destroying things ever.
The only way to make a turn-based game exciting is to fill the downtime in with stuff the player has to think/strategize about.

Perhaps it's the masochistic Blood Bowl player in me, but that's sort of the gameplay I am trying to emulate with my combat. In Blood Bowl, one roll of the dice can screw you so hard your mom gets pregnant. :v: I guess the chief difference is that in BB, that results in a turnover which means your turn is now done, whether you've finished moving players or not.

There's a few other factors to the combat which I haven't taken into account yet. The time of day affects combat. Evil creatures are stronger at night, while Good creatures are weaker and vice versa. The only times they are unmodified are Dawn/Dusk. Also Fear comes into play. There is a chance of a unit being afraid of a more powerful unit, and if they are in Fear, they have to shake it off before they can move/attack. At the beginning of each Turn, units may have to take a Fear check (either by spell or ability). if they fail, they are in Fear. Their chances of shaking it off increase with each round, until they either shake it, or it wears off naturally.

I'm wondering if the solution to making an entire game playable in one sitting is to give the player a way to opt-out of manual combat on a territory by territory basis. Like - the game just resolves the combat based on units, etc. and just tells the players the result. But if they want to play one manually, they have the option. At least you can skip over non-critical (strategically speaking) or stupidly one-sided combats this way. Like 5 Knights vs 2 Goblins. Goblins Die. Knights get the Territory - no combat needed.

I still have plenty to do while I continue to ponder this. I haven't done any gameplay or rendering code yet. I think my next goal will be to get the world map up and working, with computer resolved combats. That will give me a good long while to think about all this crap. I'm kinda making two games in one here, but I can't see a way to make either component compelling enough on its own without having the other. Just the world map = basically Risk. Just the Territory/Combat parts opens up a bunch of other questions - how do you decide which units are there? Could be a point system like BB/WH40K uses. You get 1000 points to "buy" an army, arrange them on the battle field and fight it out. But there's some special units that add a lot of strategic value even from a World Map perspective that have strategic roles in combat, too.

poo poo. I guess it's just too many variables to worry about it right now. until I have some code up and running with all the units in place, it will be hard to tell.

HaB
Jan 5, 2001

What are the odds?

seiken posted:

I see a few fundamental problems with your design, let's see if I can articulate them properly.

First, you have all these rules and stats like attack/defense, day/night cycle making you stronger and weaker, but as far as I can see they don't actually affect strategy in any way. Your guys could be strong or weak or whatever but in all cases the optimal strategy is simply to focus all attacks on a single enemy one by one until they're all dead, in whichever order reduces the enemy force's damage output the quickest. (Perhaps also attempting to avoid "overkill" if you have to issue orders all the same time but that not even that if you issue orders one at time.) None of the mechanics do anything to change strategy at all, essentially you just have a bunch of layers of complexity that reduce to a trivial problem and that's not really interesting.

Second, I'm assuming you have these 3 units and their attack/defense values sort of line up, so whichever unit has the best attack also has the best defense. This is kind of boring because nothing has strengths or weaknesses, they're just either good or bad.

Furthermore, the attack and defense stats are sort of redundant because having higher defense is a lot like having higher health and the same for attack/damage. They're not completely redundant because they introduce a little non-linearity which is good, but if all the stats line up for the units then they're mostly just artificially extending things by adding a chance for nothing to happen (while further biasing the strong units against weak ones). Critical hits is just like adding a bit of damage, doesn't add any strategy.

Anyway, all that matters for tactics is the enemy defense/HP and your attack/damage. So in this model you couldn't make a tactically interesting "glass cannon" unit since a single unit's offensive and defensive stats never have anything to do with each other. You could make units with high defense and low HP (or vice versa) or high attack and low damage (or vice versa) which would add "gambling" into the strategy but you still wouldn't really have any tactical choices, I don't know.

So basically I'm saying you need some actual tactical complexity if you want there to be any point to manually playing these things at all, not just fake complexity that doesn't influence tactical choices. I haven't really worded it that well but hopefully you see what I mean.

Anyway here's a couple things to think about. If you dropped the attack statistic and made the defense value a flat damage reduction, like
pre:
dude.HP = dude.HP - max(0, attacker.damage - dude.defense)
this would do the non-linearity job of your current defense/attack statistics combined in a simpler and more obvious way, without the weirdo delaying effects of rolling to miss all the time. Although you say you like the randomness aspect but there's lots of places you can add randomness like attacks could be 1d6 or whatever. I'm not convinced that attacks missing is the best way to do it. But really you need some special abilities on your units or a positioning system or something to add tactical choices. drat I wrote way too much about this and I have a nagging feeling someone more versed in the language of game design could have expressed this all in a couple sentences but there you go.

I guess I have jumped the gun in posting anything, and probably should have waited till I had all the units functioning before worrying about it. I have appreciated the advice so far, including yours.

The strategy element enters in to timing, and again, if you've played Blood Bowl, this will make total sense. Let's say we're playing out a combat that is slanted fairly well in your (Good) favor on a pure AR/Dmg strength basis. If I can maneuver correctly, I can keep just out of your attack range until say Dusk, when I start to push in, timing it so that my units are in range right at Night fall. Now I get a large bonus to Attack rating, Defense, critical hit chance AND how much damage I do. Overall strength at least for that turn is overwhelmingly in my favor. Of course if I don't manage to even things up and get away until Day, then I am equally as screwed as you just were. Of course you have the same options, and I would need to impose some kind of limit - like if an entire day goes by with neither player actually making an attack then the territory remains undecided until after the next World map phase, at which point both players might adjust the number of units in that territory.

But I feel ya, and admittedly, I have left out a whole bunch of things about the design. There are actually 6 units per side, and really only the lower 3 are just varying strengths of grunt/infantry units. The upper 3 for each side have more strategic value. Here's the unit layouts and a brief description:

GOOD

Peasant - weak, barely combat trained, easily prone to fear
Man-At-Arms - medium strength/def, not quite as easily cowed as the Peasant
Knight - heavy fighter, and more importantly - very mobile.
Priest - basic support unit. Can fight okay, but better used as a healer, and can turn Evil creatures. Spells are Heal - just what it sounds like, and Bless - gives friendly units an increased attack rating and makes them less prone to Fear for a time.
Seer - a spy unit essentially. From the World map can cast a spell to view enemy troop movements. Can also turn Evil. Also has the spell Rally - instantly removes Fear from friendly units.
Hero - Has both a melee attack and a long-range attack and is almost completely unaffected by Fear. Can cast Rally.

EVIL

Goblin: equivalent to the peasant
Zombie: stronger than a Man-At-Arms, but slower
Wolf: Heavy fighter with a lot of speed. Similar to Knights, but lower Def.
Vampire: Difficult to Turn. Can cast Rally, similar to a Hero, and can also Enthrall an Good unit, placing it under Evil control for a limited time. The big drawback? Cannot Move OR Attack during the day, and if successfully hit by ANY unit during the Day, dies instantly.
Banshee: incorporeal, and invisible until is casts a spell, or a Seer detects it. Cannot fight and cannot be hit, but can be turned. It's one spell is Moan which causes all enemy units to make a Fear check immediately.
Wizard: Cannot fight physically. Can cast 3 spells: Darkness - hides one territory from a Seer's Sight spell. Sleep - puts all friendlies within range to sleep for the duration (saving throw permitted, sleeping targets wake up when hit, but take double damage from a blow while sleeping). And Fireball - basically a tactical nuke. Affects ALL units in a single territory, friend OR foe. Each unit gets a saving throw - if passed, they only take half damage, otherwise, they take full damage.

In fact - manipulating Fear is one of the BIGGEST strategic elements to the game, and I suspect will make combats go much faster, since units currently affected by Fear are essentially sitting ducks. Turn is the equivalent of Fear, and I can probably just use the terms interchangeably. So for example, you make some feints at a Good team which has a Priest - just nickel and diming with Zombies/Goblins. He blows all his mana points Healing and blessing, then you Banshee in, Fear the entire other side, and move some wolves in to clean up right as Night falls.

So I hope that clears things up a bit. It's not an infantry game, really. And Evil may look WAY more interesting to play, but I will be very conscious of game balance. I'm trying to emphasize Good vs Evil, so I don't want Good to have a bunch of destructive spells and things.

HaB
Jan 5, 2001

What are the odds?

seiken posted:

I haven't played blood bowl, so apologies if I missed the point. The fear and unit abilities sound good and should hopefully make things more interesting. I just want to say you didn't mention attack range till now so I don't know how that changes things. I'm interpreting it as you get these strategic choices on the "world map" of range and when to engage and so on. But, if I understand correctly, as soon as you enter the "battle screen" the time of day, advantages of each side and so on are fixed for the duration of the battle, and at that point you just have the unit abilities to make things interesting. So you still gotta make the battles reasonably non-trivial if they are to be manually controlled even without anything like time of day and range and what have you. Maybe the "world screen"/"battle screen" are more intertwined than I thought and I'm talking nonsense.

poo poo, man. I'm not even sure I've gotten that far myself. My initial combat system came from actually playing with miniatures on paper maps and rolling dice. Once I came up with a working system, I coded it. But hell...it could be something completely different by the time I'm done. :)

HaB
Jan 5, 2001

What are the odds?

SupSuper posted:

:words:

A lot of us here are in the same boat. Only thing I have found that even comes close to addressing what you're talking about is this:

http://gameprogrammingpatterns.com/introduction.html

Apparently that's some dude's as yet unfinished book on Design Patterns, but specifically applied to game programming. The few chapters he has are pretty good, but it's barely even started.

Having been reading this thread from it's inception, I can echo what most people have said already: get your game up and running, THEN worry about architecture.

Completing a game, from what I can tell- seems to be about 90% sheer willpower, and 10% coding. Speaking from experience, times I have tried to write an engine, even when I already had a fully formed idea, I lost interest pretty fast. This latest time is the furthest I have ever gotten, and I haven't even thought about "design" or "engines". I just want to be able to play my game. Even if it's programmer art and runs at 3 fps. So far - I haven't lost interest, mostly because I can see GAME things happening. Look! my dudes fight other dudes! Look! that dude's walking now!

If you don't know how to do some specific task, google for someone else's way and use that - just get it done and keep moving forward. Who cares if it fits in your architecture? it works for now and that's good enough.

You can always optimize and tweak and find better ways of doing things later.

HaB
Jan 5, 2001

What are the odds?
Hmm...

K, I am sorta stumped on how to begin something here. Mostly the storage of the data.

If I have a world map that's divided into territories - picture a state map divided into counties, say - and I want to highlight a particular county when the mouse is hovering over it, how would I store the "shape" of the county?

I'm using XNA - does it have some sort of open-ended-number-of-sides polygon? I haven't noticed one anywhere. I figure I could store like a List<Vector2> or something, but for map-style shapes that seems like it could get pretty complex.

What I'm shooting for is a map editor where you can load in a flat terrain image, and then "draw" the territory shapes on it, which it will then save out to some machine-readable map format, or even just XML describing each territory.

So...thoughts?

HaB
Jan 5, 2001

What are the odds?

A bunch of people posted:

:words:

Er...wow. Well, I will do some research on all that stuff. I think the problem is - while I have been an application developer for YEARS, I am very new to Game Programming and am pretty math stupid on top of that. Like I looked at that Point In Polygon page, and I understand it...but how to get from that understanding to code, I just go "who to the what now?" :what:

Guess I will start by cracking open my Data Structures for Game Programmers book. I think it might have quadtrees in it. I think that will at least give me a leaping point. But yeah...math...not my strong suit at all. \:

HaB
Jan 5, 2001

What are the odds?

PDP-1 posted:

How many regions are you planning to have to sort through? Quadtrees are most likely overkill if you'll have less than a few hundred. It's easy to waste tons of time coding up the ~*magical perfect system*~ only to find that you've added a lot of complexity for no real performance gain and it sounds to me like you might be heading down that road.

Just start with the simplest thing that works, which in this case may be to do the point-in-polygon check over all the items until you find a hit. Run the game and see what your performance looks like. If it's too slow, go up one notch in complexity and maybe wrap each region in a circle and if the click point is outside of that circle (a cheap and simple test) the region could not possibly have been clicked on and there's no reason to do the point-in-poly test. Is that fast enough? If no, then now you're in quadtree territory.

Yeah it will be more like 20-30 tops, and even that's probably an over estimate.

HaB
Jan 5, 2001

What are the odds?
Blarg. I have been navel-gazing for so long at this that I have now crawled too far into my own bellybutton to remember which way is up.

I have scaled down my previous game idea, and am now translating the pen and paper game that sparked the original idea in the first place. My map editor is now nearly complete, but I am struggling with finding a decent way to store something.

The map is divided into ~20 territories - irregular polygons. Some of them are part of the Road on the map, others are not. A unit can move one territory at a time, unless they are on the road, in which case they can move two territories along the road, but only one if they leave the road. Since they are irregular - and therefore don't really share any coordinates I can compute neighbors from, and there's only 20 of them anyway, I figure I'll just precompute available moves from each territory, like: from territory A, you can reach B, C, F, G. From B: C D E F. etc.

Trying to figure out the best way to store it. Each Territory has a flat list of available moves? Some sort of hash table? A tiny midget with a little book telling who can move where from what and you bring him some banana chips and a territory and he says "you can move here." ?

I need caffeine.

PS. I am using XNA 4.

HaB
Jan 5, 2001

What are the odds?

OtspIII posted:

How are you generating the shapes? Seiken's ideas for storing the data sound good, but is what you're looking for advice on how to store the data or also how to find it in the first place?


Which pen and paper game is this? I only remember you talking about Blood Bowl, and this sounds pretty far removed from that still.

I'm using the map editor to define the shapes. Can basically go clicky clicky on the map and make closed polygons on top of the map image loaded into the background.

An ancient Mayfair game called Transylvania.

HaB
Jan 5, 2001

What are the odds?

ZombieIsland posted:

Hey guys, I am looking to get into Game Development. I know the language I want to learn is C# and then go to XNA. But, does anyone know of any good Tutorials or anything like that? The kind of games I want to make are 2D/platformer. I really don't know where I should start in learning, if anyone could point me in the right direction I would really appreciated it.

Edit- I am in the process of learning C#

Riemer's tutorials are a pretty good place to start, depending on your level of understanding of C#.

http://www.riemers.net/

HaB
Jan 5, 2001

What are the odds?

Jewel posted:

Riemers' tutorials are only really good for 3D games. If he wants to learn the basics of XNA, try even this super simple, but nice site (it got me started on XNA!) http://www.xnadevelopment.com/tutorials.shtml

Some of the examples are a bit silly and not very practical, but the knowledge behind them helps a ton!

There's a 2D tutorial on Riemer's now that at least has the very basics of spriting and collisions, etc.

HaB
Jan 5, 2001

What are the odds?

Madox posted:

Hey guys - For the last week I've been making a GUI front end for the LibNoise perlin noise library. If you use perlin noise to make height maps or textures, try out my tool and tell me what you think.

I use a lot of heightmaps in my projects, and I was tired of having to twiddle code all the time to manipulate the heightmap generator. I wanted some way to see the effects of different settings, so I made this.

The download is availble on github: https://github.com/MadoxLabs/NoiseTool/downloads

The instructions can be found at https://github.com/MadoxLabs/NoiseTool/wiki

If you don't want to read them, you should at least know that there is a pullout menu on the bottom of each window, and right click parameters to make them type-ins.

Please tell me of any bugs/feature requests or enter them on github.

Here is a sample image:
http://i.imgur.com/w6sOn.jpg

Your timing couldn't be better. I just started looking into libnoise for my terrain editor. I will have to wait till I get home to try this out, but from the screenshots and docs it looks good.

HaB
Jan 5, 2001

What are the odds?

Senso posted:

I've been fiddling with C++ and Allegro and I'm at the point where I have NPCs on the screen moving randomly. Thing is, their walk function is called each time a frame is drawn (I set my FPS to 40). I have some kind of mutex that makes sure random_walk() returns if it's currently running.

C code:
timer = al_create_timer(1.0 / 40.0);
al_register_event_source(event_queue, al_get_timer_event_source(timer));
[...]
if(render && al_is_event_queue_empty(event_queue))
{
	render = false;

	derp.random_walk();
	al_draw_bitmap(derp.tile_array[derp.current_frame], derp1.x, derp1.y, 0);
Obviously, it means the NPCs are zooming across the screen super quickly. So I need to implement some kind of queue that simulates normal speed. I've never tried doing real-time game, I was always making turn-based roguelikes in the past, so it's a nice challenge. What would be the best way to do this?

I could have a counter set on the objects that decrements for every frame (so if set to 160, it should run every 4 seconds or so).
I could also have the NPCs register themselves to a queue with a specific time set for their next scheduled action.

Am I on the right track?

EDIT: I thought about using a job queue and worker threads but I would still get the same problem: the jobs would be in the queue in FIFO order, not really respecting varying NPC speeds - without a possibility to mark a job to run in 20 or 120 ticks, for example.

If I understand you correctly, you need to decouple your movement code from your timestep, as explained here:

http://gafferongames.com/game-physics/fix-your-timestep/

HaB
Jan 5, 2001

What are the odds?

Vivian Darkbloom posted:

I've started playing around with this project. Is there any recommended way to make a province map, where the provinces are irregular shapes instead of tiles or hexes? I guess I'll need to make a digital copy of my province map and get it into pygame somehow.

e: I'm using PyGame! I thought of maybe drawing all the borders between provinces as vectors and writing some code to infer the provinces from those lines? I'd prefer not to do this with a big ol' bitmap, even though it's a 2D game.

I was working on a game project that did this same basic thing, and was storing the territories as a collection of points, but as I was driving around the other day in the car, it dawned on me that something like a Flood Fill algorithm probably would have been a lot faster. Could even save the results as your "map" file. So - select a point, flood fill to find the limits of the territory and there you go. Assuming your territories are actually closed, that is.

HaB
Jan 5, 2001

What are the odds?
There was a C# game library someone had posted a link to several pages back, and now I can't find it.

I seem to remeber it being Open_L. I thought it was OpenAL, but that's just for audio. This was an all-in-one thing similar to XNA or something but not as complete.

Anyone?

HaB
Jan 5, 2001

What are the odds?

xgalaxy posted:

There is OpenTK.

THAT'S IT.

Thanks, man. I was racking my brain. :)

HaB
Jan 5, 2001

What are the odds?

Pfhreak posted:

Stop here. What else have you done? Published any other games? You are trying to paint the Sistine Chapel here...


Advanced math is more or less required for making games. Might be a good idea to brush up on linear algebra and trigonometry. Also, we don't sign our posts here.

Heh.

What my esteemed colleague here is trying to say, put more gently:

If you haven't done game programming before - it's usually better to start small. Make a breakout clone or a pong clone. MMORPGs are developed by MASSIVE teams of really GOOD (in most cases) programmers, or at the very least EXPERIENCED ones.

If you bite off WAY more than you can chew, it is likely to sour you on the entire process. So - baby steps. Make a SMALL, single player game. Learn how that works. Make a SMALL networked game. Learn how THAT works. Make a 3D game using someone else's engine - Learn that.

Each thing is a building block and another tool in your arsenal. If you look around game coding messageboards, and had a nickel for every person who essentially said "I've never made games before, but I'm working on an MMORPG!" and was subsequently never heard from again, you'd be all "no no, Mr. Rockefeller - lunch is on ME today."

I have been an application developer for years, and I can do that in my sleep. Game programming is a TOTALLY different animal. I too don't know much advanced math, but I had to learn some to do even the SIMPLEST games. But saying "I'm new to programming and I am working on an MMORPG" is akin to showing up and saying "I learned how to say 'hola' in Spanish. Brb - gonna go translate War & Peace!"

Don't get me wrong - I wish you all the luck in the world, but you should be realistic about the size of the task you're taking on.

Good luck.

Adbot
ADBOT LOVES YOU

HaB
Jan 5, 2001

What are the odds?
So I'm sure this question has been asked to death and I checked the first page thinking it might be in a pre-emptive FAQ, and I also browsed through the last few pages, but no luck.

I know the usual response is "make a game" and I have done that before.

But let's assume I want to start from literally zero - what's the best set of libraries to write a game with? Would prefer to use C++ since it's been years and I'd like to bone up. Developing on a Mac and possibly Windows, so cross compatibility would be nice. Mobile platforms not currently necessary. My initial outing is essentially a board game, so 2D oriented, I guess.

Is SDL still a thing?

I am comfortable in pretty much any C-style language, and have dabbled in Python/Ruby but I'd have to spend a lot of time looking up syntax with those two.

Haxe looks pretty neat - is it viable for writing an entire game in?

Thanks in advance.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply