Jump to content
  • Advertisement

Zed McJack

Member
  • Content Count

    29
  • Joined

  • Last visited

Community Reputation

349 Neutral

About Zed McJack

  • Rank
    Member

Personal Information

  • Interests
    Design

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Zed McJack

    What to do next

    Thanks Rutin for your leghty answer. I cant say it helped me much but I guess you cant say more without knowing my game making skill levels. When you said you store data localy you mean you use txt files or some other means of storing data, right? But you can use SQLite for the same purpose and it is a file stored localy, but with DB included. On the second thought not all games need data sorted in DB way so I guess its just overhead work for most of simple games, I am a bit caught by the lack of response as my post had more than 400 views, but only one answer, but thats it... My next question might need separate thread in other forums as I am not sure does it belong here or in the Graphics Programing or Visual Arts subforums? Anyway... In the above mentioned game I need to create an 3D or 2D asset that will have hundreds of variations. Lets say its a book so its the same size but with a lot of different titles, front/back cover details different authors ets. Do I create each of these varieties as a separate (I guess not) asset or I have some means to parametrise the look of the asset (book)? Z.
  2. Zed McJack

    What to do next

    Hi guys, I am not new to programming as I am DB programer and I already tried(and succeded) writing Pong games in Python and Unity and a couple of text based games in C++ and C#. This time I tried to bring one of my game ideas closer to reality than it was in previous (unsseccesfull) attempts. I decied to go from really basic things. So I wrote some of my ideas on paper and started coding in my DB language - VFP, so that I can get to the point of having something. Well after two weeks of sporadic coding I finished with what can be called smaller unit of game concept that works. Actions that player can do are buttons and the results are in grids, comboboxes and textboxes. The question is what do I do next? Do I extend what I have in VFP to test more areas of what works or do I move to Unity(thats my choice) and start implementing what I have already done in VFP, but now in game like manner. If you recommend going to Unity, Id like to know how do I get to good (or at least usable) user interface? Another question is related to information that I store in DB. I already have a lot of tables and data in them. What game developers use for storing these data? Thanks Z.
  3. Zed McJack

    [Development] Hooded Development #3

    Well, you are certainly right that writing your thoughts is much better than just thinking. The conversation is even better. Keep going and youll reach the target.
  4. Zed McJack

    [Case] Breakout!

    Its nice to read your thoughts on Breakout, especially considering that I plan to do that next.
  5. Zed McJack

    My first game MyPong, finished at last

    Thanks 1. You are right about paddle speed. I left it as it is now cause I wanted to finish game, it took me too long to actually finish it. Otherwise I could do more improvements. But anyway thanks. 2. Same as above. Its left as is, because of my lack of commitment. 3. You are again right I should move the code, probably to Game class. 4. Heh, At first I thought it was paddle speed and that I made mistake during translation, but its actually wrong variable name even in my language. Thanks man. Well, the game could be improved in many ways, but its good to know what other people think and see. Thanks again.
  6. Zed McJack

    My first game MyPong, finished at last

    Good idea! I should have thought about it myself. Thanks anyway, though I still need more people to look at the code. Well, I thought about starting my game, but decided to try out my hands first at breakout. I did some coding in JavaScript and I code regularly in VFP (database programing), but this is my new vice. Thanks
  7. Ok guys, it lasted more than 2 moths, but at last I finished my first game. It was actually finished month ago but I lost the endurance to sit and split the game in several files. So I did it today and now its here for review. I am not new to programming, but I am new to Python and game development. So I would like to hear whats ok and whats not ok and how to do it right. The game was written in my language and I translated variables, methods and class names to English an hour ago so you might notice some weird expressions. I started to pass object properties that I needed in class methods but switched to passing whole object, so you will see the difference. I am not sure is proper way to do it and is it efficient, but.. The game intentionally does not use sprites and images as I wanted to see is it possible to make this simple game without using images. Thanks PS For some reason I am not allowed to upload files so here is the code. File: MyPong.py# -*- coding: utf-8 -*- import pygame from pygame.locals import * from Pad import Pad from Ball import Ball from Text import Text from Game import Game #Creating instances game = Game() my_pad = Pad(0, 0, 100, 20, [255, 0, 255]) my_pad.rect.topleft = (100,430) ai_pad = Pad(0, 0, 100, 20, [255, 100, 100]) ai_pad.rect.topleft=(0, 30) ball = Ball(10,[0, 100, 50]) text_pause = Text("PAUSE", (255,255,255), None, game.background.get_rect().center, 100) my_result = Text("Player: %s" % my_pad.points, (150,255,0), (0, 0), (50,50), 30) ai_result = Text("AI: %s" % ai_pad.points, (150,255,0), (game.width-50, 0), (50,50), 30) while game.all_ok: game.update(my_pad, ai_pad, ball) if game.pause: if game.game_over: text_pause = Text("GAME OVER - The winner is: %s" % game.winner, (255,255,255), None, game.background.get_rect().center, 50) game.screen.blit(text_pause.text, text_pause.poz) else: my_pad.calculate_position(game.width) ai_pad.calculate_ai(ball.rect.center, game.width) ball.calculate_position(game, my_pad, ai_pad, my_result, ai_result) my_pad.rect.left+=my_pad.movement game.background.fill(game.background_color) game.screen.blit(game.background, game.background_rect) game.screen.blit(my_result.text, my_result.poz) game.screen.blit(ai_result.text, ai_result.poz) game.screen.blit(my_pad.picture, my_pad.rect) game.screen.blit(ai_pad.picture, ai_pad.rect) game.screen.blit(ball.picture, ball.rect) game.clock.tick(game.refresh_rate) pygame.display.flip() File: Pad.py# -*- coding: utf-8 -*- import pygame from pygame.locals import * class Pad(object): def __init__(self, x, y, width, height, color): self.x = x self.y = y self.width = width self.height = height self.ball_speed = 3 self.pad_direction = 0 self.movement = 0 self.points = 0 self.color = color self.picture, self.rect = self.draw_rectangle() def draw_rectangle(self): rectangle = pygame.Rect(self.x, self.y, self.width, self.height) picture = pygame.Surface(( self.width, self.height)) pygame.draw.rect(picture, self.color , rectangle) return picture , picture.get_rect() def calculate_position(self, width): #Calculate pad position if its in the screen if self.rect.left>=0 and self.rect.left+self.rect.width<=width: self.movement = self.ball_speed * self.pad_direction #If ball is out of the left border elif self.rect.left < 0: self.rect.left = 0 self.movement = 0 self.pad_direction = 0 #If ball is out of the right border elif self.rect.left+self.rect.width>width: self.rect.left = width - self.rect.width self.movement = 0 self.pad_direction = 0 def calculate_ai(self, ball_position, width): diff = abs(ball_position[0]-self.rect.center[0]) if self.rect.center[0] > ball_position[0]: if self.rect.left < 0: self.rect.left = 0 else: self.rect.centerx -=3 else: if self.rect.right > width: self.rect.right = width self.rect.centerx +=3 File: Ball.py# -*- coding: utf-8 -*- import pygame from pygame.locals import * from random import randint class Ball(object): def __init__(self, radius, color): self.directionX = -1 self.directionY = -1 self.positionX=randint(100,540) self.positionY=randint(100,380) self.radius = radius self.color = color self.ball_speed = 4 self.picture, self.rect = self.draw_circle(self.radius, self.color) self.picture.set_colorkey((0,0,0)) #Initial positioning is random self.rect.center = self.positionX, self.positionY def draw_circle(self, radius, color): size = radius*2 picture = pygame.Surface((size, size)) pygame.draw.circle(picture, color, (radius, radius), radius) return picture, picture.get_rect() def calculate_position(self, game, my_pad, ai_pad, my_result, ai_result): if not game.goal: if self.rect.top <= 0: my_pad.points +=1 my_result.text = my_result.font.render("Player: %s" % my_pad.points, 1, (150,255,0)) game.goal = 1 elif self.rect.bottom > game.height: game.goal = 1 ai_pad.points +=1 ai_result.text = ai_result.font.render("AI: %s" % ai_pad.points, 1, (150,255,0)) if ai_pad.points == 11 or my_pad.points == 11: if ai_pad.points == 11: game.winner = "AI" else: game.winner = "Player" game.game_over = 1 game.pause = 1 #If the ball is out of the right border, corection and changing the direction X if self.positionX > game.width-self.radius: self.positionX = self.positionX - self.ball_speed self.directionX = -1 #If the ball is out of the left border, corection and direction change if self.positionX < 0+self.radius: self.positionX = self.positionX + self.ball_speed self.directionX = 1 elif self.rect.bottom < 0 or self.rect.top > game.height: game.goal = 0 self.positionX = randint(100,540) self.positionY = randint(100,380) if randint(0,1): self.directionY = 1 else: self.directionY = -1 #updating new position self.positionX += self.ball_speed * self.directionX self.positionY += self.ball_speed * self.directionY self.rect.center = self.positionX, self.positionY File: Text.py# -*- coding: utf-8 -*- import pygame from pygame.locals import * class Text(object): def __init__(self, text, color, position, center, size): self.font = pygame.font.Font(None,size) self.text = text self.color = color self.text = self.font.render(self.text, 1, self.color) self.poz = self.text.get_rect() self.poz.center = center if position <> None: self.poz.topleft = position self.picture = pygame.Surface((self.poz.width, self.poz.height))   File: Game.py  # -*- coding: utf-8 -*- import pygame from pygame.locals import * class Game(object): def __init__(self): pygame.init() self.width, self.height = 640, 480 self.screen_resolution = (self.width, self.height) if pygame.display.mode_ok(self.screen_resolution): self.screen = pygame.display.set_mode(self.screen_resolution) self.refresh_rate = 40 self.clock = pygame.time.Clock() self.pause = 0 self.goal = 0 self.all_ok = 1 self.background_color = [0, 0, 0] self.background = pygame.Surface((self.width, self.height)) self.background_rect = self.background.get_rect() self.game_over = 0 self.winner = "" def update(self, my_pad, ai_pad, ball): keys = pygame.key.get_pressed() if keys[K_LEFT] or keys[K_RIGHT]: if keys[K_LEFT]: my_pad.pad_direction = -1 elif keys[K_RIGHT]: my_pad.pad_direction = 1 else: my_pad.pad_direction = 0 events = pygame.event.get() for event in events: if event.type == QUIT or (event.type == KEYDOWN and event.key in [K_ESCAPE, K_q]): #quiting self.all_ok = 0 elif event.type ==KEYDOWN and event.key == K_SPACE: if self.pause == 0: self.pause =1 else: self.pause = 0 if not self.pause: mylist = (my_pad.rect, ai_pad.rect) colision = ball.rect.collidelist(mylist) if colision == 0: # Ball hit the pad #from above if ball.rect.top < my_pad.rect.top and ball.rect.bottom > my_pad.rect.top: ball.directionY = ball.directionY * -1 ball.positionY = ball.positionY - ball.ball_speed #from side elif ball.rect.top < my_pad.rect.bottom: ball.directionX = ball.directionX * -1 ball.positionX = ball.positionX - ball.ball_speed elif colision == 1: if ball.rect.top <= ai_pad.rect.bottom: ball.directionY = ball.directionY * -1 ball.positionY = ball.positionY + ball.ball_speed
  8. Zed McJack

    How to create and work with not tile based map?

    Uh, I am note sure what you mean with "Sort the polygons spatially in some way"? You mean drawing polygons one by one? This might be what they do cause there is a file that represents rectangles that define extreme borders of the province in question (left, top, bottom, right). In this way they know where to draw the province although I have not seen single province images. They might acquire them from the big map or somehow? This has some advantages: Your artist could create any kind of map with any kinds of colors and details on it. An editor could be used to draw out the borders of the provinces. No requirements would be placed on the map, so your artist could add trees and other fine details without issue. This also means you could release the editor to your players and have them create their own maps easily if they wanted. [/quote] I cant imagine an editor with indenpendetly drawn provinces? How do you control their precise position on map? You could easily determine which provinces are attackable from a given province based on which edges are shared. This would additionally make it easy to draw those attacker arrows, since you would have well-defined edges and could select the most visually appropriate one pretty easily [/quote] All adjacent provinces are kept in a file similar to the one I described for hit testing. There is a province Id, followed by ids of adjacent provinces so its easy to know where you can go. Territories can be any shape (as long as the polygon isn't complex) and border any number of provinces (or none--say, an island) Those overlays based on territory, economy or what have you would be really easy to implement. Just overlay a translucent filled polygon on each territory. You could also use the province's polygon to clip drawing on that province -- say, if you wanted to draw a texture on it. Boost has a really nifty Polygon library for C++ that would make this a snap. I'm sure Python has something similar you could use. [/quote] I am not sure if Python has such library, I am even not sure can it be done in Python? But I need some more info about substance of working with maps like this one.
  9. Zed McJack

    How to create and work with not tile based map?

    Ok, Ive researched this a bit further. The map is actually tiled based, but not in simple way. The position of the mouse click (X,Y) is used to find out what province is being clicked at in the following way. There used to be a file made of two parts of information. First part stored y values and pointer to the second part where there was block of information containing following pairs starting pixel, province id, ending pixel. So it was actually look-up table where you would first search your Y value and then jump to block that represent the X row. And than scan till you find your X pixels value and coresponding province id. That was in EU2 when they used 2D graphics, from EU3 they switched to 3D, but as I am planing to use 2D in my game it is good to know how they did it. This was just a simple hit test. But bigger problem was painting the map according to the applied filter. Its much more complicated and I dont really understand how they do that. They used quad tree, but its still mystery to me. If someone has some good reading please post links or write here. (I regret that I tagged topic with python cause I probably missed someone who has experience with this from other languages. Can moderator fix that?)
  10. Zed McJack

    How to create and work with not tile based map?

    Well, in this game the problem is not in checking collisions because there are not too many objects moving around. When enemy armies are in the same province the battle commence and that is all. Much of it is just abstracted, there are no bullets flying, just my attributes vs your attributes + - some other modifiers and die roll. The map is static, meaning the shapes of provinces are fixed in that big file (I havent supplied yet (but I can if you insist)), so if province change hands just different color is applied, there are no collisions to check. The armies are not moving, you issue an movement order, the path is calculated and an arrow is drawn that is being filled up. When arrow fills, the movement of armies occur and the engine draws the army sprite in the other province, and redraws the arrow if army is moving even further or erases the arrow if that province was final destination.
  11. Zed McJack

    How to create and work with not tile based map?

    Below is the screenshot of zoomed in map from EU3 game. This filter is political so it shows you countries. There are dozen filters that paint the map differently depending on what you want to see. For example Terrain map, Rebel risk map, Holy roman empire map, Economy map etc. The basis of this shown map is a BMP file of 38MB, with resolution 5616x2160 where the individual provinces are painted with different RGB color. As you could see from the pic the borders are irregular and province can have any number of bordering provinces from 1(island) to 7-8 I never actually counted what is maximum. I dont see this as tile based map, but you can prove me wrong. In tile based map you have screen (rectangle) divided in rows and columns. Each tile is a position on map. So you store tiled based map in an array and its easy to tell what (game) object is at what position and where it is heading. With eu3 map this is not the case.
  12. Zed McJack

    Determinism

    Its interesting that a couple of hours before finding this topic I was reading news about NASA big announcement from Mars mission that cant be announced yet, and from there, followed link about what is going on when we die. The link went to the site of Robert Lanza who has theory called Biocentrism which states among other things that conciosness use tools like time and space to decsribe the world around us. He repeatedly says about experiment in quantum physic where "measurements an observer makes can influence events that have already happened in the past. One experiment (Science 315, 966, 2007) confirmed that flipping a switch could retroactively change a result that had happened before the switch was flipped. Regardless of the choice you, the observer, make, it'll be you who will experience the outcomes ?- the universes ?- that will result." So the world is as we see it or "the world is in the eye of beholder".
  13. Ok, I know its early to think about creating map while I am still cleaning code for MyPong, but the idea for a strategic game like Paradox's Europa Universalis or Crusader King is haunting me. Anyway, from what I was researching their huge map is just bmp file. The provinces are painted with different RGB color which gives them number of 16,777,216 possible provinces. Thats way to much for my need, but its good to know how it works. The other files establish the ID of the province and coresponding provincial atributes. There are of course tons of missing information here but I could not find more info on this type of mapping which for me is not tile based though I might be wrong. If someone could give me links of their thoughts on this I would appreciate it.
  14. I was looking where I got my rating up, so in my profile under the ratings, there is a list of topics and rating earned. In this case topic was "Convicted felon as a game programmer", but clicking on a hiperlink brought 404 "page not found". There was no trace of that topic in the for beginers forum (as it should?) that it was moved. I tried search and found the topic in the "Breaking in the industry" forum at this link: http://http://www.gamedev.net/topic/634143-convicted-felon-as-a-game-programmer/ Now the poll is gone so it might be another bug? hth
  15. Zed McJack

    Convicted Felon as a game programmer

    I dont see how that has any connection with for beginners forum its more about society, but, yes, everyone deserves a second chance. Though I can argue that all system is ill based and obsolete, it does not work very much, except as means of ruining lifes of already socialy problematic people and their behaviours
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!