Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


GameCreator

Member Since 23 Apr 2001
Offline Last Active Private

Topics I've Started

Void Pointers - Traversing and Copying

29 December 2014 - 12:39 PM

Hello, I need a little help with void pointers.  Say I read a packet into this:

 

void *packet = malloc( msgSize );

 

I'll know from how I sent it that the first integer will be a packet ID.  From that ID, I'll know what I can do with it.

 

The main thing I'll need is to copy it to a struct but i don't know how to do that with memcpy.  There will be different sized structs for player, enemy, projectile but a simple example should help.

 

Also, how can I "traverse" the memory to look for something, assuming there are different sized data in the packet.  For example, if I know that the first item is an int, then a char, then another int, then float, etc., how do I get the value of the float?  I assume this involves the use of sizeof but I'm not good with pointers.  Then I read that sometimes structures are padded so maybe this is impossible - though I'll have the structure declarations I sent (if that makes sense) so maybe I could use that to determine how many bytes in the float starts.

 

Thanks for reading and any help.


Base Class Undefined

07 September 2014 - 10:43 AM

I made a few changes to my project and it now has two "bass class undefined" errors (for the same class, in the attached picture).  I believe, from researching this online, that the problem is that I have circular references.  However, I don't know how to remove it.  To start, I would need to know what order my project is compiled in.  Is there a file list that Visual Studio provides?  I'm pretty sure it all starts at App.cpp, then App.h but then what's the next file?  How does VS choose which CPP file comes next?  Is it alphabetical?  If there are 3 header files in a file, will it immediately do all of those headers next?  I only have one header in each CPP file (the H file by the same name) but the headers may have 2 or 3.

 

Here's a screenshot of my project with the problematic class showing.

 

Attached File  screen.gif   25.74KB   0 downloads

 

Thank you for any help!

 

(By the way, I read that in other situations forward declaration is the way to go but that it doesn't work with base classes.)

 


Please Suggest An Android Game Engine

27 March 2014 - 12:39 PM

I'm looking for an Android game engine that has three things:

  • Ability to code for Android in C or C++
  • API to get user's location
  • Send and receive data to/from a server (it would need to store small bits of information, like said location)

(Being a game engine, it should be a given that it handles graphics/music/sound/interaction easily.  I don't need anything fancy like physics/navigation/taking over the world/etc.)

 

That's it.  Paying for it is not out of the question but I'd rather not pay monthly.

 

Could anyone suggest an engine like this?

 

Thanks!!


Weird (But Simple?) Angle Math

08 January 2014 - 05:07 PM

I'm not quite sure why but the engine I'm using is returning odd angles for which direction an entity is facing.  It looks like this:

 

circle.jpg

 

Now, I'd like to turn the entity from its current angle, X, to a given angle, Y but only using the fastest way possible.  If it's facing 90 degrees and the target is 100 degrees, it should use the smaller 10 degree turn, not the 350 one.

 

Does anyone have any C code or pseudo code or even just general tips they can give me to easily achieve this using the above angle system?

 

Thanks!


Patcher

06 October 2013 - 11:40 AM

My question is a basic one: how do patchers work?

 

My understanding so far is that the EXE is only the patcher / launcher.  When it's run, it checks the files against a website or server to see if they match (I will be using libcurl).  If they don't, it updates them.  Then, when you hit Play, it runs the actual game DLL which plays the game.

 

First, is this the correct idea?

Second, in Windows (I use Leadwerks and Visual Studio Express), what's the command to launch the DLL?

Finally, how do you update the launcher itself?  Does that game do that once the launcher quits?  Or does the updater launch another updater DLL?  I guess it doesn't matter which but what's the "right" way to do it?

 

Thanks!


PARTNERS