How to build a game like Battleship?

0 favourites
From the Asset Store
Isometric Stategy Roleplay Game Building and Streets Pack.
  • Before all, thanks for the tips and come here on Sunday to help.

    Sure no problem. :)

    I've noticed that the logical issues are very easy for you. For me, programming, even with so many facilitators as they have in Construct2, is more difficult. I know it's a matter of logic and commands are details. I think that I should invest in logic. Would you recommend something for this (book / website / etc). It has to be for beginners.

    I have a background in computer science, so that surely plays a part. But actually I don't really like programming, that's why I like C2 you don't have to type pages after pages with a lot of code to get feedback, on what you are doing.

    But I don't really know a lot of resources when it comes to programming, that I can recommend, because of my background knowledge, and the concept/idea is pretty much the same in construct 2 as if you had to program it all yourself in some programming language.

    But my best advice is to simplify things as much as you can, and break up what you want to do. And most things you have to do/program no matter how complicated it might seem, is pretty much just IF, THEN, ELSE statements, its just a matter of how complicated they are.

    But you can see it like this:

    If

       Apple is fresh (Conditions / Test)

    Then

       Eat apple (Functionality / Do something)

    Else

       Throw out (Functionality / Do something)

    When I started construct 2, I did the first tutorial with the Zombie shooter I think it was called, and then I just tried to create whatever I thought could be fun, and failed big time....I have dropped so many projects that I cant even count them :D

    But I always learn something, but my starting point is probably a lot different from yours, as I have also studied 2d/3d graphics and audio, so I have a somewhat good idea about the different things and how each part works, even if I haven't tried them before, I almost always have some idea of what is going on, and can pick up from there, if I don't understand something, and that is ofc a huge benefit.

    But if I were you, I would split up your game, and not even try to make an interesting game. But just spend some time trying different things. Here are some ideas.

    For instant, drop the battleship part for now, and just try to make a game where the player have to solve/answer 10 equations maybe within a time limit, and then make a score that add 1 point each time its correct, or based on how much time is left.

    And then don't worry to much if the game is not all that funny or not, but simply use it as a way to learn how timers works, adding numbers, how to present things to a player, how to get interaction from a player, and test if its correct etc.

    Then when you are satisfy with that, make a game where the player have to control a square through a maze, and if they hit the wall the loose a life and have to start over again or something. And just focus on player controls and collision.

    And then you continue with for instant mouse control. Maybe some dropping boxes at different speed and sizes that the player have to click on. And maybe use something that you used in your former projects.

    The basic idea is you know that you are making something that might not be very exciting at first....but each time you do something like this, you will slowly start to see that its pretty much the same, and you start to spend a lot more time on "How and what you would like to do" and that will suddenly be the hardest part, because then you start to think, well maybe my game is pretty boring... and then you drop them because of that rather than because you don't know how to do it. Also at some point you will start to drop project because you loose track of what is going on. And then you can start looking at functions and after that you will use them as much as possible to not loose track...and just keep trying new things, even if they never end up with anything useful.

    And even though battleship seems simple because it is as a board game, its actually a lot harder to do, than to make a object walk around with path finding in C2 or something.

    Think that's the best advise I can give you.

  • I use this:

    family1 shipID = ship_1_mid.UID

    for each family1

        family1 is overlapping family1: family Destroy

                                        System Subtract 1 from Nr_of_placed

    but not work. Maybe the problem is the subevent that verify if overlap happens?

    I think the reason it doesn't work, is because as you use For EACH you actually only work with 1 object of the family at the time. Meaning that if you have 2 part that match the "family shipID = ship_1_mid.UID" condition, it will first run 1 of them through the overlapping test, and then the next one.

    So actually the "For each family1" is being done 2 times with 2 different objects.

    You have to make it, so if it detects an overlap with one of them, you can stop the loop and pick all parts of the ship that matches the ship_1_mid.UID and then destroy them all, and subtract only 1 from nr_of_ships.

    In this case you subtract 1 when you destroy a part of the ship.

  • Thanks for all the tips,

    I also have knowledge in computer graphics programs, such as max, cinema 4d, after effects, premiere pro, sony vegas pro, and other programs of its kind. But my intention was always to work with games.

    I've done several games using the tutorials and I created 06 games based on what I saw . This problem always occurs when I try to do something different than I have done . I can understand something, but some procedures are more difficult . This is the case of the "array " . Until today I do not quite understand how to use it .

    I'll create a portal of educational games for free access and I intend to create 15 games per month. This naval battle game, for example, when finalized, will be used to train multiplication tables, like a said before. I need a guy like you to help me. Do you have interest in give some advice on games that I have difficulty to build? I would like to pay you for it. If yes , how much you'll charge ?

    Regarding the script about the battleship , I did the following :

    Family1 shipID = ship_1_mid.UID

    for each Family1

    ????ship_1_mid is overlapping Family1 : Destroy ship_1_mid

    ????????????????????????????????????????System Subtract 1 from Nr_of_placed_ship

    ??????????????????ship_2_front shipID = ship_1_mid.UID : Destroy

    ??????????????????ship_3_end shipID = ship_1_mid.UID : Destroy

    ????ship_2_front is overlapping Family1 : Destroy ship_2_front

    ??????????????????????????????????????????System Subtract 1 from Nr_of_placed_ship

    ??????????????????ship_1_mid shipID = ship_2_front.UID : Destroy

    ??????????????????ship_3_end shipID = ship_2_front.UID : Destroy

    ????ship_3_end is overlapping Family1 : Destroy ship_2_front

    ??????????????????????????????????????????System Subtract 1 from Nr_of_placed_ship

    ??????????????????ship_1_mid shipID = ship_3_end.UID : Destroy

    ??????????????????ship_2_front shipID = ship_3_end.UID : Destroy

    No ships appears in the screen

  • I also have knowledge in computer graphics programs, such as max, cinema 4d, after effects, premiere pro, sony vegas pro, and other programs of its kind. But my intention was always to work with games.

    That's a huge benefit I think, as that's pretty much as complicated as programming in my opinion :D

    I've done several games using the tutorials and I created 06 games based on what I saw . This problem always occurs when I try to do something different than I have done . I can understand something, but some procedures are more difficult . This is the case of the "array " . Until today I do not quite understand how to use it .

    Yeah arrays can be a bit tricky, and I personally don't like them in C2 as well. So tend to not use them much, but do it some other ways instead.

    I'll create a portal of educational games for free access and I intend to create 15 games per month. This naval battle game, for example, when finalized, will be used to train multiplication tables, like a said before. I need a guy like you to help me. Do you have interest in give some advice on games that I have difficulty to build? I would like to pay you for it. If yes , how much you'll charge ?

    Sounds like a good idea. However making 15 games a month you are going to work a lot, even if they are simple :).

    But sure we can figure something out, ill send you a private message, so we can keep things separated.

    Family1 shipID = ship_1_mid.UID

    for each Family1

        ship_1_mid is overlapping Family1 : Destroy ship_1_mid

    There is going to be a conflict here.

    1. You start by selecting all ships which have the shipID equal ship_1_mid.UID

    So you have two objects (Assuming its a 3 part ship), "Front" and "End" part are the only ship parts that meets the condition. But what you actually want is to pick the "Mid" part by its UID. (The reason you want the UID, is because mid part doesn't actually use shipID, because its the part that controls the whole ship, the shipID is used by the other parts, so you know which "mid" they belong to.)

    2. Next you want to do something for each of these parts.

    3. ship_1_mid is overlapping Family1 : Destroy ship_1_mid

    You actually test if "ship_1_mid" is overlapping a ship. Which will select all "Ship_1_mid" that meets that condition. And then destroy them, since you haven't told it what "ship_1_mid" parts you are talking about it just pick which ever is overlapping and destroys them.

    But what you actually want to do is this:

    1. first pick a specific "mid part" check if that is overlapping another ship.

    a. If it does then destroy the ship. (Be aware that it doesn't destroy the "Front" and "End" yet.

    b. Else check other parts of the ship. (Front, End)

    2. Check if either "Front" or "End" with the shipID = Family1.UID overlap another Family1. But you have to make sure that you don't check against there own ship_1_mid. So you have to add another condition, that "Family1.shipID not equal Family1.UID".

    a. If it does, then Destroy ship_1_mid (Be aware that it doesn't destroy the "Front" and "End" yet.

    b. Else creation of ship was completed. Add +1 to ship_placed.

    To destroy the rest of the ship, you add an "on family1 destroyed" event instead that will handle the destruction of the parts. And in this event you pick all the parts of the ship that have the shipID = ship.UID

    For now that would work. However it will give you some problems later, as you start destroying parts during the game. But don't worry about that now.

  • Ok. Let's go:

    Pick ship_1_mid instance ship_1_mid.UID

         ship_1_mid is overlapping family1: ship_1_mid destroy

         Else

              ship_2_front shipID = family1.UID: ship_1_mid destroy

              ship_2_front is overlapping family1

              family1 shipID # family.UID

              Else

                   ship_3_end = shipID = family1.UID: ship_1_mid destroy

                   ship_3_end is overlapping family1

                   family1 shipID # family.UID

                   Else: Add 1 to ship_placed

    family1 on destroyed

         System Pick family1 where family1.ShipID = family1.UID: family1 destroy

                                   

    I know something is wrong, because overlapping occurred.

    That's great that you are interested in the proposal. I'll be waiting a PM.

  • Maybe it help db.tt/e05MlPaq

  • That's a really nice solution I think. Thanks

  • Thanks, I really liked this solution.

  • Updated with comments and placement detection: db.tt/e05MlPaq

    I think it's almost done, so, good luck!

  • Very nice, Thank you.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have a question about the distribution system created by Currently the created sprites stay all close together. How can I do to set the distance between them. Thank you.

  • UP

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)