1 2
8 9 10 11
Post subject: The grid/tile script made by Dammit.
Joined: 5/31/2011
Posts: 1
The link has gone bad: http://lua.pastey.net/109351 Does anyone still have it or know where to get it? (I've already looked everywhere else for it.) It's the lua script for Snes9x that superimposes information about land value, crime rate, and everything else: Kinda desperate for it. I think it's essential for any serious SimCity-er. Thanks...
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
Ah, that script. I have a version of my own. Considering the link is no longer useful, I'll make a direct post here: Download SimCityViewer.lua
Language: lua

--lua script for snes9x rerecording+lua. For SimCity (U) --Original by Dammit. Mostly rewritten by FatRatKnight, Feb 10 2010. local ShowNum, ShowGrid= true, true local ShowHex= false local Control= 2 local SwitchNum, SwitchGrid= "X","Y" local SwitchVal= "A" local SwitchDisp= "B" local Brd,Bck= {},{} Brd[0],Bck[0]= 0x00000060,0x00000000 --Black ; value zero Brd[1],Bck[1]= 0x005A00C0,0x005A0038 --V.Dark Green; Rock bottom, non-zero Brd[2],Bck[2]= 0x008C00C0,0x008C0038 --Dark Green ; Pitifully low Brd[3],Bck[3]= 0x00BD00C0,0x00BD0038 --Green ; Somewhat low Brd[4],Bck[4]= 0x00FF00C0,0x00FF0038 --Bright Green; Near-mid, but low Brd[5],Bck[5]= 0xFFFF00C0,0xFFFF0038 --Yellow ; Near-mid, but high Brd[6],Bck[6]= 0xFFB500C0,0xFFB50038 --YellowOrange; Somewhat high Brd[7],Bck[7]= 0xFF6300C0,0xFF630038 --Orange ; Rather high, I say Brd[8],Bck[8]= 0xFF0000C0,0xFF000038 --Pure red ; Absolute top local view -- Declaring that view exists here so functions can access it! local FieldW , FieldH= 120 , 100 -- Size of game's map local CamW , CamH = 32 , 28 -- Size of camera local CamX,CamY= 0x7E01BD,0x7E01BF -- Memory where camera position is stored --***************************************************************************** local function Byte_U(Index,TileX,TileY) --***************************************************************************** local Bx= view[Index]["Bx"] local Offset= math.floor(TileX/Bx) + math.floor(TileY/Bx)*math.floor(FieldW/Bx) local Val= memory.readbyte(view[Index]["addr"]+Offset) local C= 0 if Val ~= 0 then C= math.floor((Val+0x1F)/0x20) end return Bck[C], Brd[C], Val end --***************************************************************************** local function Bit___(Index,TileX,TileY) --Assumed box size is 1 --***************************************************************************** local Offset= math.floor(TileX/8) + TileY*math.floor(FieldW/8) local WhichBit= bit.rshift(0x80 , TileX % 8) local Test= memory.readbyte(view[Index]["addr"]+Offset) Test= (bit.band(Test,WhichBit) ~= 0) local Background, Border= 0x00B50038, 0x00B500C0 if Test then Background, Border= 0xFF840038, 0xFF8400C0 end return Background, Border, nil end --***************************************************************************** local function Word_S(Index,TileX,TileY) --Assumed it's Pop.Growth --***************************************************************************** local Bx= view[Index]["Bx"] local Offset= math.floor(TileX/Bx) + math.floor(TileY/Bx)*math.floor(FieldW/Bx) Val= memory.readwordsigned(view[Index]["addr"]+Offset*2) local C= 0 if Val ~= 0 then C= math.floor(( Val+300 )/60) C= math.min(math.max( 1,C ),8) end return Bck[C], Brd[C], Val end view = { -- Now define view, containing above functions -- {addr=0x7F0000, Mthd=Byte_U, Bx=4, name="Mystery" }, -- Was it charts? {addr=0x7F6B00, Mthd=Byte_U, Bx=2, name="Land value" }, {addr=0x7F76B8, Mthd=Byte_U, Bx=2, name="Crime" }, {addr=0x7F8270, Mthd=Byte_U, Bx=2, name="Pollution" }, {addr=0x7F8E28, Mthd=Byte_U, Bx=2, name="Pop.density"}, {addr=0x7F99E0, Mthd=Byte_U, Bx=2, name="Traffic" }, {addr=0x7FA598, Mthd=Bit___, Bx=1, name="Power" }, {addr=0x7FAB74, Mthd=Byte_U, Bx=4, name="LVmod:Parks"}, {addr=0x7FAE62, Mthd=Word_S, Bx=8, name="Growth rate"}, {addr=0x7FAFE8, Mthd=Byte_U, Bx=8, name="Police" }, {addr=0x7FB0AB, Mthd=Byte_U, Bx=8, name="Fire" }--, -- {addr=0x7FB16E, Mthd=Word_S, Bx=8, name="Tmp_Fire" }, -- {addr=0x7FB2F4, Mthd=Word_S, Bx=8, name="Tmp_Police" }, -- {addr=0x7FB47A, Mthd=Word_S, Bx=8, name="Com_Rate?" }, -- {addr=0x7FB600, Mthd=Byte_U, Bx=2, name="AltPollute1"}, -- {addr=0x7FC1B8, Mthd=Byte_U, Bx=2, name="AltPollute2"}, -- {addr=0x7FCD70, Mthd=Byte_U, Bx=4, name="LndVal.Mod "}, -- {addr=0x7FD05E, Mthd=Word_S, Bx=8, name="Tmp2_Police"} } --***************************************************************************** local function FindCam() --***************************************************************************** return memory.readwordsigned(CamX), memory.readwordsigned(CamY) end --***************************************************************************** local function ToDec(Num) --***************************************************************************** if not Num then return end return string.format("%d",Num) end --***************************************************************************** local function ToHex(Num) --***************************************************************************** if not Num then return end if Num < 0 then Num= Num+0x10000 end return string.format("%X",Num) end local ToString= ToDec if ShowHex == true then ToString= ToHex end --***************************************************************************** local function ShowStats(Left,Top,Right,Bottom, Fill,Bord,Str) --***************************************************************************** if ShowGrid then gui.box(Left,Top,Right,Bottom,Fill,Bord) end if Str and ShowNum then if Right-Left >= string.len(Str)*4+3 then gui.text(Left+2,Top+1,Str) end end end --***************************************************************************** local function DisplayScreen(Index) --***************************************************************************** local Left,Top= FindCam() local BoxSize= view[Index]["Bx"] local ReadData= view[Index]["Mthd"] local TileY= math.floor(math.max(Top, 0)/BoxSize)*BoxSize repeat local Temp= math.min(TileY+BoxSize,FieldH+1) local BoxUp= math.max((TileY-Top)*8,0) local BoxDn= math.min((Temp-Top)*8 - 1 , 223) local TileX= math.floor(math.max(Left, 0)/BoxSize)*BoxSize repeat Temp= math.min(TileX+BoxSize,FieldW+1) local BoxLf= math.max((TileX-Left)*8,0) local BoxRt= math.min((Temp-Left)*8 - 1 , 255) local Fill,Bord,Num= ReadData(Index,TileX,TileY) Num= ToString(Num) ShowStats(BoxLf,BoxUp,BoxRt,BoxDn, Fill,Bord,Num) TileX= TileX+BoxSize until (TileX >= Left+CamW) or (TileX >= FieldW) TileY= TileY+BoxSize until (TileY >= Top+CamH) or (TileY >= FieldH) end local Index= 1 --***************************************************************************** local function DisplayStuff() --***************************************************************************** local mode= memory.readbyte(0x7E0009) if (mode == 31) or (mode == 36) then if ShowNum or ShowGrid then DisplayScreen(Index) gui.text(200,215,view[Index].name,0x00FF00FF) end end end gui.register(DisplayStuff) local LastBtn= {} --***************************************************************************** while true do --***************************************************************************** local Btn= joypad.get(Control) if Btn[SwitchVal] and not LastBtn[SwitchVal] then Index= Index+1 if not view[Index] then Index= 1 end end if Btn[SwitchNum] and not LastBtn[SwitchNum] then ShowNum= not ShowNum end if Btn[SwitchGrid] and not LastBtn[SwitchGrid] then ShowGrid= not ShowGrid end LastBtn= Btn emu.frameadvance() end
Should work with the latest Snes9x 1.51 we have. If not, let me know.
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
I might want to try this layout. I already have posted a movie that shows how to replace water through off-map glitching. So it's entirely possible to reconstruct a waterless map without using that free land scenario. But basically, on that map, I have shrunk down the power plants and other stuff by that off-map glitching. More room for more zones. Surely the minimum in-game time goal would ask for such glitching. I succeed in powering the entire city using only 6 Nuclear Power. Well, the important stuff, anyway. Every power line I put down is important, in order to guide the path the game uses to power zones up. I also note I can place a bunch of parks initially to raise the Land Value of various places, then replace them with zones. The game won't recalculate the Land Value for several months, allowing good initial growth, especially for C-Zones at some edges. Whether it's better to pass time by building a functional city with the starting $20000 or watch grass grow is one thing I'm asking myself. I'm curious what I should do for a 600k population run. Use the off-map glitching? Place parks instead of a working city with the starting cash? What should be the freaking name of this freaky city? If I'm going to submit a TAS, I will use lsnes for my final run. I'm just using Snes9x as an easy emulator to make tests.
Limne
Any
Joined: 2/24/2010
Posts: 153
I'm not against throwing down a whole lot of parks and letting it idle. At least for my entertainment value. You know, provided the encoder provides time codes to skip ahead to where the action starts up again.
Player (71)
Joined: 8/24/2004
Posts: 2562
Location: Sweden
FatRatKnight wrote:
What should be the freaking name of this freaky city?
Um... What about "Freak City", or "Freakopolis", or maybe a Swedish tone to it such as "Freaksta" (Which is freakin' close to the real "Fryksta" in Sweden)?
Joined: 2/14/2012
Posts: 73
TASville? TASTown? TASCity? TASpolis?
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
For the name, there is a limit of 8 characters. Available characters: Uppercase letters, numbers, comma, period, hyphen, and space. It looks like I may name the city TASVILLE, place parks in various areas, and glitch the water away. Hopefully, time will pass fast enough with nothing much to process that the first year wouldn't need that much time. So, basically... - Go through title screen, menu, map 061, name, Easy, confirm. - Set taxes to 0% and speed to fast. - TAS-build a few rails and lots of parks. - Wait out first year. - Glitch my money to $999999 abusing the tax screen. - Do off-map stuff to remove water and shrink my utility buildings. - Build entire city at the speed of TAS. - Sit back, relax, and manipulate luck to speed up the population boom. - 600k population. Celebrate. Do not skip message. - Show statistics and map stuff. - Trigger disasters, manipulate luck to 0 population. - As a method to provide closure, select END and leave the game with the sleepy moon. I think I have a bit of lua to go through. If I'm going to manipulate off-screen buildings, I probably should have a script tell me what's going on...
Editor, Experienced player (570)
Joined: 11/8/2010
Posts: 4036
Sounds like it will be quite entertaining. I'm looking forward to seeing it.
Patashu
He/Him
Joined: 10/2/2005
Posts: 4043
Obviously you should call it TAShkent. http://en.wikipedia.org/wiki/Tashkent
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
Joined: 7/25/2007
Posts: 109
Call it the TAShole IMO.
Limne
Any
Joined: 2/24/2010
Posts: 153
TAS-Town is probably the funniest sounding I've heard proposed so far. I would be very interested in seeing TAS disaster manipulation. I remember leaving my SNES on overnight as a kid to see how much damage I could manage and, if memory serves me right, there were still a decent amount of buildings still standing... I guess the easiest thing to do would be to make sure the power plants get taken out right away. Oh, quick question: does time still pass in the "View" mode? That might be better for watching the city build itself up.
Active player (458)
Joined: 11/12/2010
Posts: 183
Location: Sweden
Probably a little vauge, but perhaps name it Toasspru? Using the two first letters from each word in Tool Assisted Speed Run :)
"An artist who can’t take constructive critique on their work is only hurting themselves and their potential. Conversely, and artist that can’t communicate a critique in a constructive way isn’t helping anybody."
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
There are no lowercase letters. Things like TASHKENT and TASHOLE might not transfer the intended meaning all that well. I'm still thinking about going with TASVILLE, though TAS-TOWN does have some appeal. But TOASSPRU has a few silly possible interpretations, at least. I could, of course, use FATRATKN for author recognition as well. But this has a drawback in that others who join in to help produce this TAS won't be able to easily change the city name to match (luck manipulation). A more self-explanatory name would be FAST600K. ... I should put some effort in getting that first year done... I know what to do to start it: Taxes to 0%, speed to fast, and select the Mass Transit tool to place two tiles of rail in order to glitch the money. Then parks. Lots of parks.
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
Well, I've decided on TASVILLE for the moment. After some cursory TASing of planting Parks all over (1996 in total), I realized I have plenty of time to create amusing shapes out of them, even when avoiding the forests and trying not to pass over a square without planting a Park (remember, any button presses freeze time). I already thought of Tetris pieces, for one. All 7 standard shapes in every possible unique rotation is only 76 Parks. Still have another 1920 to go. If it helps, Parks can come with or without tree. I haven't figured out the luck manipulation here, so I may just allow the trees to appear at random rather than try to control it. It will take approximately 1.5 minutes (movie time) to plant 1996 Parks. I start with 2 tiles of Mass Transit (-$40) so that I have expenses to pay for that money glitch.
Patashu
He/Him
Joined: 10/2/2005
Posts: 4043
Mandelbrot set? Approximation of penrose tiling? Stills from famous game of life patterns, such as the glider gun http://upload.wikimedia.org/wikipedia/commons/e/e5/Gospers_glider_gun.gif ? Pentagrams? SMB1 1-1? Hyperbolic geometry tilings? Hyperbolically (or otherwise) distorted checkerboard pattern? Dragon curve fractal? http://en.wikipedia.org/wiki/Dragon_curve Or its boundary? Hilbert curve? http://en.wikipedia.org/wiki/Dragon_curve
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
Limne
Any
Joined: 2/24/2010
Posts: 153
How are you putting down park tiles? Is it going to be in a big rectangle? Or can you leave some ground tiles by going around them? In the former case you've got two tones to work with, in the latter you've got three (Given field-parks, tree-parks, and the ground tiles). Both are sufficient to do pixel art: Consider for instance the two-tone character graphics displayed in the Super Mario Bros. 2 credits: http://www.spriters-resource.com/nes/supermariobros2/sheet/6980 I'd suggest picking some favorite iconic NES games with outline-friendly sprites and just use the parks to draw those designs. There should be plenty of good choices. You can get nearly 32 8x8 tiles worth graphics down that way. Or, you know, pretty much any of the drawings you get from a Picross puzzle would work too.
Joined: 5/11/2012
Posts: 3
Just wanted to say I'm really looking forward to seeing how this run turns out.
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
There are enough open land tiles that there will be plenty of areas left uncovered by parks. So that gives me three tones to work with, provided being lucky doesn't prove too difficult. Also, my build path will try to cover areas where I need the temporary Land Value to get my edge C-Zones grow to some decent population. There's plenty of open land to cross over, plenty of areas to cover on the way. I still need to work around the forests, however. That does limit my build space somewhat. I'll be taking a look at some of the sprites I might want to imitate. Familiar faces would certainly attract attention.
Joined: 7/25/2007
Posts: 109
Limne wrote:
I would be very interested in seeing TAS disaster manipulation. I remember leaving my SNES on overnight as a kid to see how much damage I could manage and, if memory serves me right, there were still a decent amount of buildings still standing... I guess the easiest thing to do would be to make sure the power plants get taken out right away.
Well, here's a thing about disasters: they depend on your difficulty. On Easy, you'll only get Fires and Plane Crashes normally; unsure about Floods (I usually bulldozed all the shores, but once it happened on the edge of the map anyway). Crank it up to Hard and you'll be getting Earthquakes, Tornadoes, and Meltdowns on a regular basis - notably, the lattermost won't happen on Easy, and I believe is restricted to Hard. Also, stray away from pixel art of NES stuff IMO. They don't deserve as much as they get. Try thinking grander-scaler!
Joined: 7/11/2010
Posts: 98
You should set it to hard anyway, since the movie rules say to play on hardest difficulty.
Limne
Any
Joined: 2/24/2010
Posts: 153
Thing is that you get a max of 32x30 tiles on screen at once on screen which really isn't enough to devise any "grand" pixel art. I dunno, the only other "iconic" 2-Bit color sprites are on the Game Boy. The Master System is a bit too obscure for most people and downscaling 4-bit color sprites would look odd to most people. As for difficulty the rule has generally been interpreted as only applying where the harder difficulty isn't just a trivial case of making the game longer as it is in this game.
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
Well, I do have three tones, maybe. I realize I'm pretty bad at coming up with a good pattern to use. The effects of difficulty are as follows: - Starting cash - Chance of disasters - Transit maintenance - Money gained from taxes - Effect on RCI-meter by taxes - The I portion of RCI-meter, beyond the taxes effect If there are other effects, I haven't noticed. Overall, slower growth on Hard because the game treats my 0% taxes as 2% when crippling my RCI-meter. Of course, everything that has to do with money is meaningless, or even beneficial in the case of the starting cash, as it means I build fewer things to run out of money. But in terms of in-game time, the loss in demands will have an impact, as well as the fact I have a worse temporary Land Value in many places. Do I pick Hard, knowing I'll lose a few in-game months (unless you can perfectly balance the zone populations, of which my test cities had no such luck during early growth even on Easy), or Easy, having selected a difficulty that tells the game to give me no trouble?
Limne
Any
Joined: 2/24/2010
Posts: 153
I'd say that easy mode would be best for entertainment value. I don't think hard would add much depth or complexity so much as it'd keep the viewer waiting... As for patterns... I thought I'd give it a try and see what I could come up with: http://tinypic.com/view.php?pic=csyhg&s=6 Here we have Frog Mario. As I understand though, a design like this wouldn't really work because it's got a lot of points that would require backtracking and islands that would require skipping squares... Also, it really doesn't look so good in winter or spring. In which season would the viewer generally be seeing these things? Maybe I'll try looking through some other possibilities, although, to get a design within the parameters needed it might be easier to design something from scratch. (I make graphics at a mobile gaming company for a living so that's something might also be able to do.) Hmmm... I forgot how many forests there are in 061... That could make things a lot trickier. Can the parks run around anywhere, or do they need to be local to a given area to increase property values?
Editor, Skilled player (1202)
Joined: 9/27/2008
Posts: 1085
Parks need to be nearby certain areas in order to provide Land Value in those areas. There are certain rules involving 4x4 squares the game uses to determine Land Value by pretty tiles. Parks in the same 4x4 provide the largest boost, though any in the adjacent 4x4 squares still provide 1/4 of that massive boost. Regardless, I have enough money on Easy to place quite a few Parks on the areas where they're not as useful. As for forests, I've taken a look on Map 061, and note that there are many forests to build around. In fact, I can't even get around from one area of the map to the other corner without going back to the area I start in due to these forests. I might need some smaller sprites to work with. Maybe Space Invaders or some Dr. Mario virus. It's a pretty tight fit in some areas. Still, I'll take a look to see where the Frog Mario can fit. Most of the construction will be done with spring colors. I don't expect it turning winter by the time I place the last few Parks. Time will be largely frozen due to the fact buttons are pressed most of the time.
Joined: 7/11/2010
Posts: 98
Wait, if you are going to have more than enough parks, would it be faster to put it on a harder mode so you run out of money faster so you get the $999999 faster? I'm pretty sure it wouldn't, but that could still be something to consider...
1 2
8 9 10 11