Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411633 Posts in 69393 Topics- by 58448 Members - Latest Member: wcored

May 13, 2024, 05:33:06 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsSmall town simulation (learning to code)
Pages: [1]
Print
Author Topic: Small town simulation (learning to code)  (Read 441 times)
Arseny1987
Level 0
*


View Profile
« on: January 19, 2017, 04:21:38 AM »

Hi. I'm Arseniy, nice to meet you =)

Long intro
I'm attempting to learn to code, since it's really useful in this industry in general and me being a freelance game designer... So, I'll try to make something like this:
  • A 2d top-down "GTA2-like" game.
  • A small town with a police department, a hospital, a morgue (or cemetery), a couple of motels, a gun store, a casino and houses for every NPC.
  • Oh, and an underground weapons dealer and a brothel. Yay!
  • Town is inhabited by NPCs - everyone has a house, a job (in one of the establishments above) and basic behavior (like oh, it's late, I better go home).
  • Nothing comes out of thin air except for tourists (for example money physically travels from hand to hand, or if someone dies, he stays dead).
  • Tourists visit the town (cuz casino) - they stay at motels, gamble and if lucky get out of the town alive.
  • The aim is to make this really small town as deep as possible, instead of making it big (for example, it'd be cool if someone gets into a hospital and his family would visit him. Stuff like that).
  • I most definitely will add new "jobs" but the basic outline of the city should be like described. And the priority should be at adding depth to the existing ones.

There is stuff I'm not even going try to execute:
  • Proper pathfinding.
  • Improper pathfinding.
  • Cars.
  • Graphics.
Maybe in another life =)
For now, every structure is a colored rectangle and NPC is a circle.

I'd like to emphasize - I have no coding background, I'm not familiar with best practices or patterns or anything. So this will be my "baby talk". If I achieve desired effect - I'm happy, no matter how ugly the solution will be.
Also, it may take me A LONG LONG LOOONG time to do something trivial - I'm a noob.
And I have a day job, so I do not have much free time.

What I've done as of now
Player
  • Can move
  • Can shoot (unlimited ammo as of now)
  • Has "energy" level (probably temporary)
  • Has money.
  • Is immortal.

Hotels (will later be used to save the game)
  • Are usable by player
  • Replenish energy
  • Advance time by 8 hours
  • Cost money to use. Hotels store money (no vanishing $$$). Can't steal it just yet =(
The idea is that it might be hard to track down player on the run (if he's not shooting in the middle of the town). But if players need to go to their "safe place" police strategy might shift from "locating the player" to "locating player's hideout". So, from "place of invincibility" it will change to "place of vulnerability".

Police department
  • Spawns cops (cuz there's no "getting a job" functionality).
  • Keeps track of how many of them died (currently via magic, cuz there is no proper "transferring information" functionality)
  • Spawns 2 new cops for every killed cop (also temporary - cop killing will have set of consequences)

A timer.
  • Keeps track of day and time.

And it barely took me 2 weeks!


What's next
Basic cop AI
  • Patrol the area during the day, come to PD at night
  • See player shooting a gun = try to shoot him (probably gun range will be less than cop's FOV)
  • Remember player. If seen player committing crime - remember him. If see unarmed player later - try to shoot him (for now). Other cops do not have the knowledge of it happening automatically.
  • If remembered player as a criminal and went back to PD, "describes" player to fellow officers in the PD. They will have a chance to recognize player as a criminal (or not)
  • Has "field of view" collider - can't see stuff outside of it. Probably another collider of "awareness" (I do not want cop to  stop dead if player moves behind cop's back)
  • Tries to pursue player. If loses player - tries to "look around" for a while and goes back to patrolling.
  • Totally inactive at night (do not see player) but wake up if being shot at
  • Some placeholder behavior, when one a cop witnesses another cop being murdered by player
  • Some placeholder behavior, when a cop dies without any witnesses

That could take a while =)
« Last Edit: January 19, 2017, 05:31:39 AM by Arseny1987 » Logged
thomf00
Level 0
***



View Profile WWW
« Reply #1 on: January 19, 2017, 08:10:50 AM »

A recommendation I have for beginning programmers is to make things easy to read if you can. As the project grows and time progresses you may find yourself coming back to parts of your code base that you have forgotten, staying organized makes you go faster in the future. Good luck have fun!  Beer!
Logged

Twitter @thomasuster
Arseny1987
Level 0
*


View Profile
« Reply #2 on: January 19, 2017, 08:31:43 AM »

A recommendation I have for beginning programmers is to make things easy to read if you can. As the project grows and time progresses you may find yourself coming back to parts of your code base that you have forgotten, staying organized makes you go faster in the future. Good luck have fun!  Beer!
I'll try. But I'm already like this:  Shocked  ))
Thanks.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic