Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411427 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 11:24:46 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsMegaCity
Pages: 1 2 [3]
Print
Author Topic: MegaCity  (Read 9040 times)
SuperDisk
Level 2
**



View Profile
« Reply #40 on: February 10, 2013, 11:56:31 AM »

Counter incremented to 10% finished! The engine itself is completely laid out, now it's time for the game code to sit ontop of the framework.

Also, the github megacity-engine project is completely out of date, and shouldn't be used as it's full of bugs.

The chipboard (that contains all of the tiles) is an element. Since I don't want it to be updated each frame (re-rendering each and every tile every frame? Yoinks!) I have created the ChipEngine. This too, is an element subclassed from SubEngine (which is in turn subclassed from Engine.)

This lets me selectively update the chipboard and its tiles, as well as have more tight engine control over the tiles.

Even with all of these layers of stuff, game still runs at about 190 fps. I'm going to try to keep it as high as I can, to have room for more stuff. (the actual game will run at 60)

Sounds complex. Isn't really.  Huh?

(Oh and yes, I fixed a bug pertaining to having multiple InputEngines.)
« Last Edit: February 10, 2013, 01:25:39 PM by SuperDisk » Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #41 on: February 10, 2013, 11:59:09 AM »

Sounds like a really sweet idea!  Grin
Logged
SuperDisk
Level 2
**



View Profile
« Reply #42 on: February 22, 2013, 01:23:30 PM »

I'm thinking of rewriting the game in some other language like Pascal or Java, just because of the ridiculous clumsiness I'm encountering with Python. The simplicity and modifiability of it seems very appealing at first, but it becomes a hindrance about now.

For example, I have 1024 chips, each of them an Element. I have an engine that calls their method update() each frame. Nothing really intensive happens in this method. Yet, just the action of calling the method (no, not the stuff in it!) slows the game down by about 200 fps. (I completely commented out the contents of update() and it still slowed it down) This is absolutely ridiculous if I have to avoid structuring my code properly.

Is there anyone else who is having this problem? It's quite hard to just chuck the entirety of my codebase but still.  Hand Shake Left No No NO Hand Shake Right

Also, thanks for the support, yonder Madk.  Concerned
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #43 on: February 22, 2013, 08:17:46 PM »

Python is balls, man.
Logged
SuperDisk
Level 2
**



View Profile
« Reply #44 on: April 01, 2013, 02:26:50 PM »

Python is balls, man.

For games at least.

I've decided to rewrite in a different language (Pascal), for the challenge! (let's go with that)

Still using SDL though so it is all thoroughly cross-platform.
Logged
SuperDisk
Level 2
**



View Profile
« Reply #45 on: May 13, 2013, 05:32:10 PM »

After working on and off on the Pascal version, I suddenly remembered something wrong with the Python version that's causing it to lag so horribly:

I ACCIDENTALLY CREATED 4X AS MANY TILES AS I NEEDED.

Hahaaha! kill me Lips Sealed
Logged
SolarLune
Level 10
*****


It's been eons


View Profile WWW
« Reply #46 on: May 13, 2013, 06:22:24 PM »

I'm thinking of rewriting the game in some other language like Pascal or Java, just because of the ridiculous clumsiness I'm encountering with Python. The simplicity and modifiability of it seems very appealing at first, but it becomes a hindrance about now.

For example, I have 1024 chips, each of them an Element. I have an engine that calls their method update() each frame. Nothing really intensive happens in this method. Yet, just the action of calling the method (no, not the stuff in it!) slows the game down by about 200 fps. (I completely commented out the contents of update() and it still slowed it down) This is absolutely ridiculous if I have to avoid structuring my code properly.

Is there anyone else who is having this problem? It's quite hard to just chuck the entirety of my codebase but still.  Hand Shake Left No No NO Hand Shake Right

Also, thanks for the support, yonder Madk.  Concerned

1. Are you sure that you're going through your code correctly? I mean, will you need to call update on over a thousand objects, or could you just call it on objects onscreen or near the screen? Could you treat blocks of buildings, for example, as single objects?

2. If you're still going with Python, ensure that you're optimizing your Python flow.

3. If you really do need more speed, you could try using a 'speed-up' library like PyPy or Cython.
Logged

SuperDisk
Level 2
**



View Profile
« Reply #47 on: May 18, 2013, 05:31:27 PM »

Added chunks, and the ability to save and load them.

It's using the Python pickle module, which is hard to use because it keeps trying to pickle Pygame surfaces and stuff, so I've implemented the __setstate__ and __getstate__ methods on Chips and Chunks so they may be pickled.

Soon, I'll extend it out so that all Elements may be pickled.

Anyways, it's great to be back on track. FPS is (on average) still above 90, so that's good. I've yet to test it on a lame computer, so that might be a shock. Sad
Logged
SuperDisk
Level 2
**



View Profile
« Reply #48 on: May 19, 2013, 09:37:05 AM »

Today, boosted performance by adding dirtiness to chips and chunks. Now, I can render a full map of grass and water at 111 fps.

 Smiley
Logged
SuperDisk
Level 2
**



View Profile
« Reply #49 on: May 31, 2013, 06:39:49 PM »



More optimizations, and chunk saving/loading.

The world is now infinite infinite infinite Infinite infinite infinite infinite

And still running at 120-esque FPS. I'm quite pleased!  Tears of Joy

Too bad my summer is completely wasted by huge timesucks though, so I can't be able to goof of on the computer and work on this for lots of time.
Logged
SuperDisk
Level 2
**



View Profile
« Reply #50 on: June 01, 2013, 10:15:22 AM »

Tried to make asynchronous chunk loading, so I made a thing: AsyncGetter.

Use as such.

Code:
getter = AsyncGetter(object.getThing, args=())

<doing other stuff>
if getter.hasGotten():
   result = getter.getResult()

And this is all in a thread, so it's cool and stuff.
Logged
SuperDisk
Level 2
**



View Profile
« Reply #51 on: June 03, 2013, 02:23:34 PM »

And this is all in a thread, so it's cool and stuff.

Python threads are not cool and stuff.

Previously chunkloading used to take a long time and would pause the game for half of a second when the map was scrolled onto unloaded chunks.

Found out the problem (it was another stupid "lol lets load 4x what we need" type of thing). Now scrolling is silky smooth.

All is going according to plan.  Cheesy
Logged
SuperDisk
Level 2
**



View Profile
« Reply #52 on: September 18, 2013, 05:35:50 PM »

More slow work has happened whenever I feel bored.

Added
  • World saving and loading! (this time for real)
  • GUI
  • Block cursor
  • Chat box

The toolbar can be retracted and stuff (and the chatbox moves up and down with it)



Time for working on projects is rather scarce, so updates are far between and pretty non-substantive.

Alas.  Concerned
Logged
SuperDisk
Level 2
**



View Profile
« Reply #53 on: October 14, 2013, 11:22:56 AM »

More lame features:

  • Minimap!
  • Prettied up the toolbar



The minimap shows my world generator, which currently just picks whether to generate a water chunk or a grass chunk, which is crappy. You can click the minimap to change camera position, which I used to generate my name.

I think now I'll get a better world generator, then actually start making gameplay like I've been telling myself to do for the entire duration of this project.
Logged
Pages: 1 2 [3]
Print
Jump to:  

Theme orange-lt created by panic