Search Unity

Ahoy sir, A boat game? [WIP]

Discussion in 'Works In Progress - Archive' started by khellstr, Sep 22, 2013.

  1. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Ahoy Mates

    An adventure boat game, maybe. Cruising around doing missions and enjoy landscapes. At moment only cruising.

    LINK TO WEBPLAYER
    update: I have got my boat "driving engine" script almost ready and like to hear opinions how it feels? Testing too long alone make me bit blind.

    new Rope Demo Here

    $screenshot_003.jpg

    Controls:
    Arrows or WASD to move boat | Right mouse to move camera | scroll wheel to zoom.

    Towing:
    1. Install tow line by clicking tow reel in back of the boat and drag line to Iceberg.
    2. Remove line by clicking tow reel again.

    Current version notes:
    • Made big changes to boat physics...
    This game in IndieDB and Twitter


    Questions&Aswers



    $8HrtNoJ.png

    ToDO
    • Story board for intro, and tutorial mission planning ( doing)
    • Splash screen with simple instructions.
    • Fix NormalMaps, problems in UV seems. (possibly need get xNormals)
    • Fix and clean. Code and assets. [Doing opposite]
    • Better camera.
    • Waves ( needs lot of work)
    • Character models, boat models, structure models, models and more models
    • Settings, story and missions.
    • Everything else

    Possible soundtrack material by my bother and his friends. Slawb - kakolan kajahdus
     
    Last edited: Oct 2, 2013
  2. MaxRoetzler

    MaxRoetzler

    Joined:
    Jan 3, 2010
    Posts:
    136
    I didn't know what I was supposed to do...so I climbed the highest mountain to get a better view!

    $mountain.jpg

    Ship movement and buoyancy feels nice! It moves much like an rc boat, but its quite fun to drive around.
     
    Last edited: Sep 22, 2013
  3. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    That's nice one! Didn't know it's possible, but I know that propeller keeps pushing even if it's not in water so you can make pretty crazy airs. Too lazy to add any if statements.
     
  4. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Like to make this kind of fog:



    Any ideas how. Do I have to code shader that gets darker the deeper you go?
     
  5. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Could be a really fun game. Avoid the iceberg etc. Tugboat 101.
     
  6. Oana

    Oana

    Joined:
    Sep 28, 2012
    Posts:
    87
    Cute idea. Might turn into something quite fun.

    As for the fog question, shaders is probably the most efficient way of doing it. Particles would be another way, although it will reduce performance.

    A few additional tips:
    • check the normals of the land. Navigating through the narrow corridor lead to some land that you could see through. Looked like it needed inverted normals.
    • add more restrictive physics for turning your ship. It shouldn't be able to turn while standing still. Maybe make turning speed depend on movement speed?
     
  7. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    I didn't know boats can fly!

     
  8. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    I'm planning to improve my camare a lot, add some collider meshes to prevent it go to wrong places and like to have rotate to boats moving direction, but also keep possibility to free movement. I have few ideas, but needs lot of testing and tweaking.

    In my orginal plan rudder force was depended of speed, before I coded that I tested how (or if) it works with constant force. I like the current easy and simple controls. Actually some boats can turn pretty well while standing still whit help of bow thuster or two propellers ( with both applied, boat can move even straight to left or right). I might at some point simulate bow thurster, so that when you press left/right if speed is slow enough it will apply force to bow, in higher speeds use only rudder( which force will be depended of speed).

    Also there are these kind of systems that can make ship go whatever direction: (those propellers turn around full 360 degree) :
     

    Attached Files:

    Last edited by a moderator: Sep 22, 2013
  9. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    I don't understand what is wrong with this:
    Code (csharp):
    1. if ( propel.postion.y > 0 ){
    2.             propelForce = 0;
    3. }
     
    Last edited: Sep 22, 2013
  10. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    How did you manage to break the page layout with your second last post
     
  11. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,609
    I thought it was just me.
     
  12. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    I don't have a slightest idea. Maybe too big propellers.


    Here is picture I did years ago.This games environment will be something like that;
    $NUjsKOw.png

    Image I just googled:
    $1159568.jpg
     
  13. Gobla

    Gobla

    Joined:
    May 28, 2012
    Posts:
    354
    Use the globalfog shader script I think.
     
  14. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    I was thinking that I could use y value of mesh(?) and then apply vertex color or something. But I know nothing about shader coding? Looked for tutorials but didn't find anything fast.

    I also realized that I could paint/bake underwater ground darker as it goes deeper. What is under water, stays underwater, at least at this point.

    FInd an other great image, by NG:
     

    Attached Files:

  15. MaxRoetzler

    MaxRoetzler

    Joined:
    Jan 3, 2010
    Posts:
    136
    Last edited: Sep 23, 2013
  16. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Thanks for shader Zortech, going to test it tomorrow with iceberg I made:

    $k0xczrx.png

    Have to make lowPoly version and bake textures before shader testing.
     
  17. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    This is looking really good, a demo with waves would be cool.
     
  18. MaxRoetzler

    MaxRoetzler

    Joined:
    Jan 3, 2010
    Posts:
    136
    I had some time so I updated the shader a tiny bit. You need to set the wrap mode of the gradient texture to clamp, and the last pixel must be white, then it will only affect pixels below the water level (0). I also added a diffuse texture, just in case. But its still only an example, no lighting, doesn't support shadows and the texture tiling isn't included either. (I'm lazy as well)

    Preview:
    [video=youtube_share;XNHi3cKbL5M]http://youtu.be/XNHi3cKbL5M

    Anyways, my good deed for the day.
     

    Attached Files:

    Last edited: Sep 23, 2013
  19. theAfrican

    theAfrican

    Joined:
    Dec 15, 2012
    Posts:
    53
    Last edited: Sep 23, 2013
  20. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Thank you very many for those Shaders!

    Will test those later in evening. Have to go out with dogs.

    Uploaded new version:
    WebPlayer Demo | Arrows or WASD to move boat | Left mouse to move camera | scroll wheel to zoom.

    Current version notes:
    • Flying not possible anymore :( ( if code works)
    • "Performance test" scene, spammed Icebergs and balls around scene to test how it performs. With my lazy laptop it still works. Boat moves slower than earlier (downgraded motor). So it might feel that physics lags.
    • Sometimes I eperienced that boat didn't move forward, don't know if happens in latest version. I have some crazy values in rigid bodies etc. Have to fix those.
    • Shadows are causing ugly moire.
    • Everything is deOptimized, boat has 11 000 polygons. Think I could take half of those away, and boat would still look same.
     
  21. Divinux

    Divinux

    Joined:
    Jul 5, 2011
    Posts:
    205
    Love this thing. Runs on my even lazier laptop too (core2duo 2ghz, 4gig ddr3, 1gig nvidia 130m).

    But now with the blue icebergs it doesn't look as artsy anymore :C Liked the orange land.
     
  22. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    So I was thinking that rigidbody mass is in kilograms, and my boat mass is about 3000 kilograms, slightly more than 10.

    From docs:
    Arbitrary units, what? So is it density? Does unity calculate real mass based on "mass" value and objects size, (or mesh collider) size?

    Anyways I will change my values inside those recommended limits.
     
    Last edited: Sep 23, 2013
  23. xithix

    xithix

    Joined:
    Jun 26, 2013
    Posts:
    9
    I was thinking of making a boat-game inspired by Cobra Triangle for NES. I'm excited to see where this goes as there is not much in the way of sea-faring adventures.
     
  24. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
  25. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    New webplayer is good. Love the big gun in front!!!
    Lots of potential.
    "Whaler's versus GreenPeace"
    or Arctic Pole Control
     
  26. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    New version

    Made shader for Icebergs. Gdam ten lines of code took over six hours to write.

    Pixelsteam: I think I have seen that wave asset years a go. Looks intresting but I think I try to do own wave engine first. In theory "Global" wave should be easy, just deform mesh based on sine function. (in theory, don't know how to modify vertex in mesh), but if I want to have waves caused by but and objects it will get complicated. There could fly some imaginary sine wave emitted by boat and objects and from those it should be possible to calculate water height in each point in space and use that information for boat physics and water render mesh deformation. in theory it should be possible ;).

    Is it possible to project bump/normal map to surface? It would be easy way to fake waves visually. Just set wave projector to follow boat and make alpha depended on boat speed.
     
  27. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Here is code for shader. I got it to work late at night yesterday. Now it sets color multiple times when going down in gradient (I think). Will fix that later. Now I'm trying to get SublimeText to work with Unity...

    Code (csharp):
    1.  
    2. Shader "JaaVuori Gradiend Bumped" {
    3. // JaaVuori is Iceberg in finnish
    4. //
    5. // I use finnish in variable, class etc names, maybe bad habit but it helps me to find my "own" code and stuff faster.
    6. //
    7.  
    8. Properties {
    9.     _BumpMap ("Bumpmap", 2D) = "bump" {}
    10.     _MainTex ("Texture", 2D) = "white" {}
    11.  
    12.  
    13.  
    14.     // These variables are y levels and colors
    15.     // ----> Over water surfface, depth 1, depth 2, bottom.
    16.                
    17.     _JaaMerenPaallaVari ("JaaMerenPaallaVari", Color) = (0.8,0.9,0.9,1)  
    18.     _RantaViiva ("RantaViiva", Float) = 0
    19.     _RantaViivaVari ("RantaViivaVari", Color) = (0.75,0.53,0,1)
    20.     _ValiSyvyys1  ("  ValiSyvyys1 ", Float) = -1
    21.     _ValiSyvyys1Vari ("ValiSyvyys1", Color) = (0.75,0.53,0,1)
    22.     _ValiSyvyys2  ("  ValiSyvyys2 ", Float) = -1
    23.     _ValiSyvyys2Vari ("ValiSyvyys2", Color) = (0.75,0.53,0,1)
    24.     _Pohja ("Pohja", Float) = -10
    25. }
    26. SubShader {
    27.     Tags { "RenderType" = "Opaque" }
    28.     CGPROGRAM
    29.     #pragma surface surf Lambert
    30.     struct Input {
    31.         float3 customColor;
    32.         float3 worldPos;
    33.         float2 uv_MainTex;
    34.         float2 uv_BumpMap;
    35.     };
    36.     sampler2D _BumpMap;
    37.     sampler2D _MainTex;
    38.  
    39.     float _RantaViiva;
    40.     float4 _JaaMerenPaallaVari;
    41.     float _ValiSyvyys1;
    42.     float4 _ValiSyvyys1Vari;
    43.     float _ValiSyvyys2;
    44.     float4 _ValiSyvyys2Vari;
    45.     float4 _RantaViivaVari;
    46.     float _Pohja;
    47.     float4 _PohjaVari;
    48.     float _Level1;
    49.     float4 _Level1Color;
    50.     float _WaterLevel;
    51.     float4 _WaterColor;
    52.    
    53.     void surf (Input IN, inout SurfaceOutput o) {
    54.  
    55.         // I think this does extra work:
    56.         o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
    57.         if (IN.worldPos.y >= _RantaViiva)
    58.             o.Albedo = _JaaMerenPaallaVari;
    59.         if (IN.worldPos.y <= _RantaViiva)
    60.             o.Albedo = lerp(_RantaViivaVari, _JaaMerenPaallaVari, (IN.worldPos.y - _ValiSyvyys1)/(_RantaViiva - _ValiSyvyys1));
    61.         if (IN.worldPos.y <= _ValiSyvyys1)
    62.             o.Albedo = lerp(_ValiSyvyys1Vari, _RantaViivaVari, (IN.worldPos.y - _ValiSyvyys2)/(_ValiSyvyys1 - _ValiSyvyys2));
    63.         if (IN.worldPos.y <= _ValiSyvyys2)
    64.             o.Albedo = lerp(_ValiSyvyys2Vari, _ValiSyvyys1Vari, (IN.worldPos.y - _Pohja)/(_ValiSyvyys2 - _Pohja));
    65.  
    66.         o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));          
    67.     }
    68.     ENDCG
    69. }
    70. Fallback "Diffuse"
    71. }
    72.  
     
  28. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    How can I link to specific post in this thread? Usually in forums there is "link to this post button". Can't find it here. Like to make Q&A to main (first) post.
     
  29. Divinux

    Divinux

    Joined:
    Jul 5, 2011
    Posts:
    205
    Top right, where it says "Posted: 02:09 AM 5 Minutes Ago". Links to the specific post.
     
  30. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Put an springJoint between boat and iceberg so you can(or have to) tow iceberg around.

    Towing Demo

    Next I will make ui so you can click and drag rope from towing reel to target (iceberg).
     
  31. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Got my towing work little more. Now you can change iceberg to tow.

    Controls:
    1. Install tow line by clicking tow reel in back of the boat and drag line to Iceberg.
    2. Remove line by clicking tow reel again.

    // Line does not show if mouse is not over an iceberg.

    LINK TO WEBPLAYER | Camera panning is now in right mouse.

    toDo
    • Change fixed joint to between iceberg and "Hook in iceberg" to something that really is fixed.
    • remove "flying" not used rigidbodies ( in code)
    • Make "Towing Symbol" that hovers over towing reel when mouse over
    • add rope remove to hook also
    • Make line to appear even if out of towable object
    • Set some limits to rope distance
    • Make tow line to "rope", 3 or more joints attached, now it's only one spring joint.

    Now I have "hook" gameObject inside iceberg, I make joint (rope) between boat and hooks rigidbody. I think I should be able to make that joint without additional rigidBody/gameObject. Have to look at configurable joint.

    My icebergs has stopped colliding between each other at some point. I have no idea why.

    I probably do some art asset work for a while now, coding is too exhausting, always have to close billion tabs after getting something to work:

    $g7jnj1b.png
     
    Last edited: Sep 25, 2013
  32. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Be careful, I was able to overturn boat while towing.
     
  33. Divinux

    Divinux

    Joined:
    Jul 5, 2011
    Posts:
    205
    Be careful he says. People are going to try nothing else for hours.

    And I don't see an issue with the browser tabs. Google icon, unity reference icon, google icon, unity answers icon, more google and unity icons. Doesn't everyone's browser look like that while coding? :I
     
  34. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Not a big issues, it just takes awhile to Chrome open if I forget to close those tabs. Like to have option to have 3 or more default tab sets to open in different windows. Something Like this:
    • Social [ forums, email]
    • Code references [ all those tabs that are open when trying to get code work]
    • Casual [reddit]
    • Art Reference [google image search etc]

    Then when you open Chrome you could choose which windows to open. Probably there is plugin for that, but haven't find yet.
     
  35. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Not a big issues, it just takes awhile to Chrome open if I forget to close those tabs. Like to have option to have 3 or more default tab sets to open in different windows. Something Like this:
    • Social [ forums, email]
    • Code references [ all those tabs that are open when trying to get code work]
    • Casual [reddit]
    • Art Reference [google image search etc]

    Then when you open Chrome you could choose which windows to open. Probably there is plugin for that, but haven't find yet.
     
  36. Divinux

    Divinux

    Joined:
    Jul 5, 2011
    Posts:
    205
    Opera offers that by default, as many other things. I love to preach about that old outdated browser.

    But the function is called "Sessions" and google returns several extensions (three different links) that seem to do what you want.

    Edit: Oh man you want it in different windows... No idea then.
     
    Last edited: Sep 25, 2013
  37. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    wrote down some concepts and ideas that I have been thinking of:

    Edge

    In game you are one of few people who lives in Edge, edge of ice that runs somewhere in northern Europe ( about 60 N lattidude) maybe thousand year in future. Ice is probably retreating, so there is warm in summer and small agriculture is possible. Art style I try to achieve will be some semi-cartoonish, like in Dishonored or Borderlands. I'd like to keep world somehow scientifically correct, but exaggerated. Now I have problem with water level, I liked to be high, but it conflicts with lot of ice.

    Much of game play would be resource searching and collection. You could go some "ice fields" and turn over icebergs to find old scrap. Scarp would be used to upgrade ship or build base. There would be story missions, with more action probably, but I like game to be way that you could also just go "cruising and grinding".

    I'd like to achieve beautiful environment and good story (need help for story), where you could just enjoy cruising around, looking landscapes and listening good music. In some games (ie. Bioshock, Dishonored) I was sometimes just wondering around and enjoying beautiful things, and was a bit annoyed when I was interfered, and had to start shooting.

    There will be some mystery "enemy", ships that some people see but want talk about. Or if you talk about those, you will not be taken very seriously anymore.
    $OversizeJPGLarge_latestReleased_bae_cimg_uxv_combatatnt_conc_OversizeJPGLarge.jpg
     
    Last edited: Sep 27, 2013
  38. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Added sunken water tower to scene. Just used my Highpoly subD cage, so its about 15 000 polygons. I think I should be able to get it down to 1500, so I can use my plolygons somewhere else.

    screen:
    $25EszZ1.png
     
  39. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Have been working on boat physics, it feels more like an boat now:

    LINK TO WEBPLAYER

    Not sure about turning speed, or speed in general. Sometimes it feels a bit slow. Any opinions?

    I have been thinking that in future, after I have figured out game around this, I will implement some upgrade system. Then you could upgrade motor, rudder, bow thruster etc. to make boat go and turn faster. But if boat is too slow in start, people leave game, if its "too good" there is no room for upgrades.

    Maybe I could have some semi good boat first and when you by another, example bigger ship, it would be slow to drive before getting better motors and parts.
     
  40. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Looking very good. Have you thought about a boat wake?

    I would be very cautious about boat speed...to me it seems to accelerate to quickly....

    Thought about a Northern Lights Skybox? I know there are some assets that do this...

    Having been in the Arctic...the light can be amazing.
     
  41. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Yes I have been and It is crucial part that has to be implemented at some point. But it will take time. One solution could be to project bumpMap/normalMap to ocean surface that is generated based on boat movement. Other could be that there would be mathematical space, where sine waves fly around, and ocean surface would be deformed based on that. Both solutions are over my current experience level, so it will take time as I said.

    Haven't thought, but great idea that I will definitely use If I ever get far enough to make an night scene. I live in Helsinki and have seen Northern Lights once in here, few times in Lapland. Picture in your page, with Northern Lights, looks like it is from Finland ( or Sweden, which is lame).
     
  42. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    It is from around Yellowknife, Northwest Territories, Canada in the fall.
     
  43. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Whats lame about Sweden? : D
     
  44. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Nothing, really, if you are from elsewhere than in Finland.
    // sorry for my prepositions, we don't use those here, had to trust google

    // edit: if you are from somewhere else than Finland. (?)
    // what I'm trying to say: Muualta kuin Suomesta.
     
    Last edited: Sep 30, 2013
  45. khellstr

    khellstr

    Joined:
    Feb 16, 2012
    Posts:
    72
    Made better towing rope, now I have to make detachable/ attachable. Don't know if I should create new rope every time, or make rope GameObject and change its parameters.

    WebPlayer Demo Here
     
    Last edited: Oct 2, 2013
  46. Alex76

    Alex76

    Joined:
    Sep 9, 2013
    Posts:
    10
    Excellent graphics khellstr, water is crystal clear and it all looks very realistic. Map is evidently not finished but it was nice to drive a boat around. Maybe you can add target practicing and shooting from those guns ... Or, you can create boat parking game. There are practically no boat games made in Unity - I could only find this one - http://www.boatarcade.com/game/fantasy-classic-boat-parking.html fantasy boat parking, game is very simple and yet you might get an idea of what to do next...
     
  47. Javier-Cabrera

    Javier-Cabrera

    Joined:
    Sep 30, 2013
    Posts:
    15
    Amazing! I love it! Though I went through one of the icebergs (the biggest) like if it was butter. Maybe a collision bug?

    QUESTION! How you made the rope? Can you share the script or what I should be looking for?
     
  48. ThreeDminis

    ThreeDminis

    Joined:
    Sep 7, 2019
    Posts:
    2
    Hi Khellstr, Did you ever get this finished? I have a different idea which could build on the same 'mechanics'...