Recent

Author Topic: A game/simulation idea: Infection  (Read 5849 times)

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
A game/simulation idea: Infection
« on: November 18, 2011, 06:57:23 pm »
Okay first of all I wasn't sure what one to stick it in, so I put it in graphics, 'cause I guess that's what it's about most of all.

I've had an idea that I think would be really fun to implement, but I can't do it myself for a lack of knowledge about the graphics and other related stuff, so I was wondering if someone would like to work with me on this or something.
So yeah basically, it is a game, or a simulation you could call it that uses A.I (something I've wanted to code for a while).
Basically, it is a simulation that is made of dots, or birds-eye view of people, and a map that contains lines that represent walls and other objects. There are two main types of dots, zombie (infected) and survivor (non-infected). Just by knowing this you can probably guess what the simulation is about; the survivors trying to survive being infected by the zombies, but the idea is that the survivors will employ strategies to increase survival through an A.I, they are supposed to act like what humans would act like if they were put into that situation. It's supposed to be just a fun programming practice but perhaps if it works out good we can actually turn it into an app for a smartphone or something.

Now, the core action of both dots are as follows:
- Infected chase the nearest non-infected dots.
- Non-infected dots go as far away from the nearest infected dots as they can.

The game starts with one zombie and 25 survivors (for now).

I will now list my ideas on how the dots are going to be programmed to do more than just run away/chase:

- When a zombie manages to catch a survivor, it will start biting it and making the survivor lose hit points, another survivor, if their courage is high enough (explained later), then can stop the process of the zombie biting the survivor, doing this will stun the zombie for a moment to give both survivors enough time to run away, also some times the survivor will be able to wrench themselves from the zombie and stop it biting it.

- If a zombie does manage to reduce the survivors' hit points to zero, it will move away and the surviving dot will turn dark gray. This means that the dot is downed, but not yet dead. It will continue to lose hit points until they reach -25, then it will die and become a zombie. Downed dots can be revived by a medic dot (explained later) with a reviver, and a defender can also give the downed dot an adrenalin boost that will increase the hit points to zero again, letting the dot live a bit longer so the medic can get to it. Downed dots can crawl slowly, and will crawl to the nearest medic.

- When the single zombie has managed to infect four dots, the armoury will open, which is a room that has two cabinets, one that has weapons and adrenalin needles, and one that has revivers and small handguns.

- There are two types of survivors, medics and defenders. Each type of them are randomly picked but there will always be less medics than defenders, if enough defenders die then medics will convert to defenders, dropping their revivers and grabbing a defender's gun. Medics will carry revivers, little machines that resemble defibrillators that can revive downed team-mates and small handguns, and defenders will carry large assault rifles and small adrenalin needles that will give downed team-mates longer living time.

- Zombies take damage when they are hit by bullets. They have a higher hit point range than survivors, but when it reaches zero the zombies die.

- In the simulation, there are many tasks that can be achieved, but there needs to be priorities, just like a human would. The basic list of priorities goes as follows:

-: Survive. (run away from infected) or if downed, crawl to nearest medic.
-: Revive team-mates (for medics) or shoot zombies (if defenders)
-: If lacking a weapon or revive pack, find and grab one.
-: Open doors to get through to the other side.
-: Shut doors to block zombies out. (If there are no survivors on the other side of the door, close the door no matter what. If there are survivors on the other side however, a choice needs to be made, based on zombie proximity and survivor courage level. (explained later).)

But priorities can change. No-one would survive if they didn't revive their team-mates, or shot zombies.
This is where courage levels come in. Each survivor has a level of courage from 0 to 10 that is picked randomly. Courage affects how the survivors change their priorities. A survivor with a courage level of 0 would always run away from zombies, no matter what is happening. They will never grab a medic pack, a gun or revive team-mates, they would just always strive to be the furthest away from the zombies. A survivor with a courage level of 10, however places survive low on the list. It won't try to kill itself though, as explained in a moment.

As something that needs to be done is brought to attention to the survivors, each one will decide what to do, based on several factors. Say, for example a team-mate needed to be revived. The closest survivor will be assigned to work out what to do using the A.I. The closer a zombie is to the downed team-mate and the dot in question, the less chance there is of the dot going to the team-mate and reviving it, but courage levels can influence this. For example, let's say there is a downed survivor five meters (real life terms) from the medic dot that needs to made a decision, and there is a zombie ten meters from the medic. If the medic's courage level was at two, it would probably choose running away from the zombie over reviving it's team-mate, but if the courage level was at eight the medic would go out of its' way to get to the dot and try to revive the downed dot, but if the zombie gets within a meter to the medic it will abort reviving and run away.

So a decision system like that should be implemented.

Okay, so that's the bare bones of my idea, the little details can be thought of later into development.

I would like to say that I am posting this, I suppose, just to get it out of my head. I won't actually write this unless someone with enough knowledge and optimism decides to work with me, because I'm not good at all with the graphics aspect, and help with everything else would be nice.

So yeah, feel free to offer to co-develop this with me, or even steal the idea and implement it yourself :)

PS. If you would like to work with me, please note that I am only fifteen years of age and tolerance will be required :P
« Last Edit: November 18, 2011, 07:07:36 pm by Jishaxe »
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

circular

  • Hero Member
  • *****
  • Posts: 3022
    • Personal webpage
Re: A game/simulation idea: Infection
« Reply #1 on: November 18, 2011, 10:52:59 pm »
This is an interesting project. I don't know if I have enough time to codevelop, but here are some thoughts about it :

You can draw the people with a vector approach, which means you don't need to create images for this. For example you can draw an ellipse for both shoulders and a circle for the head. You can use different hair colors for the head : brown, yellow, black. The shoulders can be colored according to the type of the guy : white for medic, dark green for zombies etc. Then you apply a rotation depending on the direction to which the guy is going.

The map can be either a grid, each block being a wall or an object or a door or an empty space, or you can use a vectorial design, which means that rooms are defined by polygons. This is of course simpler to use a grid.

By the way, the movement of guys may be restricted to grid positions, it is simpler, otherwise you need to compute intersection of circles with polygons (one object or guy being considered as a circle).

About IA, I suppose you need to define states, each state corresponding to an action of the guy. Then for each state a list of possible reactions : continuing task, doing something else, etc.
Conscience is the debugger of the mind

Jishaxe

  • Full Member
  • ***
  • Posts: 103
  • Hobbist Programmer
Re: A game/simulation idea: Infection
« Reply #2 on: November 19, 2011, 12:43:23 pm »
This is an interesting project. I don't know if I have enough time to codevelop, but here are some thoughts about it :

You can draw the people with a vector approach, which means you don't need to create images for this. For example you can draw an ellipse for both shoulders and a circle for the head. You can use different hair colors for the head : brown, yellow, black. The shoulders can be colored according to the type of the guy : white for medic, dark green for zombies etc. Then you apply a rotation depending on the direction to which the guy is going.

The map can be either a grid, each block being a wall or an object or a door or an empty space, or you can use a vectorial design, which means that rooms are defined by polygons. This is of course simpler to use a grid.

By the way, the movement of guys may be restricted to grid positions, it is simpler, otherwise you need to compute intersection of circles with polygons (one object or guy being considered as a circle).

About IA, I suppose you need to define states, each state corresponding to an action of the guy. Then for each state a list of possible reactions : continuing task, doing something else, etc.
Thanks for the reply!
Hm, this way looks a lot simpler to use, maybe I can write it on my own, but there are still some problems...
This grid method you suggested is much simpler, you are right but my original idea was to have smooth animations, and a way to visibly see a defender's gun or whatever.. but I suppose I could use a very condensed grid to make things smoother, and I can make characters just blocks in the cells instead of circles..
And the mathsy problems to this stump me.. how will the AI navigate themselves around walls instead of just walking through them? What about bullet physics? Collisions? I have an idea about collisions, just every move a dot does, check whether there is another block in any adjacent grid cell... and for bullet physics just have small squares that continue the direction they were shot from..
For navigation around walls, I'll have to dig around and see if I can find any tutorials on it (unless you have an idea how to)
 
Linux Mint 12
Windows 7 Home Premium
______________________
Definition of programmer: An organism that converts caffeine into software.

circular

  • Hero Member
  • *****
  • Posts: 3022
    • Personal webpage
Re: A game/simulation idea: Infection
« Reply #3 on: November 19, 2011, 03:04:41 pm »
This grid method you suggested is much simpler, you are right but my original idea was to have smooth animations, and a way to visibly see a defender's gun or whatever.. but I suppose I could use a very condensed grid to make things smoother, and I can make characters just blocks in the cells instead of circles..
Having a grid does not prevent you to have smooth animations. It only restrict the level design. You can use pixel coordinates and circle tests with a grid. About seeing the defender's gun, this has to do with the way you draw the guy, which is completely independent of grid & collision.

Quote
how will the AI navigate themselves around walls instead of just walking through them? For navigation around walls, I'll have to dig around and see if I can find any tutorials on it (unless you have an idea how to)
I suppose you need a path finding algorithm.
http://en.wikipedia.org/wiki/A%2A_search_algorithm

Quote
What about bullet physics? for bullet physics just have small squares that continue the direction they were shot from..
That's right. You just have (x,y) start coordinates and (dx,dy) corresponding to the elementary movement, and you just add and you get (x+dx,y+dy) until there is a collision.

Quote
Collisions? I have an idea about collisions, just every move a dot does, check whether there is another block in any adjacent grid cell...
You can just check if there is something that blocks in the destination cell. But if the grid is smaller than objects, you need to check all cells that are inside the shape, for example, if the shape is like a plus (+) of 5 cells (one in the center and four around it), you need to check all 5 cells to see if there is something.
Conscience is the debugger of the mind

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: A game/simulation idea: Infection
« Reply #4 on: November 19, 2011, 05:02:23 pm »
*Notices good chance to advertize own (work in progress) graphic engine*
If interested, you can try my little nxPascal for OpenGL graphics. It has its own thread in Pascalgamedevelopment site which is more suitable for game programming than this one:
http://www.pascalgamedevelopment.com/showthread.php?8785-nxPascal
Well, my engine's not the most popular one on the site that's sure, but i built it crossplatform and almost as lightweight as engine can be. Many demos included.

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: A game/simulation idea: Infection
« Reply #5 on: November 20, 2011, 01:22:32 pm »
About the bullets, I don't think you really need to worry about physics there, perhaps statistics based approach might be better. You can take that, for example, a bad shot has 50% chance to hit a slow moving target and 30% to hit a fast moving target, while a good shot has 95% to hit a slow and 80% to hit a fast target. Take a random number and compare it to the chance and so determine if it's a hit or a miss - just like dice rolling. Then you can draw the bullet's trajectory, either towards the target if it's a hit or to a side of it if it's a miss. This system works fine in many computer games and it started with the tabletop games and real dice; however, since this way you can actually create a statistical (not a physical) model of the real world, so there should be no problems with credibility.

The physics should matter only if you need to determine the bullet trajectory in 3D space, calculate complex ricochets etc. I don't think this game would require that or make much use of it. Moreover, even then you must create some logical/statistical model to determine hit or miss, since physics model cannot determine how good a shot is your character and how good the target is at dodging...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics