Monday, October 06, 2008

Sim City 4 - Cities

Farm communities
The first city in a region often starts out as a farm community. But, as education levels increase, demand for farmland decreases. To keep the city a farm community, start zoning as low density residential and low density commercial. Because of the low density, there is no need to go beyond windmills and water towers. The more educated citizens will commute to other cities for better employment possibilities.
Bedroom communities
A bedroom community provides employees for the other cities in the region. It's probably the hardest one to make money on. Sims need a lot of services to be happy. To keep the traffic down, you will need transportation. At a minimum, you will need bus stops. Though, I like to do without bus service and just concentrate on trains and subways. As the city and region grow, you will also need passenger train service to industrial cities and subway service to commercial cities. A few commercial areas within the city will help keep the Sims happy -- and help generate money.
Purely industrial or commercial cities
These are the easiest to make money with because they don't need services such as hospitals and schools. In fact, these cities don't even need a police department since there are no Sims living there to commit crimes. The cities don't even need a fire department. When a fire start, you can plunk down a firehouse near the flames and then demolish it when the flames are out. (You don't even need a road for the fire engine to travel along.)
Mega cities
To get all or most of the rewards possible in the game, you need a city with residential, commercial, and industrial areas. When planning to develop a mega city, I start with farms and high (or medium) density residential and commercial areas. (Tall buildings won't develop without water, and so I don't see much need to start with low density zoning.) I place the first residential/commercial area in a corner of the city. Then I establish a train link to what will become an industrial city.
The industrial city can provide electricity (a coal-burning plant), garbage disposal (a waste-to-energy plant set at zero electricity production), and jobs for lower skilled workers. The residential city can provide water for the industrial city when it is time to water the city. (Dirty industry and farms produce water pollution which stops water pumps from working.)
As the city grows, you will get some beneficial rewards such as the mayor's house, a farmer's market, the state fair, houses of worship, private schools, and cemeteries. Then as the city grows and the citizenry become more educated, you'll want to dezone farmland and build more residential and commercial areas. When the demand meter shows that the only type of industry wanted is high tech, it's time to start building non-farm industrial areas.
I like to start off by building along the edges of the city map with farmland in the center of the map. When the farmland is dezoned, it provides a perfect place for a city center.
Hold off on a lot of the rewards. I would suggest waiting before building such rewards as the country club, city hall, university, and tourist trap -- either because of the monthly cost or the need for nearby police. (It seems that the larger an area a reward takes up, the more need it has for police.)
Also, hold off on establishing a purely commercial city bordering the mega city until your commercial areas are well developed.
When you do start watering the city and zoning for high density development, it will be time to demolish small police stations and build large ones where they can have the best coverage. You'll probably also want to move the library and museum. (I'd suggest near a college -- for ease in keeping track of them.) You'll need the central space for larger schools for your growing population.
Some notes about transportation:
I'm ambivalent about bus stops. Sometimes I think they cause more traffic congestion than they alleviate. For smaller cities, if you decide to use buses, place bus stops along heavily traveled routes to relieve congestion. For larger cities, place bus stops (or, better, subway stops) near residential skyscrapers and also work places. To get a new residential section to develop, place a bus stop near the residential zones. (People will hop off the bus and decide to build a house.)
I think that passenger train stations and the like do more than bus stops do to alleviate congestion. Passenger train stations also provide taxi service.
When choosing an airport to build, choose one that is right for the size of your city. If it's too large, it will drain your finances. If it's too small, it won't develop properly.

Saturday, October 04, 2008

Sim City 4 - Zones

Residential
  • Residential areas need schools (elementary and high school) plus health care (large medical center). The best place to put them is in the center of each residential area. When the city is still small, it's also a good idea to put a library, museum, fire department, and police department in the center as well. This allows you to find and check them easily. But, of course, don't add all of these services at the start. (I usually just start out a residential neighborhood with an elementary school, museum and library -- set to the minimum levels. The museum will provide buses for the school -- even if the school is set to minimum coverage area.)
  • This diagram shows how a completed residential area might look. The light green areas are areas that could be zoned for residential development, if watered, but left open or as parks if not. It also shows how services can be placed in one location.
  • Residential areas also need a lot of open areas. 1x6 open areas can be used to divide traffic flow and also to provide space for possible bus stops, subway stops, or parks/recreational areas. Larger open areas are great for a college, softball field, large police station (when needed), and house of worship.
  • Do not put residential zones next to the edge of the map. Sims do not like to live near traffic. It causes noise and air pollution. And there will be a lot of traffic going from one zone to another using the shortest possible route. The first money-making city I made had residential zones next to the edge of the map. I got so frustrated at their poor development that first I tried to torch them (which didn't work because of the smoke detector ordinance) and then I tried a meteor shower.
Commercial
  • Commercial areas need open spaces as much as residential areas do. Smaller open areas can be used for statues and small plazas. Larger ones can be used for plazas or rewards such as a farmer's market. Even larger ones can be used for larger rewards.
  • It's better not to put commercial areas right next to residential ones. There should be a buffer between the two. Though, it is nice if there are some within easy walking distance. There should also be a buffer between certain commercial rewards and residential zones.
  • I like to put passenger train stations in those commercial areas near residential areas. It helps increase traffic to stores near the stations.
Farm
  • Farms are important when a city is just starting out. They employ a lot of minimally educated people. Plus they provide one of the nicer rewards, in my opinion, the farmer's market.
  • They should be positioned away from commercial and residential areas. Commercial areas do not like being next to farms. Residential areas will develop well adjacent to farms but will soon complain about water pollution. Farms can be placed on slopes.
  • It's not clear to me whether large or medium or small farms are better. Although farmland is cheap to dezone, farm buildings are less so. However, larger farms seem to produce more water pollution.
  • It's possible to create a giant-sized farm with no interior roads by pausing the game during its creation. Zone for farmland to just before a road would appear. Then zone more farmland next to the original zone, etc. Unpause when the farm is large enough. (There is an upper limit on how large a farm can be made and still develop.) However, I recommend the "trick" detailed for low-tech industry such as farms.
  • For a large city, you'll want to dezone farmland until there are no farms left. For a small town, you'll probably want to keep the farms.
  • For the original version of the game, a town size of 3000 and farm population of 120 will give you a farmer's market, and a town size of 3500 and farm population of 240 will give you a state fair. (These numbers are different from the numbers supplied by the game. They are based on experience. However, for the deluxe version, the numbers are as supplied by the game.) Both the farmer's market and state fair should be placed with commercial zones. The farmer's market can be placed next to a residential zone, but the state fair should be quite a few squares away from any residential zones. (One web page said at least 17 squares away.)
Non-Farm Industrial
  • In general, these areas should be in their own separate city. Dirty industry produces a lot of air and water pollution. The pollution produced is so high that tech will only locate at the edges of these industrial areas. Farms also will not get settled when pollution is high. Trees and parks will help with pollution to a small extent.
  • It's also a good idea to build train tracks through industrial zones and connected to neighboring cities. Freight trains will appear even without freight stations.
  • For my first few cities I built bus stops when traffic became a problem. However, I like the "trick" I read about at simtropolis.com for zoning industry. Build a train track through the area you want to zone. Add a 3-square-long road that crosses the railroad tracks - as in the diagram at the right. If the area is zoned for farms, 4 farmhouses will develop on the road. If the area is zoned for other industry, a factory will develop at a corner next to the road. Then the rest of the zoned area will develop the same type of industry. There is no need to build passenger train stations at the crossing. Evidently, people just jump off the train as it slows for the road crossing. ;)
  • High-tech industry can be placed in a regular city. When a residential city is well educated, the demand meter for that city and possibly neighboring cities will show demand for only high tech industry. Add industrial zones to a residential city gradually in the same types of places you would commercial zones. Be sure to add open areas and flower gardens.

Wednesday, October 01, 2008

Sim City 4 - Walk through

Basics
In SimCity 4, it is possible to create a city that starts making money starting at the end of the second month. There are a few tricks to this.
  • Legalize gambling. It gives you an extra §100 per month.
  • Don’t build too many streets/roads during the first few months. Their upkeep can make a difference between a loss and a profit for the city during these months.
  • Start with a windmill instead of a big power plant. Windmills provide electricity at a lower cost than a natural gas power plant – up to the power provided by 4 windmills.
  • Don’t add services until needed. Starting with a library and museum is fine. Together they cost less than §10 per month. Add an elementary school when you can afford the cost. Then add a high school, large medical center, and a water tower or two, in that order, as you can afford them. With the Smoke Detector Program, you can wait until there is a fire before building a small fire station – and still put out the fire. I usually end up adding a college before a fire department. Add a small police department or two when you have the money. Police and fire departments help attract business.
  • Don’t be afraid of farmland. Farms are good employers for startup cities.
  • Utilize neighbor cities. When Sims complain about garbage, build a connecting city, an industrial city, with a waste to energy plant. Set the energy production for the plant to zero, but accept garbage from the first city. Set the garbage import rate to maximum. When you return to the original city, set the garbage export rate to about half of the maximum. Later, have your original city export water to the industrial one.
  • Do urban renewal. Dezone farmland that is no longer needed. Demolish buildings (like used car dealerships) that create a nuisance. Change or add streets to help traffic flow. Demolish buildings that have passed their prime, that no longer have any Sims in them -- provided you have the money to do so.
  • Micromanage. Set the coverage area low for schools and medical centers but not fire or police departments. Check often whether you have enough desks (schools), beds (medical centers), books (libraries), tickets (museums), and cells (police departments). As a side note, if teachers or health care workers go on strike, it's cheaper to bulldoze the building and replace it with another than to pay the increased costs to end the strike.
--------------------------------------------------------------------------------

The First Three Months
  • Month 1: Pause. While in God Mode, use a smoothing or feathering tool to smooth out the terrain. If you want to add a beach or dock to your future city, be sure to smooth the beach area so that there are sections of beach that are aligned with the grid. Add forests. Go to Mayor Mode to start the city and give it a name.
  • Keep the game paused. Lay out a minimal residential area. (For a first city, zone for moderate residential and commercial areas.) Add one windmill set at §50, a few streets, and small commercial areas at one or more corners. Leave an empty area at the center of the development for future services (such as education, health care, and safety). Add a farm set away from the town and connected to the town by a road or two and a power line. Lay out connections to two neighboring cities. Unpause.
  • Month 2: Pause. Open the city ordinances box and choose to legalize gambling. Also, choose the Smoke Detector Program and Clean Air Act. Unpause.
  • Month 3: Add more streets, residential areas, and/or farmland as needed. Add a library and museum. Set their funding low (less than §10 between the two).

At the right is a sample town plan:



--------------------------------------------------------------------------------

Utilities
Electricity
  • Start residential and commercial cities with 1 windmill. Add more windmills as the population grows. However, instead of adding a fifth windmill, build a natural gas power plant in a corner of the city and decrease the funding for the windmills to zero. There is no need to demolish them. (Note: Windmills produce no pollution. Natural gas power plants produce minimal water pollution.)
  • Start industrial cities with 2 windmills at full power plus a waste to energy plant at zero power. When demand increases, build a coal plant in a corner of the city and decrease the funding for the windmills to zero. (Note: Coal plants produce a lot of air and water pollution, but they produce a lot of electricity at a cheap rate. It's best to keep them away from everything -- except the corner of the map.)
Water
  • Water is the main reason for choosing a system of streets or empty land every 7th square both lengthwise and crosswise. Pipes provide water for buildings up to 6 squares away. An optimal way of laying pipes would be to have one crosswise pipe (under a road or empty land) and then lengthwise pipes every 14th square. (The roads with no pipes under them would be unwatered.)
  • Startup cities do not need water or water pipes. They just won't develop beyond the light development stage. Once you do add water, be prepared for a burst of activity. Whether it is better to start with water towers or water pumps depends on the size of the city at the time they are added. It's best to keep water funding near maximum to keep pipes from bursting.
  • Four water towers at full capacity provide water for a lower cost than one water pump at the equivalent partial capacity. Note also that all water resources need to be run at the same capacity. So, water towers should be demolished before building the first water pump. Just as power plants need to be periodically replaced as they age, so do water towers and water pumps.
  • Finally, industrial cities and cities in which you decide to keep farmland will eventually need a water treatment plant. Commercial areas and high-tech areas do not like water pollution. Plus, water pumps and towers will stop working if water pollution near them becomes too high.
Garbage
  • Garbage is best taken care of by a waste to energy plant (set at zero electricity production) in a completely industrial city. Since there is nobody living in the city, there is no one to complain about the pollution. However, for the health of the industry in the city, locate the plant a short distance away from the main industrial areas.
  • For large residential cities, recycling centers are nice but not essential -- as long as garbage is taken care of in some way.
  • If for some reason you like vultures (I think that's what they are), create a landfill.

Sim City 4

Since aol Journals and Home Spaces are shutting down, I'm moving some pages I created about Sim City 4 over to here.

The first page of these pages has hints on starting a city, including a walk through for the first 3 months plus some thoughts about utilities. The next page has info on zones. The final page has info on types of cities.

Links
  • The Region part of the official strategy guide at EA Games allowed me to create my first money-making city. The city fell apart after it reached 20,000, but I didn't need to take out any loans.
  • Gamespot has a lot of useful hints. Scroll down the page.
  • Simtropolis.com has many more hints plus a link to a very active Sim City bulletin board.

Monday, February 18, 2008

printing

Here is the basics of a print macro that will print successive pages in turn. Use the "end of used area"-Cursor to print just the used area (bounded by blank rows and columns). Use the "gotoend"-Cursor to print the entire sheet (all the cells with entries plus, of course, the blank rows and columns). It prints the range from oCell (here, the top left cell on the page) to the lower right edge of oCursor.

Sub printpage
oSheets = ThisComponent.sheets

for j = 0 to oSheets.count() - 1
oSheet = oSheets.getbyindex(j)
oCell = oSheet.getcellbyposition(0,0)
oCursor = oSheet.createCursorbyrange(oCell)
oCursor.gotoEndOfUsedArea(true) ' This is a range
oCursor.gotoEnd 'This is a single cell
ThisComponent.getCurrentController.select(oCursor)

answer = msgbox("Do you want to print this sheet?",3,"Print sheet?")
if answer = 3 then'cancel
exit sub
elseif answer = 6 then'yes
oPrintArea(0).StartColumn = oCell.rangeaddress.StartColumn
oPrintArea(0).EndColumn = oCell.rangeaddress.EndColumn
oPrintArea(0).StartRow = oCursor.rangeaddress.StartRow
oPrintArea(0).EndRow = oCursor.rangeaddress.EndRow
oSheet.setPrintAreas(oPrintArea())
thisComponent.Print(Array())
end if

next
end sub

Friday, September 14, 2007

where macros and dialogs are kept

I just discovered that my version wasn't keeping my macros where I thought. After looking and looking (Search didn't work), I finally looked at Tools/Options/OpenOffice.Org/Paths/Basic.

Tuesday, September 11, 2007

finally, redid this

This took me a long time to recreate. But, I think it's finally ok.
Sub Lines(tfield, tname2, tbroker2, tshares2, tbasis2, xshares, xbasis, ten())'----------------Lines----------------
dim clrw(3)
dim tots(9)'running totals

tshares1 = val(ten(0))'shs added to tname1, may be negative
tbasis1 = val(ten(9))'basis added to tname1, may be negative
if ten(6) = "exchange" or ten(6) = "transfer" then tbasis1 = 0
'for transfer and exchange, tbasis1 and tbasis2 start off at zero
'tbasis1 = - tbasis2 are calculated here

if val(tshares2) <> 0 then two = -1 else two = 0

if tfield = "stock" then
trange = "Trades"
trange2 = "CTrades"
tsheet = "Stock"
diff1 = tshares1 - int(tshares1)
diff2 = tshares2 - int(tshares2)
if ten(6) = "exchange" or ten(6) = "merger" then diff1 = 0 : diff2 = 0
elseif tfield = "fund" then
trange = "Fund"
trange2 = "CFund"
Call NewSheet(tsheet, ten(1), -1, -1)
oCell = thiscomponent.sheets.getbyname(tsheet).getcellbyposition(0,0)
thiscomponent.getCurrentController.select(oCell)
Call Resized(trange, tsheet, "shares", 0, 1, 1)
Call Resized(trange2, tsheet, "shares", 0, 2, 1)

diff1 = 0
diff2 = 0
else
' msgbox tfield
exit sub
end if

oSheet = SheetObj(trange,tsheet,clrw())
oRange2 = oSheet.getcellrangebyname(trange2)
Call Sorting(trange,tsheet,8,1,2,-1,-1,-1,-1)

tots(0) = xshares
tots(1) = xbasis
tots(2) = tshares1 + xshares 'new share total
tots(3) = tbasis1 + xbasis 'new basis
tots(4) = diff1
if two then
tots(5) = tshares2
tots(6) = tbasis2 ' not needed or used
tots(7) = diff2
tots(8) = xbasis ' not needed or used
tots(9) = xshares
end if

n = 1
do
Next1:
r = ""
if tots(0) = 0 then exit do
if (ten(6) = "exchange" or ten(6) = "transfer") and rounding(tots(2) - tots(0),3) = 0 then exit do

answer = FindTriple(trange, tsheet, 1, r, ten(1), ten(8), 7, "", 0, n, -1)
if not answer then exit do

if ten(1) = tname2 and ten(8) = tbroker2 then n = n + 1

lshares = oSheet.getcellbyposition(0,r).value'shares in entry
lbasis = oSheet.getcellbyposition(9,r).value'basis in entry
temp1 = lshares
temp2 = lbasis
if lshares = 0 then goto Next1

if two then call CopyLine(trange, tsheet, 0, r-clrw(1), trange, tsheet, 0, r + 1-clrw(1), 0)


'deal with first line, the line with tname1 and tname2
if ten(6) = "exchange" or ten(6) = "transfer" then 'may not transfer all shares
if lshares > abs(tots(2)) then temp1 = lshares - abs(tots(2)) else temp1 = 0
temp2 = rounding(lbasis * temp1 / lshares, 3)
else
temp1 = rounding(lshares * tots(2) / tots(0), 3)
if tots(1) = 0 then
temp2 = 0
else
temp2 = rounding(lbasis * tots(3) / tots(1), 3)
end if
end if

todel = 0
if two then'copy line r to "C" stock/fund
if rounding(temp1,3) = 0 then todel = -1
if todel then 'not sure whether first few lines here are needed if line not deleted
call CopyLine(trange, tsheet, 0, r-clrw(1), trange2, tsheet, 0, 1, todel) 'may delete line
oSheet.getcellrangebyname(trange2).getcellbyposition(0,1).value = lshares - temp1
oSheet.getcellrangebyname(trange2).getcellbyposition(9,1).value = lbasis - temp2
if todel then r = r - 1
end if
end if

if not todel then'line r not deleted
oSheet.getcellbyposition(0,r).value = temp1
oSheet.getcellbyposition(9,r).value = temp2
n = n + 1
if tots(4) <> 0 and temp1 <> 0 then
temp3 = rounding(lshares * tots(4) / tots(0), 3)
call CopyLine(trange, tsheet, 0, r-clrw(1), trange, tsheet, 0, r + 1-clrw(1), 0)
n = n + 1
oSheet.getcellbyposition(0,r+1).value = temp3
oSheet.getcellbyposition(0,r).value = temp1 - temp3
oSheet.getcellbyposition(9,r+1).value = rounding(temp2 * temp3 / temp1,2)
oSheet.getcellbyposition(9,r).value = temp2 - rounding(temp2 * temp3 / temp1,2)
oSheet.getcellbyposition(6,r).string = ten(6)
oSheet.getcellbyposition(6,r+1).string = "frac." & ten(6)
tots(4) = tots(4) - temp3
r = r + 1
end if
end if

tots(0) = tots(0) - lshares
tots(1) = tots(1) - lbasis
tots(2) = tots(2) - temp1 + lshares
tots(3) = tots(3) - temp2 + lbasis

if two then
r = r + 1
if ten(5) <> 0 and tots(5) <> 0 and tots(9) <> 0 then
temp1 = rounding(lshares * tots(5) / tots(9), 3)
temp2 = lbasis - temp2
end if

oSheet.getcellbyposition(0,r).value = temp1
oSheet.getcellbyposition(9,r).value = temp2
oSheet.getcellbyposition(1,r).string = tname2
oSheet.getcellbyposition(8,r).string = tbroker2
if tots(7) <> 0 and temp1 <> 0 then
temp3 = rounding(lshares * tots(7) / tots(9), 3)
call CopyLine(trange, tsheet, 0, r-clrw(1), trange, tsheet, 0, r + 1-clrw(1), 0)
if ten(1) = tname2 and ten(8) = tbroker2 then n = n + 1
oSheet.getcellbyposition(0,r).value = temp3
oSheet.getcellbyposition(0,r+1).value = temp1 - temp3
oSheet.getcellbyposition(9,r).value = rounding(temp2 * temp3 / temp1,2)
oSheet.getcellbyposition(9,r+1).value = temp2 - rounding(temp2 * temp3 / temp1,2)
oSheet.getcellbyposition(6,r).string = "frac." & ten(6)
tots(7) = tots(7) - temp1 + temp3
end if
tots(8) = tots(8) - lbasis
tots(6) = tots(6) - temp2
tots(9) = tots(9) - lshares
tots(5) = tots(5) - temp1
end if

loop
if ten(6) = "transfer" or ten(6) = "exchange" then
tbasis2 = tots(3)
' msgbox tbasis2
' msgbox temp2
ten(9) = tots(6)
oRange = ThisComponent.Sheets.getByName("Data").getCellRangeByName("All")
thiscomponent.getcurrentcontroller.select(oRange)

oRange.getcellbyposition(9,1).value = ten(9)
' msgbox ten(9)
Call CopyLine("all", "Data", 0, 1, trange2, tsheet, 0, 1, 0)
end if
'msgbox tbasis2
'msgbox tshares2
'for j = 0 to ubound(tots)
'msgbox tots(j) & " " & j
'next

'change name of fund sheet
If tfield = "fund" And oSheet.name <> tname2 Then
temp = InputBox("What is the full name of the the ""new"" fund?" & _
Chr(10) & "OK to leave blank.")
if temp = "" then temp = tname2
oSheet.rows.insertbyindex(0,1)
oSheet.getcellbyposition(0,0).string = temp
oSheet.getcellbyposition(0,0).CharColor = 16711680 'red
oSheet.name = tname2
End If


End Sub

Friday, November 10, 2006

Arrays as subroutine arguments

In the last version of VBA that I used, if one wanted to use an array as an argument in a subroutine or function, one was limited to one array which had to be the last argument. This isn't the case with ooo basic. One or more arguments can be arrays, and arrays can be placed anywhere in the argument list.