Results 1 to 9 of 9

Thread: Soft :: A software rendering engine

  1. #1

    Soft :: A software rendering engine

    I've created a simple software rendering engine for my own purposes, and it seems like a good time to release a beta version of it. This is basically a single unit that provides a double buffered panel, sprite management, and easy drawing functions.

    I've only tested this on Lazarus/FPC, but it should work just fine with Delphi (Should. I don't have Delphi, sorry). By default, I only included PNG/BMP images allowed to be loaded by the engine itself, so if you're on delphi without PNG support, make sure you change the Soft unit.

    I have included a simple Lazarus project to show the basics of how the engine works. Basically, you load sprites, the Soft engine creates an object, and it returns an integer. You can access the object array of sprites directly, of course (just like with the canvas, etc.)

    I designed this engine for extreme ease of use, in my opinion. You tell the engine to create sprites, all you have to keep track of is integers. The engine handles collisions (currently bounding box only) and provides a few methods you can override to your liking (The drawing and "step" functions). The step functions of all objects are called before the object is drawn, so you can perform movement calculations and have the latest update drawn.

    As I'm still a novice, I've got a little list here:
    Todo (what I can do):
    • Particle system (would be quite basic)
    • Depth
    • Make 'File format not supported' more specific
    • Change gravity and x/yspeed to use deltatime
    • Mouse handling


    Need help on:
    • Dirty rectangles (where only the part of the screen that has changed is redrawn)
    • Transparent BMPs
    • Terminating application from Soft unit
    • Opacity
    • Full Screen
    • Text drawing (On Windows Vista, this was a rectangle. Linux, this seemed fine.)
    • Freeing resources


    If you'd be so kind as to help, I'd be quite grateful
    ** As noted in the todo, deltatime is not yet used, so if a machine is running at a different FPS, the game will play slower/faster. I added a way to set the FPS, but this, of course, does not guarantee the FPS will stay constant.

    The Soft engine should take care of everything in terms of creating an environment to draw on. If you look at the uses clause of the unit, you'll see a description of why certain units are needed. Currently, the engine creates a TPanel on whatever parent is passed to it, and it creates a timer as well and bitmap for double buffering. I could have probably made it so that it would access the parent's canvas directly (assuming there was one), but this method seems to be rather failsafe.

    License: BSD
    (Sorry, no screenshots. It's a 10kb download, so I hope you'll still try it )
    Tested on Ubuntu 9.04 and Windows Vista. (Should work on all other versions of Windows, distros of Linux, and Mac OS)
    Download:
    Mirror 1
    Mirror 2

    PS: I've yet to create a game with my own framework. I'd like to improve the collisions, get transparent BMPs, opacity, and text to work properly before I attempt to create anything with it.

  2. #2

    Re: Soft :: A software rendering engine

    I'm interested, but can you provide us with an EXE? I don't have Lazarus to compile it.

  3. #3

    Re: Soft :: A software rendering engine

    Quote Originally Posted by Brainer
    I'm interested, but can you provide us with an EXE? I don't have Lazarus to compile it.
    Hi a few things. First, the demo is currently relatively unimpressive, consisting of no more than a ball that you can control with the arrow keys, and run into a block to reset the ball's position.

    Second, you don't *need* Lazarus (or at least, I hope you don't!) All of the example's code can be found in unit1 (I don't know why there's a unit2, but it's empty). All you really need to get started with Soft is to create a blank application (with a form) and include the Soft unit. After you verify that the Soft unit and your application will compile happily, you should be able to pop open unit1.pas again and look through the example to see how it works. For the most part, I think you'd be able to copy and paste the code.

    But if you still want an EXE demo, that's something I can provide. (Also, if you have any simple ideas for what I should make the default example (or an example), I'd like to hear them.) More or less, this is only a means to create the drawing environment for you. All other code, such as game logic, will have to be handled by you.

  4. #4

    Re: Soft :: A software rendering engine

    Quote Originally Posted by dazappa
    As I'm still a novice, I've got a little list here:
    Todo (what I can do):
    Particle system (would be quite basic)
    Depth
    Make 'File format not supported' more specific
    Change gravity and x/yspeed to use deltatime
    Mouse handling

    Need help on:
    Dirty rectangles (where only the part of the screen that has changed is redrawn)
    Transparent BMPs
    Terminating application from Soft unit
    Opacity
    Full Screen
    Text drawing (On Windows Vista, this was a rectangle. Linux, this seemed fine.)
    Freeing resources
    Hi there, nice project. However I wonder, why wouldn't you use SDL and extend it to your needs since it includes most of the features you have to "todo" or need help on. Probably there are good reasons for you not to use SDL, still curious though .

  5. #5

    Re: Soft :: A software rendering engine

    Nice work!

    I understand that he's not using any existing library like SDL. Doing everything yourself is a great learning experience, though I wouldn't use the code very any serious game projects.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  6. #6
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    Hows this little project coming along? You didn't happen to make any videos of it running did you?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  7. #7
    *Sigh* Darn thing just ate the post I was going to write.

    Anyway, development has mostly stopped as there's not much else to be added, and text on Windows will most likely never be implemented correctly. You seem to have to draw with both a background and foreground color when drawing text on Windows, and if the background is transparent it just becomes a solid rectangle.

    I never made a video either, as there was never much to show. This unit is most useful for platforms which support Laz & FPC but not SDL, as it provides an easy way to get up and running with little dependencies.

    edit:
    This may also be of use for any newbies wondering about the basic concepts of game programming, like what exactly double buffering is.
    Last edited by dazappa; 03-10-2010 at 08:45 PM.

  8. #8
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    If you need text and etc I can post up some simple procedures and functions I wrote a while back. Although they're built for sdl and fpc, I don't see too many issues getting them to work with OpenGl and Lazarus. Also, I would be quite interested in some of the features of your project for the Prometheus project I am currently working on if that would be alright.

    cheers,
    code_glitch
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  9. #9
    The goal is to rely on as few external dependencies as possible (hence why no SDL), and Soft is meant to be a software rendering engine, utilizing OGL would make it a hardware rendering engine As is posted in the first post, the license for this is BSD, so if you think you can pull anything useful from it you can use it as long as the license is compatible with Prometheus'. (And to be honest, I doubt there would be anything worth while )

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •