shortymant
_+Bow Down+_
- 16
- Posts
- 15
- Years
- United States
- Seen Dec 3, 2011
Hello, some may remember me. Me and a group of friends started a new engine for Pokemon a while back, but it got discontinued due to life complications for all of us. Well, things have slowed down for me and I started a new one a few days ago. I am making this thread to see what the regular users here would think of it (ie; worthless because of <reason> or great because of <reason>, etc.).
I will post very little information about the "inner workings" of the actual engine and game because I like to frequently go back and make it better (as I'm planning on with the maps... again :P), but however, will share what I am aiming for and how certain things will work.
(See attachment or remove spaces from this link : i41.tinypic . com/nlv6kp.png )
Basic map specifications
==The PokeMapFile (.PMF)==
~Header~
char nVersion ---------------------- Version of the map file
short nHeader ---------------------- 0x31 is decrypted, 0x39 is encrypted
char szName[64] -------------------- Name of the map
unsigned short nHeaderSize --------- Size of header (sizeof(RWorldStruct) + 2)
unsigned long nMapDataSize --------- Size of map data
unsigned long nMapAssetsSize ------- Size of map assets data
unsigned short nChecksum ----------- Checksum of the map
unsigned int nNumOfTiles ----------- Number of tiles total
unsigned int nNumOfLights ---------- Number of lights total
unsigned int nNumOfObjects --------- Number of objects total
unsigned int nNumOfEvents ---------- Number of events total
bool bRains ------------------------ If it allows to rain
bool bNightTime -------------------- If it allows to go to night
bool bDayTime ---------------------- If it allows to go to day time
~End Header~
~Map Assets~
unsigned int nTileID
<unsigned short nImgSize>
<.JPG Data>
~End Map Assets~
~Map Data~
unsigned int nTileID;
int nType;
<<Depends on TileID>>
~End Map Data~
Since it would be a complete ***** to create a new system, all the tiles used in the map, are in the actual map
binary. No big deal since most are less than 1KB. Note that the tiles are actually stripped from the tilesheet and
placed in the map, not the entire tilesheet. Also, there is no encryption for map's. At least, not yet.
Here's some source. ;)
bool RWorld::Read( const char* szFileName )
{
ZeroMemory( m_pWorldInfo, sizeof(RWorldInfo) );
if( m_pMapData )
{
delete m_pMapData;
m_pMapData = NULL;
}
m_bDestroyed = false;
RFile* pFile = new RFile();
if( !pFile->Open( szFileName, RFOT_READBINARY ) )
{
CLog_Write( "Error opening map file (%s)\n", szFileName );
return false;
}
long nSize = pFile->SetupFileData();
m_pMapData = (void*)malloc( nSize + 1 );
memcpy( m_pMapData, pFile->GetBuffer(), nSize );
//
//Read Map Header
m_pWorldInfo->nVersion = pFile->ReadChar();
m_pWorldInfo->nHeader = pFile->ReadShort();
strcpy( m_pWorldInfo->szName, pFile->ReadString(32) );
m_pWorldInfo->nHeaderSize = pFile->ReadUShort();
m_pWorldInfo->nMapDataSize = pFile->ReadULong();
m_pWorldInfo->nMapAssetSize = pFile->ReadULong();
m_pWorldInfo->nChecksum = pFile->ReadUShort();
m_pWorldInfo->nNumOfTiles = pFile->ReadUInt();
m_pWorldInfo->nNumOfLights = pFile->ReadUShort();
m_pWorldInfo->nNumOfObjects = pFile->ReadUInt();
m_pWorldInfo->nNumOfEvents = pFile->ReadUShort();
m_pWorldInfo->nSizeX = pFile->ReadInt();
m_pWorldInfo->nSizeY = pFile->ReadInt();
m_pWorldInfo->bRains = pFile->ReadChar() == 1 ? true : false;
m_pWorldInfo->bNight = pFile->ReadChar() == 1 ? true : false;
m_pWorldInfo->bDay = pFile->ReadChar() == 1 ? true : false;
unsigned short nMapHdrCurrSize = m_pWorldInfo->nHeaderSize;
if( nMapHdrCurrSize != sizeof(RWorldInfo) || m_pWorldInfo->nChecksum != RCreateMapChecksum( m_pWorldInfo ) )
{
CLog_Write( "Invalid map (%s)\n", szFileName );
return false;
}
pFile->Skip( 10 );
//
//Map Assets
for( unsigned int i = 0; i < m_pWorldInfo->nMapAssetSize; i++ )
{
RWorldAsset* pAsset = new RWorldAsset();
pAsset->nID = pFile->ReadUInt();
pAsset->nSize = pFile->ReadUShort();
pAsset->pBuff = pFile->ReadBlob( nSize );
if( FAILED( D3DXCreateTextureFromFileInMemory( RMain::GetInstance()->GetDXDevice(), &pAsset->pBuff, nSize, &pAsset->pTex ) ) )
CLog_Write( "Error reading asset from map (%s)\n", szFileName );
else
m_Assets.push_back( pAsset );
}
pFile->Skip( 10 );
//
//Map Data
for( unsigned int i = 0; i < m_pWorldInfo->nMapDataSize; i++ )
{
}
return true;
}
Current status:
-Basic window initialization
-Basic DirectX initialization
-90% of the map parsing done
-60% of the RSprite/RSpriteMgr and RWorld/RWorldMgr classes done
-Able to create a window, parse XML files and load a (very, very) basic map
Basic idea of what will be implemented:
-Multiplayer (using IOCP for networking, P2P for some and MySQL for database)
-Starting point that consists of logging in, create/customize player and roaming around
-Basic usable state (as in, PokeCenter/Shop, battle, inventory, etc.)
-Fog and lighting enabled for maps
-Quick and easy editing due to XML support
Things I'm still debating on:
-LUA support
-Single Player
Open Source? Of course. Estimated time to complete the engine would be about another 1 - 3 weeks. However, I still have most of my old Pokemon game sources so the actual game shouldn't take too long.
Any who, thoughts? Suggestions?
I will post very little information about the "inner workings" of the actual engine and game because I like to frequently go back and make it better (as I'm planning on with the maps... again :P), but however, will share what I am aiming for and how certain things will work.
(See attachment or remove spaces from this link : i41.tinypic . com/nlv6kp.png )
Basic map specifications
Spoiler:
==The PokeMapFile (.PMF)==
~Header~
char nVersion ---------------------- Version of the map file
short nHeader ---------------------- 0x31 is decrypted, 0x39 is encrypted
char szName[64] -------------------- Name of the map
unsigned short nHeaderSize --------- Size of header (sizeof(RWorldStruct) + 2)
unsigned long nMapDataSize --------- Size of map data
unsigned long nMapAssetsSize ------- Size of map assets data
unsigned short nChecksum ----------- Checksum of the map
unsigned int nNumOfTiles ----------- Number of tiles total
unsigned int nNumOfLights ---------- Number of lights total
unsigned int nNumOfObjects --------- Number of objects total
unsigned int nNumOfEvents ---------- Number of events total
bool bRains ------------------------ If it allows to rain
bool bNightTime -------------------- If it allows to go to night
bool bDayTime ---------------------- If it allows to go to day time
~End Header~
~Map Assets~
unsigned int nTileID
<unsigned short nImgSize>
<.JPG Data>
~End Map Assets~
~Map Data~
unsigned int nTileID;
int nType;
<<Depends on TileID>>
~End Map Data~
Since it would be a complete ***** to create a new system, all the tiles used in the map, are in the actual map
binary. No big deal since most are less than 1KB. Note that the tiles are actually stripped from the tilesheet and
placed in the map, not the entire tilesheet. Also, there is no encryption for map's. At least, not yet.
Here's some source. ;)
Spoiler:
bool RWorld::Read( const char* szFileName )
{
ZeroMemory( m_pWorldInfo, sizeof(RWorldInfo) );
if( m_pMapData )
{
delete m_pMapData;
m_pMapData = NULL;
}
m_bDestroyed = false;
RFile* pFile = new RFile();
if( !pFile->Open( szFileName, RFOT_READBINARY ) )
{
CLog_Write( "Error opening map file (%s)\n", szFileName );
return false;
}
long nSize = pFile->SetupFileData();
m_pMapData = (void*)malloc( nSize + 1 );
memcpy( m_pMapData, pFile->GetBuffer(), nSize );
//
//Read Map Header
m_pWorldInfo->nVersion = pFile->ReadChar();
m_pWorldInfo->nHeader = pFile->ReadShort();
strcpy( m_pWorldInfo->szName, pFile->ReadString(32) );
m_pWorldInfo->nHeaderSize = pFile->ReadUShort();
m_pWorldInfo->nMapDataSize = pFile->ReadULong();
m_pWorldInfo->nMapAssetSize = pFile->ReadULong();
m_pWorldInfo->nChecksum = pFile->ReadUShort();
m_pWorldInfo->nNumOfTiles = pFile->ReadUInt();
m_pWorldInfo->nNumOfLights = pFile->ReadUShort();
m_pWorldInfo->nNumOfObjects = pFile->ReadUInt();
m_pWorldInfo->nNumOfEvents = pFile->ReadUShort();
m_pWorldInfo->nSizeX = pFile->ReadInt();
m_pWorldInfo->nSizeY = pFile->ReadInt();
m_pWorldInfo->bRains = pFile->ReadChar() == 1 ? true : false;
m_pWorldInfo->bNight = pFile->ReadChar() == 1 ? true : false;
m_pWorldInfo->bDay = pFile->ReadChar() == 1 ? true : false;
unsigned short nMapHdrCurrSize = m_pWorldInfo->nHeaderSize;
if( nMapHdrCurrSize != sizeof(RWorldInfo) || m_pWorldInfo->nChecksum != RCreateMapChecksum( m_pWorldInfo ) )
{
CLog_Write( "Invalid map (%s)\n", szFileName );
return false;
}
pFile->Skip( 10 );
//
//Map Assets
for( unsigned int i = 0; i < m_pWorldInfo->nMapAssetSize; i++ )
{
RWorldAsset* pAsset = new RWorldAsset();
pAsset->nID = pFile->ReadUInt();
pAsset->nSize = pFile->ReadUShort();
pAsset->pBuff = pFile->ReadBlob( nSize );
if( FAILED( D3DXCreateTextureFromFileInMemory( RMain::GetInstance()->GetDXDevice(), &pAsset->pBuff, nSize, &pAsset->pTex ) ) )
CLog_Write( "Error reading asset from map (%s)\n", szFileName );
else
m_Assets.push_back( pAsset );
}
pFile->Skip( 10 );
//
//Map Data
for( unsigned int i = 0; i < m_pWorldInfo->nMapDataSize; i++ )
{
}
return true;
}
Current status:
Spoiler:
-Basic window initialization
-Basic DirectX initialization
-90% of the map parsing done
-60% of the RSprite/RSpriteMgr and RWorld/RWorldMgr classes done
-Able to create a window, parse XML files and load a (very, very) basic map
Basic idea of what will be implemented:
Spoiler:
-Multiplayer (using IOCP for networking, P2P for some and MySQL for database)
-Starting point that consists of logging in, create/customize player and roaming around
-Basic usable state (as in, PokeCenter/Shop, battle, inventory, etc.)
-Fog and lighting enabled for maps
-Quick and easy editing due to XML support
Things I'm still debating on:
Spoiler:
-LUA support
-Single Player
Open Source? Of course. Estimated time to complete the engine would be about another 1 - 3 weeks. However, I still have most of my old Pokemon game sources so the actual game shouldn't take too long.
Any who, thoughts? Suggestions?