In several games and movies there are big metal crosses on the beaches and I have no idea what's their purpose. I would really like to know more about battles at shores.
These are obstacles of various sorts that were installed to make the task of any invading force more difficult. Depending on the location and the date, they would have taken different forms. On the Normandy landing beaches, for instance (the ones I’m most familiar with), they would have included but not been limited to:
The famous Czech hedgehog, which looks like a giant jack or metal cross. It’s likely what you’re asking about. These were intended to impede the advance of armoured vehicles and other vehicles more generally. These could be made of steel or reinforced concrete, depending on available resources and the environment. Reinforced concrete doesn’t do well in the long term when exposed to seawater, so examples in the tidal zone, between high and low water, were better made of steel. Concrete could still be used in these situations, though. Examples on dry land could be made of steel or of reinforced concrete.
Tetrahedrons, which had similar functions to the Czech hedgehog -- they were four-sided pyramids. Again, the idea was to make it more difficult for vehicles to move onto and off the beach, and they could also make things more difficult for landing craft. In Normandy, they were deployed in steel and in reinforced concrete versions.
Wooden posts with mines or other explosive charges on top. These were intended to damage or destroy landing craft, and also to generally hinder their operations. Since the mine involved was often a Teller mine, which could disable tanks or destroy more lightly-protected vehicles, these were a real threat to landing craft, especially smaller versions like the Landing Craft Assault. Mines and other explosive charges were often attached to the other barriers, too. One issue for the Germans was the effect of salt water on their metal components, as well as on the wire and other fasteners used to attach them to obstacles.
You can see close-up photos and some more details of these various kinds of barriers on the Juno Beach Centre’s website, here.
Again in the case of Normandy, the Allies were aware of these defenses, and carried out considerable preliminary reconnaissance to evaluate them. This included low-level photo reconnaissance missions to identify and assess defences, such as this example. This particular photograph shows obstacles being installed, and some of the workers are running for cover as the plane flies over. The obstacles visible include stakes, hedgehogs, and a barrier called a ramp or “Belgian ramp”, which was designed to block the advance of vehicles. Photo reconnaissance like this gave enough information to help understand what the obstacles were, and to develop training in how to deal with them.
The presence of these obstacles did affect Allied planning, and contributed to decisions to land at low(er) tide rather than at high tide. A low tide landing meant more beach for invading forces to cross while under enemy fire, but also left more of the obstacles exposed. This made it easier to avoid them, and also to deal with them, since doing things like demolishing obstacles and removing the mines and other explosive charges could really only be done at low tide.
(As an aside, there were other reasons for a low-tide landing, including making sure that landing craft would be less likely to be stranded by a falling tide. If they landed at high tide, the water level would soon fall, leaving craft stranded on the beach for a prolonged period of time. Landing at a lower tide as the tide was rising made it easier for landing craft to leave once they had dropped off personnel and/or equipment.)
In Normandy the obstacles often stretched quite some way into the ocean from the high water line. They would usually have been submerged at high tide, and partly or totally exposed at low tide. A typical arrangement from seaward towards shore would start with the wooden posts with mines, followed by ramps of rails or logs rising up towards the beach from the sea, the tetrahedra mentioned above, and then the hedgehogs. There could also be other sorts of obstacles like the “Belgian ramp” mixed in.
Under the right circumstances, the obstacles could prove effective. To use another D-Day example, there were some delays to the landings on Juno Beach. This made it more difficult to deal with the obstacles because the water level rose during the delays. As a result, some of the outermost obstacles couldn't be dealt with until the tide fell again. Landing craft had to beach in and among the obstacles in some cases. This caused losses of landing craft and personnel. To use one example, "D" Company of the Regina Rifles suffered around 50% losses when their landing craft came in late and several of them hit mines on obstacles that were being hidden by the rising tide.
I hope this helps -- if you're looking for sources, a lot has been written about German beach defences in Normandy and the Allied effort to understand and neutralize them. I pulled some of the information in here -- especially on losses of landing craft and personnel - from C.P. Stacey's official history of the Canadian Army in the Second World War, which is available online here. While parts of it are dated, and there's a fair bit of historiographical debate about some of his arguments, it has the advantage of being available online in case you want to read up on any of it without having to track down hard copies -- the section about the assault on the beaches begins on page 100, and there is discussion before then about the role of the obstacles in the German defences, starting around page 67.