Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 Jul 2005
Offline Last Active Jul 14 2016 07:50 PM

Posts I've Made

In Topic: Resource cache for game engine

01 September 2015 - 10:54 PM

I use XML data definitions for a lot of the content in my project.


In effect, my data didn't specifically represent game object instances, but rather Meta classes to represent the definition of the object (keys to determine spritesheet or sfx, initial values for different member variables and the like). At the start I load in all my data, which is pretty light. I store these meta objects in a manager class which can, on request, take the data and give me back an instance of the specific object.


The actual instance objects are much lighter and keep only the mutable data and any logic needed (Position, Color, HP, Rotation, that sort of thing). They may also reference the content object that it was sourced from to reduce data duplication.


It appears you're going a similar path but without the separation between instance object and data representation. Don't know if my way is The Best™ or even really better or good, but it seems to work pretty well.

In Topic: I'm desperate. Isometric Mouse Coordinates

06 May 2013 - 01:32 PM

I battled this a LONG LONG time ago back in '08 (took some searching, but here's the thread)
The resolution is below, quoted for proper credit biggrin.png.

its simple really, I'll start from tile--> screen and then see how it goes from screen to tile. Of course you should replace the numbers 64 and 32 by constants for easy change.

tile --> screen
for every tile you go in the X direction you go 64 pixels right and 32 pixels down,
for every tile you go in the Y direction you go 64 pixels left and 32 pixels down,

on screen right=positive x, left=negative x, up=negative y, down = positive y

so we get:
pixel_x = X_LOCATION_OF_TOP_MIDDLE_TILE + 64*tile_x - 64*tile_y
pixel_y = Y_LOCATION_OF_TOP_MIDDLE_TILE + 32*tile_x + 32*tile_y

now to do the screen --> tile
for ease of writing, pixel_x = px, tile_x = tx, X_LOCA... = X0

equation1: px = X0 + 64*(tx-ty)
equation2: py = Y0 + 32*(tx+ty)
we want to find equations for tx and ty when given px and py, so we do some algebra:

eq1+2*eq2 = px+2py = X0+2Y0 + 128*tx
---> tx = (px+2*py -X0-2Y0)/128

eq1-2eq2 = px-2py = X0-2*Y0 -128ty
---> ty = (px-2py - X0+2*Y0) /(-128)

I hope that was clear, and maybe you learned some math from it smile.png

the matrices are just compressed way to do the algebra.

[Edited by - Iftah on December 5, 2008 6:08:28 AM]

In order to get it to work, I had to change the 128's to 64's. It's been forever so I don't remember much of that code, but it should be pretty straight forward.
Hope it helps.

In Topic: Simple MORPG project planning

11 April 2013 - 09:47 AM

Yes, you definitely want to work closely with your client/network programmer(s) on that. If the clients input/physics/animation is not coded with the networking in mind, you're going to have bad times down the road. Building the client and the server each in a vacuum and then "Connecting" them after they're done is... Well, that's probably not the safest approach, we'll say.


Having a log in server to supply an auth ticket is not a problem, but be mindful of how many distinct "Servers" you have. For something small, as you are proposing you probably shouldn't need more than one server application.


I don't see a problem with having the dialogs in the database, but you'll definitely want to keep that stuff cached on the client in some sort of data files so you don't need to stream it constantly.


Your client and server do not need to be written in the same programming language. What's important is that they speak the same "language" over the network. What I mean mostly is your packet structures and protocols (TCP, UDP, HTTP[Probably don't do that], etc...).


Without knowing what sort of data you're storing in your DB, we can make no judgments on it's structure or table counts. So long as it's intelligently designed, and your queries don't have performance issues, you're probably going to be fine. 

In Topic: xna keyboard issues

10 April 2013 - 11:39 AM

As Andy said above, IsKeyDown is what you actually want in that scenario.


If your bullets aren't moving, you're probably not updating their position every frame :)

In Topic: unsure how to make water for my course fishing game for the pc

09 April 2013 - 04:25 PM

I'm not well versed in the 3d side of things, but I have to imagine some sort of plane with some semi-fancy shader magic on it would be one of the simpler paths to take.