Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
21 May, 2013, 18:01:12 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 2 3 [4]   Go Down
  Print  
Author Topic: [Prizm 2011 Contest Entry] PrizmCity -  (Read 2802 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Ashbad
Guest
« Reply #45 on: 17 September, 2011, 01:45:53 »
0

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:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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 Smiley
Logged
Pages: 1 2 3 [4]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.179 seconds with 28 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.