Click here to Skip to main content
15,123,118 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

So I want to make an C# online battleships game, where people can login (using an azure database) and then connect to a 1v1 game of battleships and whoever wins gets a prize (account money or something). However, I'm extremely stuck on where to even start and what to use.

What I have tried:

Originally I wanted to use visual studio's windows forms and then for each battleships game made/joined a database will be made which updates where each players ships are so one person can fire a missile and then a query will say if its a hit an enemy ship, then the other person will go until there are no more ships left. However its quite a daunting task. Would there be any better way to do this?
Updated 8-Mar-21 4:00am
PIEBALDconsult 8-Mar-21 8:35am
There is no "best way".
Having a database is probably fine.
Then develop a Web Service.
Then develop one or more client apps (WinForms, WebForms, Android, etc.) to call the Web Service.
Think in layers.

1 solution

Why on earth do you need a database?
Think about it: DB's are about storing data for the long term - not for a ten minute game length!

What you need to do is communicate between two computers which hold their own copies of the "game map" and send the "bomb locations" to the other, then respond with "hit" or "miss" information. A database is a poor way to do that as your players have to be pretty much continually polling the DB to see if the other player has fired.
And ... a database makes it a lot easier to cheat ... :laugh:
Member 14929764 8-Mar-21 9:08am
Are there any resources, videos, guides etc that would teach me how to do that sort of thing so I can learn as I try to make my game?
OriginalGriff 8-Mar-21 9:19am
Try starting with a "chat app" and think about how you'd have to change that. If you think about it, it's just a different type of data ... and there are loads of chat app tutorials out there!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900