Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => Casio PRIZM => Topic started by: Ashbad on September 01, 2011, 10:15:49 pm

Title: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 01, 2011, 10:15:49 pm
So, I decided to finalize my choice for what I would do in the Prizm contest :P I was going to do pyyrix, but 30% a nasty bug hit and since I couldn't release the source (I would have to show at least 60% of it for someone to make sense of it) and after I realized I couldn't get it done in time, I decided last week to start another attempt: PrizmCity! :D

A full color SimCity1-like game where you are the mayor of a region and must build a city from scratch (like in SimCity, obviously :P).  As with SimCity games, you can't build your own buildings (besides schools, police kiosks, landmarks/parks, etc.) but instead you zone them out into Residental, Industrial, and Commercial areas so that private builder will build in these areas.  

The wealth of the buildings and residents entirely depends on how you plan you city though: you need to keep crime low, education and health high, environment pristine, utilities in check, transportation appropriate in certain city areas (low traffic in industrial and residential, high traffic in commercial), tourist attraction to bring business and wealth, and good laws/taxes/ordinances that aren't too strict yet still earn you money.

I should gave everything I just said ^above^ done by the contest due date (hopefully), and maybe afterwords I'll put in things like countries of joined regions, multiplayer region trading, disasters, designing custom terrain you city will be built on, and more.

Some screens (the in-game ones will probably be shown tomorrow):

(http://img.removedfromgame.com/imgs/TitleScreen.png)

(http://img.removedfromgame.com/imgs/AboutScreen.png)

(in case you didn't know, both backgrounds are of the Parque Central Twin Towers in Caracas, Venezuela :) I thought they showed a "city aura" well so I picked them for the job)

Also, this might possibly be the first thread out there for a Prizm contest entry :P and, in the about screen, it *says* open-sourced, and it will be open-sourced once the contest due date has passed (I can distribute it then)
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: AngelFish on September 01, 2011, 10:20:45 pm
Holy... 

Those graphics are amazing *.*
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: DJ Omnimaga on September 01, 2011, 10:22:40 pm
O.O indeed! I hope you finish it though. That said nice job on the layout Ashy. Did you make the second screenshot graphics all yourself btw?

Sorry to hear about the Pyrix bug, though :(
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: yunhua98 on September 01, 2011, 10:35:44 pm
Th graphics are real pics.  :P

that said, it looks really nice.  ;)
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Juju on September 02, 2011, 02:34:25 pm
Sounds pretty promising. Don't forget the Prizm only have 65536 colors, you might want to downgrade these pics to 16 bit so it would be more realistic.
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 02, 2011, 08:41:15 pm
Sounds pretty promising. Don't forget the Prizm only have 65536 colors, you might want to downgrade these pics to 16 bit so it would be more realistic.

Actually, now that I have the menu fully working (title screen, cursor, about screen) I must remark you can barely tell the difference between the 24 bit versions and 16 bit versions :P I could only tell that one cloud looked blurrier.  But to the sane person, it looks *amazing* even with only 2^16 colors :)

With that being said, yes I do have the main title screen elements working, and rather smoothly too.  I messed with Kerm's PRGM_GetKey routine and was able to make sure that pressing keys won't go through the cursor options too fast or anything; in short, I have found a way to have Axe-Like GetKey responsiveness, whoever thought they went Casio BASIC speed was rather wrong (wrong about the custom GetKey routine that scans the buffer)

Got that done, and I already had some of the actual engine done (map generation) -- this is going very very well.  Expect a very polished release on the due date.  I went through 3 hours of coding just now to make a large set of custom Axe-Like routines, the Title Screen, and bug fixing tile generation so I'd say I'm moving rather fast.  I should have some actual gameplay progress by sunday or labor day; tomorrow will be spent doing some of the spriting (probably roads, utilities, some more terrain objects, and zoning overlays)

:thumbsup:
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: AngelFish on September 02, 2011, 10:35:47 pm
Perhaps I should mention that I've been wanting a civilization type program for about the past three days. What a coincidence...
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 02, 2011, 10:42:36 pm
Perhaps I should mention that I've been wanting a civilization type program for about the past three days. What a coincidence...

:thumbsup: excellent!  Just 14 more days! :P
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: DJ Omnimaga on September 03, 2011, 12:43:39 pm
Yeah the difference between 16 and 24 is hard to perceive with such pic. Heck you could even downgrade to 8 bits if you have a compression routine and save some space and it would probably not look too bad. On  a side note can Paint convert to 16 bits color? ???

I'M glad some coding is done too. Also for Getkey I was actually confused the other day because Eiyeron seemed to have tried one routine after another and all seemed to run at BASIC speed. That scared the hell out of me, but finally it turned out he meant only one of the routines.

Good luck Ashy!
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 03, 2011, 01:03:36 pm
Thanks :) ATM I'm crazily working on it right now.  I actually almost even have the structure done for the entire city (50x50 60x60 cells, since each cell is a *highly condensed* structure that is ATM up to 15 14 (found an optimization to stack a certain attribute better) bytes big each -- I'm using a shitload of unions and non-limited enums to (even custom bit-width ints) to conserve every *bit* of every cell.  Each bit is crucial and used very well)

^ hehe, t'was updating code while I wrote this

With the structure for the city done, I just need to plug it into my rudimentary lathe Save/Load thing and you can keep your progress safe in a single file :) though only one city at a time, since I'm not going to be able to have a whole searching-for-city-files thing done in time for the due date I'm sure.

Map generation is done, but needs to be polished.  I still need to make sprites/tiles.  And then the fun parts begin ^_^

EDIT: DJ, paint actually can't convert, but mkg3a and SourceCoder 2.5 can :) SC2.5 only accepts files up to 100MB, and the titlescreen/about screen were compressed many times in .png format and still were slightly too big; I actually had to process them in chunks :P
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: DJ Omnimaga on September 03, 2011, 02:02:14 pm
You forgot to make backups. <_<

But nice to hear and I'M glad mkg3a and SourceCoder can. Also 100MB? Shouldn't that be more than enough for any pic? 100 MB is like 100000x10000 bmp I think! O.O

Also by map generation do you mean maps are kinda randomized?
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 03, 2011, 02:12:30 pm
Oh yeah I meant 100KB :P

Yeah maps are somewhat randomized, not that much, but they are

Also, what do you mean about backups ??? I haven't lost any progress thus far and either way I still have it backed up
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: DJ Omnimaga on September 03, 2011, 02:41:43 pm
Ah I see, and I was kidding about backups. I was saying because I know some people still lose entire progress due to fried hard drives :P
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 03, 2011, 02:44:43 pm
Ah I see, and I was kidding about backups. I was saying because I know some people still lose entire progress due to fried hard drives :P

:P I think I'm one of the few people who have never (accidentally) lost progress with a RAM clear / HardDrive Error ;D
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: DJ Omnimaga on September 03, 2011, 02:47:09 pm
Yeah but it can actually happen to anyone. After all Calc84maniac said the same thing as you before I'm sure, then one day it happened. As of now I guess it's fine though. I just mean it would suck if on Sept 15th at 8 PM you suddenly lost everything you worked on plus about 700 GB of your questionable videos/images :P
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: sjasogun1 on September 04, 2011, 05:23:05 am
Just the screenshots of the main menu's make me want to buy a Prizm. Looking awesome!
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Munchor on September 04, 2011, 05:29:52 am
Ashbad, this seems like an ambitious project, the ideas you listed all seem neat, I hope you can make it before the deadline is over, unlike what happened in the Axe contest :S, good luck!
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 04, 2011, 08:43:10 am
Thanks :)

And, only the most ambitious projects win in life.  On a side note, this is still going much better than UCTI
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: runeazn on September 04, 2011, 08:58:12 am
yeah i think calc84maniac must've cried after losing his over 9000 projects <j/k>

good luck, and i want to buy the prizm now but the cx is more usefull >.<
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 04, 2011, 12:39:00 pm
finally some in-game stuff!  :)

(http://img.removedfromgame.com/imgs/mapgeneration.png)

Here's a part of a map I "mocked-up" (I don't have a camera/videocam so I couldn't directly show a picture of the map generation I just got working  so I pieced it together in paint using my Prizm as a reference -- It's actually just like in game though) showing one seed formula used to generate and the outcome.  The black area is reserved for the future HUD.  Basically, This one had a formula that squeezes all terrains into a map -- so that mountains, trees, grass, and sand/dirt are all very very close together.  Parameters for seeding (you can actually input them to obtain prime results for your city's terrain!):



Next up will be simple statistics and utilities :)
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 04, 2011, 09:21:44 pm
Well, found some bugs with the generator :/ should be fixed by tomorrow, along with the addition of simple stats/utilities.
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: DJ Omnimaga on September 04, 2011, 09:32:50 pm
GOod luck.. I hope you do not encounter any nasty bug preventing a submission x.x

Btw those tiles looks kinda nice. You should maybe make the mountain borders lighter, though, to stay consistent with the overall style that lacks borders for the most part.
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 07, 2011, 04:07:27 pm
Map generating bugs nearly gone.  Made a new random routine that really is rather random, but slow (I don't mind it though) so map generation is almost pitch perfect.
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Yeong on September 07, 2011, 07:46:29 pm
wow it looks quite nice! Keep it up so I can put it whenever I buy prizm! :D
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: TIfanx1999 on September 07, 2011, 08:18:12 pm
This looks nice Ashbad, I hope you are able to complete a fairly playable demo by the deadline. Simcity is a pretty beastly project! O_o
I was also curious;  what size tiles are you working with?
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: BalancedFury on September 07, 2011, 08:34:26 pm
Wow... it looks nice...
I want prizm! Now?
O_o
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 07, 2011, 08:42:25 pm
This looks nice Ashbad, I hope you are able to complete a fairly playable demo by the deadline. Simcity is a pretty beastly project! O_o
I was also curious;  what size tiles are you working with?

Thanks :D

only 16x16 tiles, and as you can tell pretty crappy ones (They're pretty much just placeholders for now, lol there's not even any border tiles yet)
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: XVicarious on September 07, 2011, 11:18:03 pm
Oh wow Ashbad. Can't wait to see this (I'm gonna buy a Prizm soon).
I do wish you finished UCTI because it looked AMAZING.
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 08, 2011, 09:14:58 pm
Thanks :D BUYAPRIZMBUYAPRIZMBUYAPRIZMBECAUSECISGREAT

I think I may release the source for UCTI tonight as well

EDIT: also got a preliminary HUD and a sweet map cursor working tonight
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: XVicarious on September 08, 2011, 09:52:58 pm
Nice!
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 09, 2011, 03:25:05 pm
Well, I got a preliminary HUD working, reduced the size of viewable playing field at a time (from 11x24 to 20x10 to make tons of room for the HUD), got a map cursor working, fixed a *very* fatal flaw in map generation, and a few other things :) I completely rewrote the map generation to fix the errors and I achieved 500 lines in one hour O.o

EDIT: even added those little quirky messages usually seen in SimCity games when setting up a new city like "Seeding Trees" or "Parsing Mountains" :3
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: ztrumpet on September 10, 2011, 10:56:48 am
This looks awesome, Ashbad.  I really like how you're generating the maps.  It's pretty cool. :D
Good luck!
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 10, 2011, 01:00:55 pm
Thank you :) so far I've put about 10 hours of coding at least into map generation, when I should be working on other things.  To tell the truth, everything else is insignificant IMHO, because I've done city-type stuff before, but never map generation.  Once map generation is immaculate (it's getting really really close, just a few problems with low density and high altitude), I'll move on.  Right now, I'm writing yet another pass to the generator that adds more bodies of smooth water and grassy plains, and maybe a 4th pass:

1st pass -- simply using a bunch of mixed and pipelined algorithms, gets a general landscape setup with quite a few error spots
2nd pass -- cleans up error spots and smooths out terrain
3rd pass -- planned to add extra stuff like preset lakes
4th pass -- probably checking for impossible building situations

I'm also working on making the HUD even more functional, also by creating a custom set of text() and print() routines and a custom character set, and then finally "big buttons" seen in SimCity 3/4
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Wellen on September 10, 2011, 02:10:50 pm
Woaw, it looks really awesome !

Good luck !

/me is drooling
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 10, 2011, 02:27:52 pm
Thanks :) right now I'm getting rather annoyed because each time I try to debug a different setting of map generation, it takes a minute to generate.  It's getting more time consuming to test than to write! XD
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 11, 2011, 03:36:01 pm
Well, finished all work concerning Map Generation.  Things I did:

- reduced to a 2 pass system
- since generating lakes and islands and such didn't work well, it uses preset seeds in pass 2 to make them
- got rid of all junk generation

EDIT: on a side note...  just noticed this:

http://img.removedfromgame.com/imgs/evil code.PNG (http://img.removedfromgame.com/imgs/evil code.PNG)
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 11, 2011, 07:52:37 pm
well after basking in the evilness above I have almost finished the HUD and...  what do you think of the icons?  :)

(http://img.removedfromgame.com/imgs/Icon_U.bmp) (http://img.removedfromgame.com/imgs/Icon_S.bmp)
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: JosJuice on September 12, 2011, 10:39:23 am
Those icons look pretty nice! You might want to add some shadow in the second one if you want to match Casio's icons, though.
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 13, 2011, 10:11:28 pm
Well, my friend. Since we last talked I've added many dozens of KB into the size of the final binary (after compilation, of course), and I finally know where I'll stand with term of completion for the contest.  I sadly can't get everything done in time, but I can promise:

- Beautiful Map generation (done)
- Wonderful graphics (done)
- A very simple yet chock-filled HUD (done)
- Simple zoning and utilities (almost done)
- Neural road system creation and detection (WIP)
- Approval ratings and very simple statistics (will likely be the last thing to get done in time)

Everything else will be updated while the polls take place.  There will be constant update uploads and source code releases during the voting period, so if you'd rather wait until a more complete version is done to vote, just wait for about a week into voting.  It should be very complete by then, and I would appreciate people waiting to try the extra features out before casting their thoughts into the system.

With that being said, the only known competitor of mine is z80man, who hasn't said much about his entry.  He said he still is working on it, but like me, is unsure if he'll get it nearly done by the end.  He didn't really announce what it was, but hinted publicly towards a Plants v. Zombies port.  Good luck to z80man, shall our debut of skills provide a great learning experience for both of us :) be sure to consider voting for him too even though he didn't hype his up as much.  I'm sure his entry will be very very good.

And in last thoughts, I won't be chatting much for the next three days.  I'm literally coding my life away.  I'm using my 30 minute long study-hall period, my 30 minute long lunch period, most of my comp. sci. Class time, and at least 5 hours when I get home each day just for this.  If nothing else I want to do at least moderately well in this contest, to prove to myself I do know C much better than I think I do.  And through this whole process of proving it, I've learned a lot about the Prizm's internal workings (which will help in later projects), and C in general.  So this has helped :)
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: DJ Omnimaga on September 13, 2011, 10:40:20 pm
You said you're coding your life away but spent all this time writing a long post? O.O
/me votes we tempban both Ashbad and z80man until the deadline

jk
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 14, 2011, 03:18:45 pm
Hehe, you probably need to so I don't get distracted x_X
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: DJ Omnimaga on September 14, 2011, 04:50:06 pm
Or rate down any post made between Sept 13th 10:11 PM and Sept 16th 1:55 AM GMT-5 then rate them back up once the entry is submitted. J/k but Don't make the game way too big, though. Make sure you got a demo at least ready then add extra stuff if you have time.
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 15, 2011, 07:12:14 am
Well, hopefully today ill get the preliminary zoning engine done, so no worries ;) then ill submit it to the contest application.
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 16, 2011, 07:16:05 pm
The entire source for the primary source file is available now! http://pastebin.com/6xMU2i2i

Full-length animated screeny coming soon
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: shmibs on September 16, 2011, 07:35:47 pm
ash, how does this go about rendering its maps? it seemed to take a while for the PRIZM's fancy pants hardware, so i thought you must be doing something fancypants yourself and wanted to ask before looking at the source.
Title: Re: [Prizm 2011 Contest Entry] PrizmCity
Post by: Ashbad on September 16, 2011, 07:45:53 pm
ash, how does this go about rendering its maps? it seemed to take a while for the PRIZM's fancy pants hardware, so i thought you must be doing something fancypants yourself and wanted to ask before looking at the source.

Well, it really isn't much.  I just realized no matter how much I optimize the rendering process, it'll still be slow, since it's pretty simplistic:

Code: [Select]
void drawtilemap(city_cell*map, int xpos, int ypos) {
        city_cell*cur_element = 0x00000000;
        const char*tile = 0x00000000;
        for(int j = 0; j < 10 ; j++) {
                for(int i = 0; i < 20; i++) {
                        cur_element = access_map_element(map, xpos+i, ypos+j);
                        if(cur_element->occupied) {
                                switch(cur_element->occupied_type) {
                                        case utility:
                                                break;
                                        case residential:
                                        case commercial:
                                        case industrial:
                                                tile = ((cur_element->occupied_type-1)*512)+zoning_tiles;
                                                break;
                                        case school:
                                                break;
                                        case police:
                                                break;
                                        case firestation:
                                                break;
                                        case hospital:
                                                break;
                                        case road:
                                                break;
                                        case political:
                                                break;
                                        case park:
                                                break;
                                        case landmark:
                                                break;
                                        case ruins:
                                                break;
                                }
                        } else {
                                switch(cur_element->natural_cell){
                                        case grass:
                                                tile = grass_tile;
                                                break;
                                        case water:
                                                tile = water_tile;
                                                break;
                                        case dirt:
                                                tile = dirt_tile;
                                                break;
                                        case sand:
                                                tile = sand_tile;
                                                break;
                                        case tree:
                                                tile = tree_tile;
                                                break;
                                        case mountain:
                                                tile = mountain_tile;
                                                break;
 
                                }
                        }
                        CopySprite(tile, i*16, j*16+56, 16, 16);
                        tile = 0x00000000;
                }       
        }
       
}

What I did to make sure it runs fast is create an organized system of Renderloops controlled by a single one, and within the renderloops check to see if anything had to be done or changed; if not, do nothing.  Also made sure that you couldn't do much at one single time within the renderloop, i.e. only one process at a time.  The main helper here isn't that the rendering process is fancypants, but rather I just used good coding regimes :)