Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Feb 2014
Offline Last Active Sep 12 2014 12:34 PM

#5164129 How to transition into Game Dev with Java

Posted by on 01 July 2014 - 03:44 PM

Hi guys,


I've been working in Java for a little while now (after learning some Python and C++) and I'm feeling more comfortable with Java syntax more than the other languages so far.


I'm looking for a resource that will help me to better understand (in-depth) how to actually render terrain and models, and at some point help me understand the process of doing this with a client/server connection.  I find some decent articles and reading out there, but these things still confuse me.


I realize that it's a bit advanced, but it is something I could work towards as a hobby.  I'd love to create a multiplayer game similar to Ultima Online.  But if I could figure out how to render a map like that (isometric and terrain/tiles?) and have it work as a multiplayer game I'd be extremely happy.  Did UO use a heightmap, large bitmap, or just render a huge map of small tiles right next to each other?


Also, would you guys suggest trying the jmonkeyengine?


Lastly, this might be a dumb question but how is gear rendered both on a player, and in a paperdoll with the ability to die a section of armor?  Graphics programming seems extremely difficult.


What would you guys suggest as a decent resource for transitioning from basic Java to understanding some graphics and server/client programming?



#5134267 Python (pygame) Slow Blit?

Posted by on 24 February 2014 - 06:11 PM

Wow.  That was exactly it.  I'm not even sure what I was thinking now... Thank you for pointing that out though.  Apologies.

#5134254 Python (pygame) Slow Blit?

Posted by on 24 February 2014 - 05:38 PM

Hello Everyone, 


This is my first post here, but I plan on spending a lot of time here trying to learn (and help others).


I've dabbled in c++ off and on for the last few years, but I found myself struggling to find a project that wasn't too challenging (or too easy) and I stepped away for a bit.


Recently, I started teaching myself a bit about Python.  Apparently, it's a simpler language (that can do a lot) and I figure I'll give it a shot, maybe I can accomplish something.  So I set out the other day and now I'm here...


I've attempted to render a background image (or terrain) with another image on top that can move to the location of a mouse click.  I'm having trouble understanding why the image won't move precisely when I click, every time. For instance, if I click in quick succession, the image may only change locations once every second or more.


I have a feeling like it has something to do with constantly having to redraw the images, perhaps slowing it down?  If that's the case, I wouldn't understand why because I thought that the game loop would iterate many times a second.... Or maybe my loop isn't working right?  Can I just "move" an image instead of the constant "blit-ing"?  If not, then this kind of concerns me with what I plan on doing in the future.  (When I click a point on the terrain, I want to move, or walk, the image to that point).


Obviously, this is a very simple task, especially for some of you, but I can't really tell if it's a problem with the way I'm coding it or if it's really how slow python/pygame is?


Here is the code:

import sys, pygame


BLACK = (0, 0, 0)

screen = pygame.display.set_mode([SCREEN_WIDTH, SCREEN_HEIGHT])

#set cursor here somewhere

terrain = pygame.image.load("terrain.jpg")
terrainRect = terrain.get_rect()
terrain = pygame.transform.scale(terrain, (SCREEN_WIDTH, SCREEN_HEIGHT))
screen.blit(terrain, terrainRect)

oPC = pygame.image.load("amishdude.png")
oPC = pygame.transform.scale(oPC, (75, 75))                                     
oPCrect = oPC.get_rect()
screen.blit(oPC, oPCrect)


running = True #initialize the main game loop

while running == True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False #break loop and close 

    for event in pygame.event.get():
        if event.type == pygame.MOUSEBUTTONDOWN:
                mouseRect = pygame.mouse.get_pos()              
                screen.blit(terrain, terrainRect)
                screen.blit(oPC, mouseRect)