Jump to content
  • Advertisement
  • entries
    383
  • comments
    1075
  • views
    353575

The Architecture of Graphics

Sign in to follow this  
Trapper Zoid

73 views

I played in a friendly corporate cricket tournament today with some friends and colleages from my research school. We came second last, one better than last year. Go us. We had two Canadian players on our team playing for the first time who ended up being not too shabby, around the same as me. Which says a lot for their general athletic ability and my lack thereof.



I'm still pondering over the architecture reworking for my engine. Looking through what I've currently done, I think the only especially tricky part will be with the graphics. I think a good message passing system will deal well with everything that doesn't require a lot of data passing around between modules, such as the controls, user interface, sound and so on. For the game critical code such as AI the implementation is extremely game specific, so I just have to make sure I've got the right ability in my data structures and communication between modules to allow them to do their thing. The only challenging part is how to efficiently throw up those 2D sprites to the screen.

At the moment, my implementation is pretty simple. I just use OpenGL intermediate mode, switch the appropriate texture for the sprite, and whack a textured sprite at the right spot on the screen. Make sure you draw all the sprites in the right order (back to front: basic Painter's Algorithm) and you've got graphics! Only problem is, it's a pretty naive implmenetation; it involves intermediate mode and switching sprite textures all the time.
There are work arounds for some of these, such as using sprite sheets where multiple sprites are defined on the same texture, but I still need to switch between sheets. I need to think of a decent enough approach so I can structure the architecture around it. The immediate mode method can be done pretty simply, but if I'm setting up sprites for batch processing in something a bit more complex then I'll need to design the data structures to cope with that.

I'm starting to think that it might be a good idea just to base my engine as a wrapper around an existing, tested 2D engine out there, as it's the prudent software engineering decision to make. But then again, every time I've peered into the source code of one of these 2D engines (at least the ones that have it available) then it looks pretty similar to the one I've already built. Plus I actually enjoy nutting these problems out, so I'm not sure I want to miss the fun of making my own 2D engine. It's not like it's rocket science.

At the end of the weekend though I really want to make a decision on how I'm going to structure this so I can get started fleshing out the code base. I'm going to start by thinking up an application problem - may be Ice Slider, although I'll probably pick something that doesn't have any animation required - and using that as a test case. Then write up the documentation to bulk out the interfaces for all the classes and use that as the limit of what I need to code up. Then code that sucker: hopefully most of the annoying set up code will be a cut-and-paste job from my existing code base.

All in all, I think it'll be a pretty smooth implementation this time round - if I could just wrap my head around how I'm going to translate my game data into sprites on the screen.
Sign in to follow this  


2 Comments


Recommended Comments

In Canada, we don't play cricket, so any talent on our brothers' side reflects solely on our superior genetic lineage. [grin]

Do you wanna use PI? I released the v1.0 alpha of it not too long ago, and I'm reasonably pleased with the 2D capabilities (although I'm still pretty cranky about the 2D actor class).

I'm close enough that you can IM me and drunkenly bitch at me, but it's been used in quite a few games.

Share this comment


Link to comment
Quote:
Original post by Ravuya
In Canada, we don't play cricket, so any talent on our brothers' side reflects solely on our superior genetic lineage. [grin]

Given the modified rules and tiny pitches we were playing on, baseball skills might have been more useful [smile].

Plus in the case of my two Canadian pals it's "talent on your brother and sister's side". Although I wouldn't put it like that since the two of them are engaged and implying that they are related is kind of icky.

Quote:
Do you wanna use PI? I released the v1.0 alpha of it not too long ago, and I'm reasonably pleased with the 2D capabilities (although I'm still pretty cranky about the 2D actor class).

I'm close enough that you can IM me and drunkenly bitch at me, but it's been used in quite a few games.

I'd love to have a look at your current version of Propane Injector. I'm still inclined to roll my own 2D engine because I want the experience and I feel I've already got most of the hard work done, but I'd like to have a few backup options in case this drags out longer than it should.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!