🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Untitled

posted in DruinkJournal
Published July 07, 2006
Advertisement
The DDS (DirectDraw Surface) format is nice and the texture tool is really nice too. I never knew how simple it was to do something as simple as adding an alpha channel to a texture. You can do that in litterally 3 clicks of the mouse.

Anyway, what have I done today. Work, obviously, but I'll get raped if I talk about that. There's some stuff I can talk about though. The Nintendo DS cartridges we have are 4 kilo-bit. I thought "Oh, that's fine." But wait, 4 kilo-bit is 512 bytes. Hmm.
We have to store around 210 bytes of data for or racing game, and that's just for the players progress, not for replays. I've already been bit-stuffing my ass off for 2 days over this. Anyway, Fudgepacker to the rescue. Our engine half-has support for zlib (It can read but not write as far as I know), and so does fudgepacker. So I wrote a utility during my lunch break (took 10 mins) to take a bunch of hex digits from our debug spew (That I coded to represent our replay data) and convert that to binary data. That data then represents what would be stored on the cartridge (The DS devkit can't write to a file on the PC as far as I know, so the debug output is the best PC-savable-output I have). One of the nice things about fudgepacker is it tells you the actual size of the file it compressed, which doesn't include the header to let you unpack the file. If you just want to compress an arbitrary chunk of data you only need to store the compressed data itself and the uncompressed length (zlib may let you just keep appending, but that's ugly and horrible).
Anyway, the point in this, is it lets me see what size the data would be if it was compressed. The results: 192 bytes of replay data compressed to 78% original size normally. After fucking about with the data (Re-ordering bytes, essentially), it now manages 34%. Which isn't half bad. But it's still only enough to semi-reliably store the game state + 1 replay on the cartridge. Let's just hope we get more than a 4KB cartidge (I don't know or care if that's supposed to be a lower-case 'b', you know what I mean).

In other news, the code for my MMORPG client is comming along nicely. The "engine" (I say that in quotes because there's no real seperation between the two yet) now supports three primitive types:
  • Sprites
  • Alpha blended sprites
  • Background tilemaps
    The tilemaps are implemented as before, using tile sheets and all that crap. I'm halway through writing another version of that object that uses ID3DXSprite's for rendering, but passing the tile sheet crap off to a manager class (Which will be handy in other places anyway), so I'll profile to see which is better. By "Profile", I mean throw a bunch of them onscreen and see which gives a higher FPS. "Accurate and sophisticated" is my middle name(s). I want to support layered maps, so I can do paralax scrolling. Because it's cool and retro.

    Two main classes I need to do next are the sound manager (The code was converted / cleaned up slightly, and still works, but could be better) and input manager (Which will practically have sex with my window class to extract vital information [WM_KEYDOWN / WM_KEYUP messages] from it). Once they're done, I'm a happy Steve.

    And just to brighten this up a little, a screenshot of the code in it's current state, along with the full code for this state:
    Zomg pictarz
    //==========================================================================// SplashScreen.cpp - Splash screen state//==========================================================================#include "SplashScreen.h"#include "Scene/Scene.h"#include "Scene/Objects/Sprite.h"#include "Scene/Objects/AlphaSprite.h"#include "Scene/Objects/Map.h"#include "Common/Assert.h"CSplashScreen::CSplashScreen() : CBaseState(STATE_SplashScreen){}CSplashScreen::~CSplashScreen(){}void CSplashScreen::Enter(){	m_pSprite = new SOSprite("Admiral Spritey", "Data/Test/Alpha.dds");	Assert(m_pSprite);	m_pSprite->SetPriority(0);	CScene::Get().Add(m_pSprite);	m_pMap = new SOMap("Zomg, map!", "Data/Maps/Map0000.map");	Assert(m_pMap);	m_pMap->SetPriority(10);	CScene::Get().Add(m_pMap);	m_pSprite2 = new SOSprite("Admiral Spritey II", "Data/Test/Alpha.dds");	Assert(m_pSprite2);	m_pSprite2->SetPriority(10);	m_pSprite2->SetX(32);	CScene::Get().Add(m_pSprite2);	m_pAlphaSprite = new SOAlphaSprite("Captain Alpha", "Data/Test/Alpha.dds");	Assert(m_pAlphaSprite);	m_pAlphaSprite->SetPriority(100);	m_pAlphaSprite->SetX(64);	m_pAlphaSprite->SetY(32);	CScene::Get().Add(m_pAlphaSprite);	m_pAlphaSprite2 = new SOAlphaSprite("Captain Alpha II", "Data/Test/Alpha.dds");	Assert(m_pAlphaSprite2);	m_pAlphaSprite2->SetPriority(800);	m_pAlphaSprite2->SetX(128);	m_pAlphaSprite2->SetY(128);	CScene::Get().Add(m_pAlphaSprite2);}void CSplashScreen::Tick(){}void CSplashScreen::Exit(){	CScene::Get().Remove(m_pSprite);	delete m_pSprite;	m_pSprite = NULL;	CScene::Get().Remove(m_pSprite2);	delete m_pSprite2;	m_pSprite2 = NULL;	CScene::Get().Remove(m_pAlphaSprite);	delete m_pAlphaSprite;	m_pAlphaSprite = NULL;	CScene::Get().Remove(m_pAlphaSprite2);	delete m_pAlphaSprite2;	m_pAlphaSprite2 = NULL;	CScene::Get().Remove(m_pMap);	delete m_pMap;	m_pMap = NULL;}

    Ok, bed for me I think...
  • Previous Entry Untitled
    Next Entry Untitled
    0 likes 2 comments

    Comments

    Ravuya
    Quote: I've already been bit-stuffing my ass
    July 07, 2006 06:29 PM
    Evil Steve
    I'm really very drunk, and I just remembered this: IWant shitty ship-music style stuff to be playable. Like original Sega stuff. It'll be AMAZING!

    I molested a class 1 laser product tonight. +(5/10/whatever is maximum) points to those who know what I'm talking about. Also, some remind me to declare a winner for my "My cat is in the shitting printer" competition.

    I R BED
    July 08, 2006 10:52 PM
    You must log in to join the conversation.
    Don't have a GameDev.net account? Sign up!
    Advertisement
    Advertisement