Battleship project

  1. ‹ Older
  2. 4 months ago

    Jeff T

    May 26 Midlands of England, Europe

    I asked my classmates and he actually didn't teach us everything I need for this project. He never mentionned anything about graphics nor the 2D arrays.

    You know, one interpretation of
    'I have to make a battleship game'

    Could be 'write something that prints a grid on a piece of paper for use as a Battleship game using pencils and humans'
    Thats about your current coding level.

    Did he actually mention Xojo??
    Or are you supposed to be doing this with some game development tool for iPads that does hit detection and similar?

    'make a battleship game'' sounds a lot like this assignment, which is way beyond what you are ready for, unless there was some amazing tutoring going on during the 2 sessions you didnt attend.

    http://lsub.org/pae/homework/battleship.pdf

  3. Markus W

    May 26 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

    I think Jeff makes a very valid point. We are all working on assumptions, so you should post the actual assignment.

  4. Edited 4 months ago

    Simply put : For the end of the year, you have to make, on Xojo, a game or app of your choice based on what we learned this year and last year and things that Xojo offers.

    N.B.: We didn't see graphics during the year and I chose to make BattleShip.

    Jeff, you're right I don't have that good of a coding level but i'm still learning. That's what the project was for.

  5. Dave S

    May 28 San Diego, California USA

    Normally (at least when I was in school) the "final" was to prove that you had learned what had previously been taught and that you could apply it to a real world situation. Again not to be harsh, but either the instructor didn't teach, you didn't pay attention, or you decided to risk failing the final exam by attacking a project beyond the semesters content, and beyond your own ability.

    I personally would have stuck close to

    based on what we learned this year and last year

    , but hey thats just me.

  6. Jeff T

    May 29 Midlands of England, Europe

    We didn't see graphics during the year

    So what DID you cover, and by extension, what will they be testing you on?

  7. Dirk C

    May 29 Pre-Release Testers, Xojo Pro Belgium, Zedelgem

    @LouisRobitaille a game or app of your choice based on what we learned this year and last year and things that Xojo offers.

    @LouisRobitaille I chose to make BattleShip.

    Does it need AI, or do you just want something where two people can play against each other and that detects if they managed to hit anything?

  8. @Louis Robitaille
    You are welcome.
    The best way to solve this kind of problems is drawing your board / array structure in a vector drawing program.

    What we first have to ask ourselves is, what kind of data must we store inside the individual array cells. For your game that would be probably :

    BOARD POSITION this is the X / Y coordinate (not screen position)
    SCREEN POSITION this is the corresponding position of a particular cell onto the screen
    TYPE OF SHIP which occupies a cell.
    SHIP OWNER is the ship yours or from the enemy?
    HIT this contains if a boat is hit or not.

    In this above example, we can best make use of an 3-dimensional array. This is an array which has several vertical plains. If you want to visualise this kind of array, make sure you are drawing in an "isometric" grid. This will give you an idea about the form of the array.

    Lets give an example :

    X = 9
    Y = 9
    Z = 2

    Dim MyArray(X, Y, Z) As Integer // --> integer array

    This array contains a total of 300 elements;
    100 elements per plain
    3 plains in total

    So the "Z" axis moves in the third dimension, the depth dimension
    The "X" axis moves from left to right
    The "Y" axis moves from the back to the front

    A 3 dimensional array can only contain data of the same type. In the array above only integer data. If now for example one of those plains must contain "string" data and the other two "integer" data. As long has those plains have the same amount of cells in the "X" and "Y" direction, you can make a string array like "Dim MyStringArray(X, Y) As String", while the integer array remains 3 dimensional. Now you can easily convert the array-element-positions from those different types of arrays to correspond with each other.

    Another and more simpler way to understand is to make the 3 dimensional array a "string" type. In that way you can store the X and Y board coordinate in the following format :

    200#100

    where 200 is the X board (screen) coordinate and 100 the Y board coordinate. The disadvantage of this method is that you need to convert if you have nummeric data. However in your case because the board is very small, is fine.

    I do not know if it is allowed by your teacher, but a class array should make things much easier. A class-array-element can contain several properties of different types of data. Each board positions has its own element inside the class array. That element contains on its turn the properties for the X - Y - hit -ship type. This is much easier to imagine and... you do not need that "nasty" third dimension.

    I hope this helps you on your way to finish your project.

    Wish you all the best and very much success!

    Chris

  9. Edited 4 months ago

    @LouisRobitaille

    In case you need more information about AI (Artificial Intelligence) these are two tutorials for another game development environment but they are very educational.

    Artificial Intelligence Part 1

    Artificial Intelligence Part 2

    If you want to try them out, they have a (very) limited free version.

    Hope this helps.

    Chris

  10. Jeff T

    May 29 Midlands of England, Europe

    I have to make a battleship game in 2 weeks

    Let's hope something was created.

  11. @LouisRobitaille

    I find your project very interesting and like to see young people busy creating and developing their creative skills. This is a project once finished, you surely can be proud of.

    Don't give up when it becomes difficult or things does not go as expected. Just take a rest, walk, recreate but stop thinking on the problem. You will see, once your mind is cleared you will have the solution.

    Mostly I assist youngsters here (Botswana) when they have problems or fail to bring their creations to life. Your generation is surely very creative and skilled, wherever in the world. Thank you for your nice words.

    I wish you very much success with your project.

    Chris

  12. I'm sad I couldn't read those comments this past week and didn't think of it today. I handed in a 1/2 finished battleship where my biggest problem was to move the boats to place them in the position the player wanted them to be. The 2nd one, which was supposed to be in the project but didn't need to be was the AI Which I could never start. I'll try making a 3rd one from scratch, when I get the time to put in all this nice info you guys game me.

    @Dave S I did risk to fail on trying something we hadn't learned yet. Though if I did not, the best grade I could get was 70%. The project had a twist. Easy and safe = low grade. Risky and hard = high grade.

  13. Dave S

    May 31 San Diego, California USA

    Didn't mean that "taking a chance" might not have its rewards...... but "Risky and Hard" only equal a "high grade" if you succeed....

    and it sounds like "1/2 finished" may have landed you in the "risk" category....

    To quote "Dirty Harry" ..... "A man has got to know his limitations"

  14. Massimo V

    Jun 1 Pre-Release Testers, Xojo Pro Europe (Germany, Würzburg)

    Well, taking a risk to create something going beyond expectations still deserves an higher grade, IMHO.

  15. Markus W

    Jun 1 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...
    Edited 4 months ago

    @Massimo V Well, taking a risk to create something going beyond expectations still deserves an higher grade, IMHO.

    That's how the financial crises came about …

    There is more to learn than programming. Working to a deadline. Project management. Knowing what you can and cannot do and applying it to the problem at hand. etc

    A Prof of mine had a saying: "Work not published is work not done".

    Or as Yoda said: "Do. Or Do Not. There is no try."

  16. Massimo V

    Jun 1 Pre-Release Testers, Xojo Pro Europe (Germany, Würzburg)

    @Markus W That's how the financial crises came about …

    This is not the case, we are talking about school projects, and school is meant exactly to push people trying and sometimes doing mistakes.

  17. Markus W

    Jun 1 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

    Well, in my school days an unfinished project was an automatic fail. But standards have slipped since then, so it might be different today here as well …

  18. Ulrich B

    Jun 1 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    @Massimo V and school is meant exactly to push people trying and sometimes doing mistakes.

    … and to experience Hofstadter’s law ;)

    It always takes longer than you expect, even when you take into account Hofstadter's Law.

  19. Dave S

    Jun 1 San Diego, California USA

    @Ulrich B … and to experience Hofstadter’s law ;)

    OH! I thought you meant "Leonard" Hofstater :)

  20. Ulrich B

    Jun 1 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    @Dave S OH! I thought you meant "Leonard" Hofstater :)

    Is it some kind of self-disgrace when I tell you I had to google that name? ;)

  21. Dave S

    Jun 1 San Diego, California USA

    @Ulrich B Is it some kind of self-disgrace when I tell you I had to google that name? ;)

    Yes, yes it is :)

or Sign Up to reply!