Jump to content

  • Log In with Google      Sign In   
  • Create Account

VanillaSnake

Member Since 27 Mar 2006
Offline Last Active Jul 17 2016 12:47 PM

#5294053 How to set a namespace properly in this case?

Posted by VanillaSnake on 29 May 2016 - 10:04 AM

I changed the structure of my framework a little, but I would like to use namespaces instead of swapping files. How can I do that?

Current Structure:

 

WindowsMain.h

   --Declares loop functions GameMain, GameUpdate etc

 

NameOfGame.cpp

  ---includes WindowsMain.h

  --Defines the above functions

 

So I want to do something like this

 

WindowsMain.h

--- using  namespace NameOfGame

 

NameOfGame.cpp

---- namespace NameOfGame { ... }

 

That way I can have multiple games in the same project and just switch the namespace when I want to work on one or the other, as right now I have to pretty much exclude any other game from the project otherwise I get a collision. 

By the way when I do the above, I get an error "namespace undefined" even when I create a NameOfGame.h and define the namespace there and then include that file into WindowsMain.h




#5270831 Weird access violation when copying data

Posted by VanillaSnake on 13 January 2016 - 04:20 AM

I actually did read what you posted, there is a "history" button you can use to see... but whatever, keep making assumptions. I'm exiting this thread now.

oh good, then you can see why I deleted it, how many people you'd think it'd help?




#5270810 Weird access violation when copying data

Posted by VanillaSnake on 13 January 2016 - 02:07 AM

 

  I'm trying to resize a bitmap for my 2d engine, however I keep getting an access violation at random points while I'm iterating through the bitmap. I really don't know what can be causing it. It comes up at random row/column and offset, can someone just look over my code and see what's wrong? 

 

void ResizeBitmap(BITMAP_FILE* out, BITMAP_FILE* original, RECT resizeRectangle){//only works for 32 bit bitmaps for nowif (original->infoHeader.biBitCount != 32)return;int newXDimension = resizeRectangle.right - resizeRectangle.left;int newYDimension = resizeRectangle.bottom - resizeRectangle.top;int newDataSize = (original->infoHeader.biBitCount / 8) * newXDimension * newYDimension;//layout of bmp//file header//dib header (info header)//data//first create a new file header//everything is the same as the old bitmap except the file sizeBITMAPFILEHEADER newFH = original->fileHeader;newFH.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + newFH.bfOffBits + newDataSize;//create a new info headerBITMAPINFOHEADER newIH = original->infoHeader;newIH.biHeight = newYDimension;newIH.biWidth = newXDimension;newIH.biSizeImage = newDataSize;//allocate the data (this is only for 32 bit bitmap)DWORD* newData = (DWORD*) new DWORD[newXDimension * newYDimension];//calculate the resize ratio in x dimensionfloat ratioX = float(newXDimension) / original->infoHeader.biWidth;float ratioY = float(newYDimension) / original->infoHeader.biHeight;DWORD* newDataOffset = newData;DWORD* origDataOffset = (DWORD*) original->data;//iterate throught the original bitmap and write to the new onefor (int row = 0; row < original->infoHeader.biHeight; row++){for (int column = 0; column < original->infoHeader.biWidth; column++){int destinationPixel = int(ratioX * column - 0.5f);newDataOffset[destinationPixel] = origDataOffset[column];}newDataOffset += newXDimension;origDataOffset += original->infoHeader.biWidth;}//copy everything back to the output bitmapout->fileHeader = newFH;out->infoHeader = newIH;out->data = (unsigned char*) newData;}

sorry what's the right code tag, this one didn't indent for some reason?




#5253545 Dealing with D3DX____ functions being depricated.

Posted by VanillaSnake on 22 September 2015 - 04:51 PM

@imoogiBG I have the June '10 SDK on my other partition and right now the code works and compiles because I'm still using it, but I'd like to upgrade it. I'm downloading the github fx11 project now I think it's the same one you mentiontined but updated.

 

@MJP so if I compile the fx11 from github I would have to completely dump it once I move to DX12?

 

Also why is there so little info on DX12 programming, RasterTalk has 3 tutorials, last one created yesterday and then there's the Programming Guide from Microsoft, but has no reference code at all? DX12 is what about a year old now? I mean it was released to developers a while ago right since the games are bout to start coming out this or next month. It's weird that nobody started any series similar to what Bobby Anguelov did with DX10. There's a book by Frank Luna coming out in Decemeber but I think that guy jumps on on any release headlessly just to make a book.




#5253522 Dealing with D3DX____ functions being depricated.

Posted by VanillaSnake on 22 September 2015 - 03:06 PM

@ryan20fun thanks, I'm aware of that page already, it's been a lifesaver.

 

@cozzie yes, I still have all the old sdks on my other partition so it complited and ran fine, but I really don't want to hang on to old, unsupported code for too much longer. I got my Windows SDK and just want to use that from now on. 

 

So we have to write our own shader system from now on? I do know that DX11 has a github support for DX functions which we can compile, but like I said my main goal right now is to switch to DX12 and DX11 is just a stepping stone. I don't want to go through all the work and then find out it's completely unsupported in DX12. I just can't find any documentation on effects in DX12. It just seems Microsoft is moving DirectX towards high end publishers, soon it's going to be all low-level bare bones code and we'll have to write our own utilities for it. 




#5171348 Are there engines out there made for Minecraft clones?

Posted by VanillaSnake on 03 August 2014 - 11:34 PM

Minecraft looks simple and basic but it actually uses some advanced 3d graphical principles to do even basic things. The way it partitions and stores space is NOT an easy topic to dive into, the basic physics engine is also not that trivial, on top of that you need to have at least understand how textures, transparancies and such work. The other thing is procedural generation, creating biomes, landmasses, oceans and caves requires some hefty algorithms to look even half decent and playable. Then comes enemy AI and pathfinding in a completely generated world (so you can't pre-program the movements). All in all you NEED to know how to code, otherwise it will be a very frustrating task for you. But as not to be a complete downer, if you really do want to jump into it as quickly as possible and are willing to learn how to code, I would start of with an existing minecraft like game that has it's source code in public domain. So you will have a working game without putting anything into it, and you will be able to add things to your liking. Starting with a game engine even with the ultra beginner friendly Unity will still take A LOT of effort to get anything at all. So I wouldn't suggest that as you will most likely be diving in deep waters without even knowing how to swim, you'll get overwhelmed and abandon the project in a week (at most).




#5169058 Game Engine that will meet my requirements

Posted by VanillaSnake on 25 July 2014 - 01:12 AM

I think you're underestimating the time requirement of learning to code which learning how to build a game, in addition to creating art for it. I think you should start with Flash, javascript is pretty easy to learn and it is more or less a graphical tool, where you can "draw" your game and start moving right away. You can post it up on newgrounds after you finish and anyone will be able to play it. It might require you to learn some html in the process as well, which is extremely easy, and this foundation of javascipt/html will be more useful then C# and C++, as most games nowdays are leaning towards browser gaming, so you'll be gaining valuable experience as a web developer if you want to persue this professionally.




PARTNERS