Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: UWNH remake in C/C++
oldposts
1st Mate
Posts: 1203
Permalink
Post UWNH remake in C/C++
on: August 20, 2007, 14:10
Quote

Hello, I am new to this forum,it's really amazing to see there are still dedicated fans sites and forums up and running for this 13-16 years old game(never got a chance to play I,I have played II(new horizons) III(looks like an expansion to II rather than a new game) IV(with better graphics and a software or d3d 3d renderer).

The online version 'daikoukai jidai online' is probably the successor of IV,though I am a bit anti-MMO and from I heard the online version is by no means as good as II. 😉

Now I am a bit defeated in real life,though the good thing is that I have the time to start coding a game I have been dreaming of for years. 😛

Planned features:
1.A new name *done* Ocean Horizon(to evade legal kinks like copyrighted trademarks and stuff :P)

2.Plain old top-view 2d tiles using SDL(same as UW2's) *done* 32x32 pixels per tile,currently looking into whether to use opengl to speed up 2d blitting and alpha blending.

3.Smooth scrolling(my hacks seem to be working,pixel by pixel camera movement instead of UW2's tile by tile camera movement due to the technical/hardware limitations of 1994)

4.Implement a map format and find the most appropriate size for maps:

Binary map format + zip compression is the only solution I could think of for now,coz I have no desire to spend time on implementing compressed map format.

Deciding the size of map is really tricky for UW-like game,because the map has to be enough big to contain a 'world map',while not so big to use up memory and make tile update ungodly slow.

Adding tiles/objects to the huge map will be a tough task too,my current idea is to generate a map from a bitmap,like if a pixel has color A,then add A type of tile to the map with identical x,y coordinates to pixel's in bitmap.With such method implemented,making a world tile map will be as easy as drawing world map in ms paint with few colors.

Other feature ideas will come later. 😀

oldposts
1st Mate
Posts: 1203
Permalink
Post Re:UWNH remake in C/C++
on: November 2, 2007, 10:40
Quote

Hey there.. got a few questions for ya, if you don't mind.
How far have you gotten? Do you have anything to show off (screenshots, video, demo)? Are you still working on it?
Greets 🙂

oldposts
1st Mate
Posts: 1203
Permalink
Post Re:UWNH remake in C/C++
on: November 5, 2007, 11:27
Quote

P.Overdrive wrote:

Hey there.. got a few questions for ya, if you don't mind.
How far have you gotten? Do you have anything to show off (screenshots, video, demo)? Are you still working on it?
Greets 🙂

sorry for the late reply because I had problems logon this forum.

yes I am still working on it.Unfortunately I don't have any 'visible progress' to show off,since it's still at early stage and the tiles I made with MS paint or gimp for testing look really ugly. 😛

basic stuff is almost done,currently working on in-game map editor so I can create a 'world' map using the ugly test tiles I made.I am also hesitate to use 3d ships(the map is top-down 2d,like UW2),because I am not modeller and using 3d ships will surely increase the complexity of the code,and the advantages of simple top-down view is quite obvious:it saves me from the endless headaches from 3d or isometric view/coordinates/collision detection.I will be using a lua like scripting language to store read-only game data like tile ids, ship stats,weapon info etc for sanity's sake,it will definitely be better than binary data or comma separated values.

Here is a list of major problems I will need to resolve,so let me know if you have any ideas on how they can be solved: 😉

1.map size,currently testing with 1024x1024 tiles with 32x32 pixels each,but it seems to be too small for a 'world' but the loading time is already a bit unacceptable,dunno how many tiles the original UW:NH had.

2.ship size,keeping ship size smaller than or equal to one tile will make things a lot easier code wise,but it seems 32x32 pixels is too few for a ship 'sprite'

3.realtime battle,how to solve realtime battles and how to make passing neutral or npc ships not getting involved by player vs player battle or player vs computer battle,maybe a 'faction/alliance' status to ignore non-hostile fire or something

4.synchronization of off-line/mid-join player in network game,no time has been spent on network yet,though webrv pointed out some problems with the off-line players in a game,perhaps off-line players should just disappear magically with their stats saved or their properties should be taken over by ai,not sure which one is optimal though

oldposts
1st Mate
Posts: 1203
Permalink
Post Re:UWNH remake in C/C++
on: August 4, 2008, 06:22
Quote

Sorry for the mega bump,but I wasn't able to get on this site to post updates(this site had a php p*** error)

I have got Ocean Horizons hosted on sourceforge.net,the largest open source portal site.

Dev blog on blogspot.com:

http://magickpanda.blogspot.com

Forums on sourceforge.net: (it's kinda talking to myself :P)

http://projectoh.sourceforge.net/forum

Post edited by: twm, at: 2008/08/04 07:23

oldposts
1st Mate
Posts: 1203
Permalink
Post Re:UWNH remake in C/C++
on: August 4, 2008, 07:32
Quote

well, yes, would help to announce it 😛

ps. is your formmailing script correctly configured because i did not receive my confirmation email, and judging from the lack of posts by others, neither do they.

oldposts
1st Mate
Posts: 1203
Permalink
Post Re:UWNH remake in C/C++
on: August 5, 2008, 09:00
Quote

Thanks for reporting the problem,eems the forum mailing is somewhat buggy in that version of punbb.I will disable Registration Confirmation for now.

P.S:I send you an email via forum email function with your account's new password,since I don't know your email address,though I am not sure if it works or not either.

oldposts
1st Mate
Posts: 1203
Permalink
Post Re:UWNH remake in C/C++
on: October 12, 2008, 17:06
Quote

First some technical bits.

The following is based heavily on the SNES version. From my understanding, you play the PC version. There are going to be some obvious differences, but the conclusions are the same.

Using an emulator, you can undoubtedly discover what resolution the current graphics mode is, and from there work on deciphering some tile information. Cutting to the chase, from my understanding, backgrounds are made up of tiles ranging from 32x32 to 128x128 pixels. Sprites appear to be 8x8, 32x32, and 64x64.

Depending on video mode, screen width would be either 256 or 512 pixels wide. At 256, an 8x8 would give ya 64 ships visible across the screen (nope), and 32 would give you 8 (seems like not enough). The 512 wide screen is used less frequently due to speed concerns. If a ship is fully 32x32, then that would give ya 16 ships, which seems reasonable.

a 32x32 ship, and 32x32 background tiles appear to be making sense.

Assuming 16 ships across the screen at 32x32, you can use that for figuring out your tile sizes for laying out the world map. If you're not doing a graphical rip of the game, just keeping things in proportion would be key. Taking lots of screenshots here and there so you can do some measuring wouldn't be a bad idea :).

You should also note that alot of times, games on tile based systems don't follow the rules of 'sprite must fit within one tile' -- for example, I believe Samus in Metroid can be up to 4 or 5 tiles in size.... fire it up in an emulator and check out the tile set sometime... :).

So. Proportion is what you want. And if you stick to whole tile movement, keep in mind that your game will act similar to the original UW's ship movement style.

Oh, and, the key to tile based animation isn't that the background is thing not allowed to move, but that it's made up of redundant graphics. You should still be able to scroll around a tiled world, its just your screen construction stuff builds off the smaller subset of tiles (saving memory). So, the tiles may be 128x128, but the world might be 128 of these tiles across and 64 of these tiles tall.

If you want to be exacting, I'd suggest starting at the southern tip of South America and take a screenshot for each 'screen width' you progress along the south pole. From there, chop up the images or p*** them together, etc, until you have a complete cir***frence of the south pole. That'll give you the UW2NH game width in pixels. How you determine it's height is up to you (a screen shots of the world map to get a complete image and then finding the ratio between w/h -- or perhaps picking something like sailing up the west coast of south america to the north pole, taking screen shots similarly to the south pole run...).

----

Mechanics and data types -- euh... they're all individual things. Treat them as such. Yes, you'll eventually get to where one can affect the other (cargo usage, food supply <> crew health, character data <> crew health, etc etc etc)... but.. I'd seriously work on keeping it all separate and working within their own little world before you attempt to cross mingle them. If you're doing this in a OO language, this should be easy to conceptualize. Tie-ins to the other areas of game mechanics can come at a later date with function/member calls or similar.

Keep things isolated to begin with for sanity.

----

Real time is subjective.

Depending on your target platform (web/html, web/flash, exe/tcp, exe/udp), and desired worst case latency.. you'll have to figure out what mechanic you wanna use. It's quite common for cross-world players to have latencies of 350ms back and forth, while people on the same ISP might have only a 25ms latency.

Also, I'm not entirely sure about how time passes while sailing in game. There have been instances where I'd swear that time passes in relation to your sailing speed.... in such a way that in slow spots, a day in game can pass in just a couple seconds, but on a speedy sailing speed a day can appear to last upwards to 10 or something. This is impossible during a real time networked game :).

Lets say you assume you'll do 4 'ticks' per second, and each tick represents 30 minutes of game time. Every second, 2 hours of game time passes. One day will pass in 12 seconds. A Mederia -> Lubeck run taking ~10 days would mean 2 minutes of real time. I'm unsure if this is correct or not... but it's an example. I'd also avoid using something like '3 ticks per second', because then you run into fractional decimal math :).

Next up - battle sequences in relation to 'real time'. Depending on how much control a player has over their fleet... this is going to suck hard. Attempting to coordinate 10 ships every tick is... impossible ? :). No matter what the battle mechanic you use, any opening decisions (fight/flee/etc) is gonna suck because for every second the player debates their choices, they lose X number of game time ticks... and if one player stalls making a decision, they're possibly forcing the other player to lock up waiting for a pre-battle-response.

Battle decisions may have to be made while sailing or while leaving port. This way, during sailing, a collision can trip a completely computer controlled battle outcome generator. You lose combat-field related strategy of the game this way 🙁 .. but in an ever present and ever time-moving world... you may not have much choice.

----

Town travel and trading in real time. If you heavily debate a trading decision or similar in the game, you're losing valuable game time. In UW, you can spend an indefinite amount of real world time deciding things while zero game time has passed. In a live time game, you have some very quick decision making to do. Lets say, 4AM to 8PM trading time at the market. Using the previous 4 ticks/sec at 30 min each, you end up with 16 hours of game time and 8 seconds of real time in order to make your trade. Insanity ?

If you drop it to each tick representing only 5 minutes of game time, one real second is 20min of game time, and one game day lasts 72 seconds in real time. 16 hours of time that the merchant is available for trading correlates into 48 seconds. Slightly more reasonable, but how often do you spend less than a minute at port in UW ? And that 10 day trip from Mederia to Lubeck now takes 12 minutes. I dunno how 'correct' this is to keeping pace with the original game. Lastly, a 20 day trip from Lisbon to the New World would take about two and a half minutes.

The more you make each game tick mean less game time, the more sluggish regular sea faring will become.

----

Figuring out time is going to be your enemy ... especially if you try to keep everything 'real time' and UW style limitation on what you can do depending on time of day. Similarly, any difficult decisions or manual-mental-research-work done by the player can correlate into days lost in game.

Next up - lets say Matey fees. At About 4 minutes per game month at 4t/5min formula, one real world day would see roughly a year pass in game time (360 days). During which time, you're paying, say, 100-600 a month in salaries. At 600 a month, that's 7200 gold lost per real world day.

In short, time will be fun 🙂 Long enough post heh.

oldposts
1st Mate
Posts: 1203
Permalink
Post Re:UWNH remake in C/C++
on: October 13, 2008, 01:13
Quote

unfies wrote:

First some technical bits.

The following is based heavily on the SNES version. From my understanding, you play the PC version. There are going to be some obvious differences, but the conclusions are the same.

Using an emulator, you can undoubtedly discover what resolution the current graphics mode is, and from there work on deciphering some tile information. Cutting to the chase, from my understanding, backgrounds are made up of tiles ranging from 32x32 to 128x128 pixels. Sprites appear to be 8x8, 32x32, and 64x64.

Depending on video mode, screen width would be either 256 or 512 pixels wide. At 256, an 8x8 would give ya 64 ships visible across the screen (nope), and 32 would give you 8 (seems like not enough). The 512 wide screen is used less frequently due to speed concerns. If a ship is fully 32x32, then that would give ya 16 ships, which seems reasonable.

a 32x32 ship, and 32x32 background tiles appear to be making sense.

Assuming 16 ships across the screen at 32x32, you can use that for figuring out your tile sizes for laying out the world map. If you're not doing a graphical rip of the game, just keeping things in proportion would be key. Taking lots of screenshots here and there so you can do some measuring wouldn't be a bad idea :).

You should also note that alot of times, games on tile based systems don't follow the rules of 'sprite must fit within one tile' -- for example, I believe Samus in Metroid can be up to 4 or 5 tiles in size.... fire it up in an emulator and check out the tile set sometime... :).

--------------------------->

I am using 32x32 tiles, resolution is scalable but it just draws more tiles with higher resolution, so a line of sight needs to be added to avoid high-res cheats..

Speed shouldnt be a concern, I am using 3D acceleration to draw 2D stuff, it'd be lightning fast as long as your graphics card supports 3D acceleration, actually most modern cards/integrated cards do.

Sprites bigger than one tile can be problematic when you need realtime collision, it's hard to test the sprite's collision box when the box's visual coverage is much bigger than a tile.

Here is how the game looks in 800x600 window, this is a ship(green arrow) got stuck near the English Channel on a 2048x2048 worldmap.Tiles are in 32x32.
Image

So. Proportion is what you want. And if you stick to whole tile movement, keep in mind that your game will act similar to the original UW's ship movement style.

Oh, and, the key to tile based animation isn't that the background is thing not allowed to move, but that it's made up of redundant graphics. You should still be able to scroll around a tiled world, its just your screen construction stuff builds off the smaller subset of tiles (saving memory). So, the tiles may be 128x128, but the world might be 128 of these tiles across and 64 of these tiles tall.

If you want to be exacting, I'd suggest starting at the southern tip of South America and take a screenshot for each 'screen width' you progress along the south pole. From there, chop up the images or p*** them together, etc, until you have a complete cir***frence of the south pole. That'll give you the UW2NH game width in pixels. How you determine it's height is up to you (a screen shots of the world map to get a complete image and then finding the ratio between w/h -- or perhaps picking something like sailing up the west coast of south america to the north pole, taking screen shots similarly to the south pole run...).

------------------------->
Movement is per pixel or per world space, so is the scrolling around map, the camera is much more like 3D game's with a coordinates x, y, map scrolling is based on the camera position and the camera is locked to an object:either a ship or a city/port, so moving the ship will trigger scrolling(like in UWNH).

The map sizes I am evaluating are 1024x1024, 2048x2048 and 4096x4096, each tile has about 7 bytes of information atm, and I store the whole map in memory after loading from binary .map file, so the overhead of memory is significant at bigger tile amount.

So far 2048x2048 seems to a blend of memory usage and size, the generated world map looks decent and it takes only 1/4 memory compare to 4096x4096 maps...

UWNH's world size is probably smaller than 1024x1024, since it doesn't resolve combat on worldmap, rather it does it on tactical map when 2 ships collide.

----

Mechanics and data types -- euh... they're all individual things. Treat them as such. Yes, you'll eventually get to where one can affect the other (cargo usage, food supply <> crew health, character data <> crew health, etc etc etc)... but.. I'd seriously work on keeping it all separate and working within their own little world before you attempt to cross mingle them. If you're doing this in a OO language, this should be easy to conceptualize. Tie-ins to the other areas of game mechanics can come at a later date with function/member calls or similar.

Keep things isolated to begin with for sanity.

-------------------------->
Most data types are done, all data is stored in script files in plain text form, they will be loaded into read-only class/struct in memory upon game start.

Cross-reference between data types are inevitable, especially a ship's properties such as cargo, crew, weapon, seems they share the same 'storage space' in UWNH.

----

Real time is subjective.

Depending on your target platform (web/html, web/flash, exe/tcp, exe/udp), and desired worst case latency.. you'll have to figure out what mechanic you wanna use. It's quite common for cross-world players to have latencies of 350ms back and forth, while people on the same ISP might have only a 25ms latency.

Also, I'm not entirely sure about how time passes while sailing in game. There have been instances where I'd swear that time passes in relation to your sailing speed.... in such a way that in slow spots, a day in game can pass in just a couple seconds, but on a speedy sailing speed a day can appear to last upwards to 10 or something. This is impossible during a real time networked game :).

Lets say you assume you'll do 4 'ticks' per second, and each tick represents 30 minutes of game time. Every second, 2 hours of game time passes. One day will pass in 12 seconds. A Mederia -> Lubeck run taking ~10 days would mean 2 minutes of real time. I'm unsure if this is correct or not... but it's an example. I'd also avoid using something like '3 ticks per second', because then you run into fractional decimal math :).

Next up - battle sequences in relation to 'real time'. Depending on how much control a player has over their fleet... this is going to suck hard. Attempting to coordinate 10 ships every tick is... impossible ? :). No matter what the battle mechanic you use, any opening decisions (fight/flee/etc) is gonna suck because for every second the player debates their choices, they lose X number of game time ticks... and if one player stalls making a decision, they're possibly forcing the other player to lock up waiting for a pre-battle-response.

Battle decisions may have to be made while sailing or while leaving port. This way, during sailing, a collision can trip a completely computer controlled battle outcome generator. You lose combat-field related strategy of the game this way 🙁 .. but in an ever present and ever time-moving world... you may not have much choice.

----------------------->
The target platform is any platform supported by SDL, the network model I am think of is probably TCP and a client<->server approach, TCP guarantees packet arrival in order reliably, and client<->server minimizes the possibility of desynchronization during a network session, though the downside is increased delay in executing orders for non-server players and increased network traffic caused by sending/receiving requests.

All battles have to be resolved in real time on world tile map, you give orders on a fleet basis rather than on a ship basis, which means you give your fleet attack, move, attack order and the non-flag ships in your active fleet(the one you are controlling to sail around) will move and attack automatically, thus reducing the micro needed to play real time battle.

The time will be tricky to do, every few second in real life as a day in game sounds about right.Though additional heeds must be paid to implementing time properly.

----

Town travel and trading in real time. If you heavily debate a trading decision or similar in the game, you're losing valuable game time. In UW, you can spend an indefinite amount of real world time deciding things while zero game time has passed. In a live time game, you have some very quick decision making to do. Lets say, 4AM to 8PM trading time at the market. Using the previous 4 ticks/sec at 30 min each, you end up with 16 hours of game time and 8 seconds of real time in order to make your trade. Insanity ?

If you drop it to each tick representing only 5 minutes of game time, one real second is 20min of game time, and one game day lasts 72 seconds in real time. 16 hours of time that the merchant is available for trading correlates into 48 seconds. Slightly more reasonable, but how often do you spend less than a minute at port in UW ? And that 10 day trip from Mederia to Lubeck now takes 12 minutes. I dunno how 'correct' this is to keeping pace with the original game. Lastly, a 20 day trip from Lisbon to the New World would take about two and a half minutes.

The more you make each game tick mean less game time, the more sluggish regular sea faring will become.

----

Figuring out time is going to be your enemy ... especially if you try to keep everything 'real time' and UW style limitation on what you can do depending on time of day. Similarly, any difficult decisions or manual-mental-research-work done by the player can correlate into days lost in game.

Next up - lets say Matey fees. At About 4 minutes per game month at 4t/5min formula, one real world day would see roughly a year pass in game time (360 days). During which time, you're paying, say, 100-600 a month in salaries. At 600 a month, that's 7200 gold lost per real world day.

In short, time will be fun 🙂 Long enough post heh.

---------------------->
Prolly it will be a disadvantage for slow mofos :p, but due to network nature, all things need to be resolved in real time.I will try to make a detailed explanation on how it will work later.

Anyways thanks for the insightful thoughts, feel free to post more long posts if you have other interesting ideas and thoughts. 🙂

Post edited by: twm, at: 2008/10/13 10:48

oldposts
1st Mate
Posts: 1203
Permalink
Post Re:UWNH remake in C/C++
on: November 4, 2008, 06:51
Quote

well, all for good ideas, i am not on the coding side. but if u have played 'high sea traders', the idea of using sea charts may be of a nice one.

Post edited by: JDeAss, at: 2008/11/04 07:51

Pages: [1]

Topics

Latest on the Forum