Jump to content
  • Advertisement

robert4818

Member
  • Content Count

    546
  • Joined

  • Last visited

Everything posted by robert4818

  1. [color="#1C2837"][size="4"]I'll be graduating college next fall, and I am wondering what Game-Industry related jobs would be available with my degree skills [color="#1c2837"] [color="#1C2837"][size="4"]I will be graduating with a Degree in Probability and Statistics and a minor in Computer Science. [color=#1C2837][size=2]My actual programming skills will be light, with classes taken in Basic java programming (This is what our first two intro to computer science classes were taught in), Visual Basic, SQL, SAS programming, and probably assembly language. [color=#1C2837][size=2]I am just curious what opportunities I might find if I move in that direction vice going as an Actuarial.
  2. robert4818

    Opportunities with my Degree?

    Little. I have created a small little arcade game to practice java while I was in Computer Science 1. and I created a pirate board game a few years ago thats alot of fun.
  3. robert4818

    Modelling the Human Body for Combat

    I've not played dwarf fortress so I couldn't tell you anything about that game. However, the information you are looking for can be found in medical texts and studies. Especially ones to do with trauma causing things. You might look at car safety studies, and other things along those lines. I would almost wager that Dwarf Fortress used a series of tables to give the illusion of accuracy. (conjecture). The idea being that your table has a large number of possible outcomes when a certain area is hit by a certain type of weapon. Things like impact, fat absorption, etc. Simply adjust the random roll on the table up or down. (Harder impact moves the percentage roll up leading to more serious injuries, while fat would move the percentage roll down, offering "protection"
  4. robert4818

    MMO: AI controlled Factions

    Quote:Original post by yumok I think global AI should be used as an aditional way to give flavour to the world, but should never abandon the human writen lore that games have now. And it never should :) Any system I propose would use such lore as a starting point. In no-way would the AI replace lore in the game. Instead it is there to create a more dynamic war. If Country A and Country B have an inherent dislike for one another, then AI's should reflect that in some way. If the Devs decide to put out an expansion with some ground breaking event (say an outside invasion) then they would need to tweak the AI to reflect that change. This might cause the AI's to form an alliance of some sort. The main point of the idea though is to prevent the world from becoming static.
  5. Would you play in a game where the nations, instead of being static or player controlled, were instead ran by an AI? Basically, imagine a game with 5-12 different nations. Each one controlled by a "Civilization (the game)" level of AI. You do all the normal things you do as a player (Quest, Craft, Goblin Genocide, etc.) But things such as trade agreements, war/peace declarations, freedom of movement treaties, etc. are deciced between nations by these various AIs. What roles do players have in the metagame? First, your actions (Questing, Crafting, etc.) provide input for the AI's decision making. If you and your guild start going into a nation's territory where there is no freedom of movement you start influencing the different decisions for each country. (I.E. You trespass in nation A, who decides to stop allowing trade into your nation (Nation B). This causes Nation B to declare war on Nation A. Second, through in game actions you might be able, through elections or other actions, to change the personality of the AI that is controlling your nation. (Civilization AI's have differen't "Personalities" such as peace loving Ghandi, warmongering Ceaser, etc.) How would this benefit you? First, its sandboxish. You have freedom to make choices as you want. Second, its dynamic. You as a player have to learn to play in an evolving world. Nations might be at war only to end up as allies later. This means that you have to be able to adapt to it. Those better able to adapt/influence the world are better at succeeding. While you may be doing legal trade one week, the "mood" can shift, and you can find that same trade route is now a smuggling operation because the trade agreements went away. Third, its a different style of Factional PVP. Instead of their being constant factional warfare, you go to war sporadically against different enemies. You might find your guild HQ is now in the hands of a neighboring country because of a poor battle. So what do you think, Would this sort of set up be good for you? Would you play in it? [Edited by - robert4818 on November 8, 2010 4:21:03 PM]
  6. This idea (I know, I have alot of ideas. I want my dime...I'm surely at a dozen by now) is a compromise between allowing players to build anywhere, and still maintaining adventureing areas in an MMO. MMO's that have a build anywhere syle of play suffer from urban sprawl. Much of the open land becomes clogged with player housing. Areas that were once prime hunting grounds become cluttered with buildings. It ends up being a mess, and tends to hurt the game. Games like Darkfall counter this by designating only certain areas for players to build in. Its an ok solution, but it cuts down on freedom a bit much for my taste. My soulution is fairly simple, and works as a compromise. Players are allowed to build anywhere, but different areas on the map have a pre-set density cap. Players are allowed to build anywhere within that area, but once the cap is reached, no-more buildings can be built. This solution is rather simple programatically as well. (building density, not build anywhere.) The idea comes in three flavors. Floor space per area, points per area, or buildings per area. Buildings per area is the simpler of the two. The devs set an area up to hold only a certain number of buildings, and once that's met, its finished. One building can be a palace, or an outhouse though. Which could be a little odd. Floor Space per area is similar, however, instead of number of buildings, the devs can set up a specific amount of floor space to be allowed within an area. In that case, the number of buildings can vary. An area with a small amount of floorspace might hold a small village, or a single palace. Points per area is very similar to the floor space concept, however instead of checking floor space, each building is given a certain number of abstract points. A single house might be a few points, a black smith shop is worth more than that. The danger here is an urban sprawl of low point buildings. When I say area though, I don't mean "zone" I basically mean something like X/mi^2. The devs are able to control this density to lay out city areas, village areas, and isolated areas. They can even set the density to 0 for areas they want absolutely NO buildings in. (though I don't recommend it). A city might have 10000 buildings/sqmi (basically unlimited building) until reaching a certain point, and then it begins to drop off gradually, until it reaches the density of the surrounding area. A village might have a 10/sqmi area allowing for the construction of 10 buildings. A deep forest might have the density set to 1/sqmi. As for setting density, the easiest way to do it, IMO, is using a terrain generator as you find for many engines. They have tools that use paint brushes that affect things like terrain height, texture, etc. This would be the area, IMO, to set build density. You can use a simple tool to paint the variable information. What do you think? (note, there are many things not discussed here that programmers would have to decide upon, such as whether or not to allow building destruction/abandonment, or how to get rid of buildings that are taking up slots)
  7. robert4818

    Build (almost) Anywhere concept

    Quote:Original post by JoeCooper Quote:Original post by robert4818 What density planning does, is it allows for those players who might want to have an isolated cabin, lone wizard tower, or possibly even a forrested Palace, while still maintaining more than enough wilderness for adventuring in. It all depends on how you use the density planner. So we do want some role playing here, then? It's fine, I get all that, your post just got me brainstorming because it seems like an unnatural interruption to any suspension of disbelief. We could think up a density cap that's more "in character"... You could, for example, have lots of areas of very rough terrain that can't be built on, but there's just one spot with enough footprint for a wizard tower if some enterprising player grabs it first. In other words, have land that is explictly build-on-able. This is your density limit idea, but basically under an "in character" facade. So you don't run into the situation Servant mentioned where you run into a _surprise_ limit, and your wizard tower fantasy isn't interrupted with a game message about building caps. That'd feel bureaucratic, worse so than going to an in-game King to get a land grant for your wizard tower. Knowhatimean? I know what you mean, but I'm trying to avoid pre-built spots to a certain extent. I do wish there was a way to "hide" the density limit so that it appears more natural. That being said, I would still like something akin to my system in games, even if the limit was immersion breaking... :(
  8. robert4818

    Build (almost) Anywhere concept

    Quote:Original post by JoeCooper A density cap would encourage sprawl, not prevent it. It would have buildings spread further and further. Also, the players are doing something they want to do. There are players who stay in the wilderness, and players who want to develop it. I suggest adding more wilderness. Maintain a frontier. You might also revise the game rules to add more to do in the developed land. I think we may be having 2 different definitions of Urban Sprawl here. If someone builds an inn in a very low density area that is not urban sprawl, especially if that inn ends up being the only building in an entire square mile. What density planning does, is it allows for those players who might want to have an isolated cabin, lone wizard tower, or possibly even a forrested Palace, while still maintaining more than enough wilderness for adventuring in. It all depends on how you use the density planner.
  9. robert4818

    My First Project: Space Game

    Quote:Original post by Wai I didn't try it, but I like how you implemented variation in your first game. Stage 1: Flying through space against asteroids and small fighters Stage 2: Fighting turrets and enter the capital ship Stage 3: Flying inside the ship to destroy it. Someone could probably compile and run it. I don't have JRE. Thanks! This version is spartan, even with my rather spartan dream for it. I think I'm about 1/2 way through my design. I still have the planet maps to add, as well as the upgrades and the flags for the wormhole and the final boss. :) But I'm happy I've gotten the game together as far as I have considering I'm using this game as practice for my first semester of programming. :( No sound or graphics beyond basic shapes. But, Its not meant to be pretty. After all my capital ship is a large grey rectangle...
  10. Alrighty. My last attempt at this got locked, mainly because I posted too much code. That problem has been fixed:) The current version of this homemade video game can be found here: http://www.mediafire.com/download.php?hq91x7jg8fi3o6k The "Main" is found in StarGame.Java The code itself is sloppy and follw some bad habits, but I'm not overly concerned about that. I'm looking for some general feedback on the game design itself. The game is broken (at the moment) into a few different screens. Instructions for those are below: You can press f2 at any time to reset the game. Start Screen: up/down arrows: change selection enter: Enter selection. The Small game is on a 3x3 map, while the large game is on a 5x5 map. Space Screen (flying bad guys and asteroids) Up/Down arrows: speed up/slow down left/right arrows: turn left or right space bar: Shoot You can shoot the bad guys for points, asteroids and the edge of the screen stop your shots. You can fly off the side of the screen, and will move towards into a new screen (unless you are on an edge screen). Capital Ship Approach This screen is randomly placed within the space screen map. When you reach it the screen will automatically change to a new screen with a large light grey square in the middle, 4 red circles, and a smaller dark grey square. Direction arrows: Move you in the specified direction. Space Bar: Shoot "E": Enter the Capital Ship. This can only be done when you are within the dark grey square (the doors). A message will display on screen telling you to hit E to enter. You can shoot the guns (red circles) in order to deactivate them. Inside the capital Ship Direction arrows: move you up/down/left/right Space bar: Shoot Fly through the randomly generated walls, shoot the enemies. At the end of this very short screen, shoot the red block 10 times to destroy the ship. At this point you can consider the game "won" you can still continue to fly through the space screen and shoot bad guys. But the capital ship will not reappear. [Edited by - robert4818 on November 10, 2010 10:20:48 PM]
  11. robert4818

    MMO: AI controlled Factions

    Quote:Original post by Wai Re: robert4818 For the original question, I won't play it, because it seems to take too much time and effort to get familiar with the game world. AI or GM Now it seems that the main question is whether the changes should be decided by an AI or a GM. The advantage of having an AI is that it gives the player a chance to completely understand the effects of their actions. It allows the player to justisfy spending time analyzing, planning, and organizing for changes. This advantage is not unique to AI. You could have the same if the GM always follow the same set of rules to decide what to change. If that is the case though, chances are you want to automate it, because GM could make a mistake. The advantage of having a GM is that you have more variety in the expression of policies, and adds a personality to the game. This advantage is not as easily replaced by AI, but I think for this situation you could do it pretty well. So far it seems that you could have both advantages if you let the AI decide what changes to make, and ask the GM to do the speaking for the AI, and to create new rules for the AI. Everytime the GM creates a new rule, the GM could announce it so that the players know the updated rules. So the loop is like this: o AI collects statistics o AI decides any change in policy o GM reviews the AI's decision for any game-breaking flaws o GM must accept the AI's decision if there is no flaw o GM announces the decisions to the players o GM announces any new rule that the AI will use in the next period o Players do things o AI collects statistics o ... The other advantages of AI. It doesn't have to spend the time going over 5-12 factions over 10+ servers.... You don't have to pay it either.
  12. robert4818

    My First Project: Space Game

    Quote:Original post by Wai You might want to embed it on a webpage, or export it as an exe. :( I don't know how to do that. I'm still in my first semester of programming. Right now we call up what we have from the command prompt. I did forget to add. The "Main" is in StarGame.java
  13. robert4818

    Why Must Games Be Fair?

    As I said, the concept for me of "Fair" has to do with games that break their own rules. The other thing that labels the game unfair is if it has mechanics that can't be overcome. This may be something that you can't kill, can't dodge, and can easily kill you that occurs without predicatibility. (I.E. an enemy that shoots things that can't be dodged, and you cant kill it. However, it flies across the screen at random times and basically kills you.) This isn't fair, and no amount of preperation, or skill can avoid it.
  14. robert4818

    MMO: AI controlled Factions

    Quote:Original post by Talroth In that case it is a matter of giving the higher level (non-player) Story Tellers the data they need to actually make their choices. Basically taking the info on the actions that you would have fed into the AI, and allowing the Story Tellers to interpret that information. These people would be under the control of the developer, so it is up to them to make things work. Personally I don't think I would care for playing in a faction driven by an AI when the AI glitches out. "I declare war on you, and you and you,..." which leads to "Hey, look at fraction A, they're totally getting whipped in a 10 sided war,... hey, why haven't any A players logged on in the last week?" 2 points though. First, this is what testing is for. (I know it doesn't solve everything). Second, since this would be an MMO, such an extreme action could easily cause the devs to come in and over-ride such things if the need is great enough.
  15. robert4818

    MMO: AI controlled Factions

    Quote:Original post by Talroth Quote:Original post by EdtharanIn pen and paper RPGs, the Game Master acts as the NPCs and gets them to react to the PCs, the PCs then react to the Game Master and the reciprocal cycle of reactions goes on. In current cRPGs, the developers write the plot, and the palyers react to it. However the story does not react to the players (there might be alternate pre-set plot paths that the story follows, but these are still pre-set so it is not a true reciprocal reaction cycle). Which is why I suggested using human "Story Tellers" at various levels, possibly giving proven players the ability to become low level story tellers. (Such as an option for the GMs to 'upgrade' a trusted guild to a 'royal' status or something that sets it apart from random start ups. Nothing over powering however, but maybe options to post up 'guild quests', where the guild funds the prize, but it could have the option of having an effect on a larger picture.) The only drawback to that is that it has the chance robbing the players from being able to influence results. With an AI, the players KNOW that their actions have an affect, however small, on the directions things go. However, with a human story teller, this just isn't as true. The story teller COULD simply decide to go his own way.
  16. robert4818

    MMO: AI controlled Factions

    Quote:Original post by AngleWyrm Quote:Original post by robert4818 If you and your guild start going into a nation's territory where there is no freedom of movement you start influencing the different decisions for each country. (I.E. You trespass in nation A, who decides to stop allowing trade into your nation (Nation B). This causes Nation B to declare war on Nation A. This will result in squads of young people deliberately violating border agreements in order to see their effect of starting wars. "Hee hee hee, we started a national war!" :) Maybe. But then again, the AI might go a different route. It might lead to an open border agreement instead. It might lead to just a trade embargo, which opens up smuggling opportunities. It might cause A to get C to trespass into B instead. Also, the concept is like that of influence from the base as a whole. So it might take more than just a couple of squads doing border violations to have a big effect. The key will be finding the proper balance so that things shift frequently enough to keep things interesting, but not so frequently to lead to chaos. I would expect that the AI's would run in "turns" (like in Civ) with each turn occuring once a week. Though its entirely possible that the AI's could run continuously.
  17. robert4818

    MMO: AI controlled Factions

    Quote:Original post by Switch0025 It is an interesting idea but I've always felt that AI has the unfortunate side effect of not producing the drama that humans tend to produce. The reason online games (MMOs especially) are fun is because humans are the ones making the decisions, for good and especially for bad. I like how the AI are affected by your actions but I feel that the affect would be lost in the mass of an MMO. In a Civilization type game, you can feel the weight of you actions because you are the only human making them; if I attack another country and that country comes at me with knife and a bad attitude, I quickly become aware of the gravity of my decision making process. In an MMO, my actions would be like a drop in a bucket because they are just one of thousands. It would be like they don't really matter in the end. Instead of having 5-12 different AI controlled nations, you could have thousands of human controlled nations. They are essentially guilds but more formalized with things like territory control, trading, espionage, etc. Because there are more nations, they would likely have smaller numbers meaning the actions of each individual within those smaller nations would have more weight. I would not want to go that way myself because it defeats the feel I want for the concept. That is players are part of the society, not the movers and shakers. I WANT that feeling of "Do MY actions really count?" Part of this concept is that players are NOT the movers and shakers, but the game reacts to the PLAYERBASE. The other primary part of this idea is that the players have to react to an ever-changing world, instead of the world reacting to the player. Its intended for a very different style of atmosphere than the one you are presenting.
  18. robert4818

    Why Must Games Be Fair?

    One thing that screams "Unfair!" to me is when the game breaks its own rules. This is something that I always find irritating. If you are playing a game like NBA Jam! and you need 3 baskets in a row to be "on fire!" then it becomes "unfair" if the computer is able to go "on fire!" after only 2.
  19. I've recently been learning Java, and with it, programming in general (CS1 class in college). As a side project I'm looking to create a simple space based game. With that idea in mind, I'm tossing up a simple concept paper on this project to help get me started. In class we've started on this small game with a bird eating insects, but I was able to finish that. This project will be one of my own ideas. The summary: This is a little space based top down game (viewpoint similar to asteroids). The purpose of the game is to fly around a sector of space (represented by a 2d array of tiles.) Destroying enemy ships, Upgrading your ship, and exploring planets to find the items you need to open a wormhole that will get you to the "big bad". When flying through space, the controls of the ship will be: arrows: up/dn control speed. Arrows: Left/right rotate ship. Space: Fire. Moving off of the edge of the screen will load the next tile. Tiles will have a mix of moving enemies, moving meteors, stationary planets, and stationary "Capital ships." Flying over a planet will enter Planetary investigation mode. Controls for planetary investigation: Direction arrows: move ship in desired direction. Space: fires guns Right Control Btn: Aquires items from the planet surface. The planet's surface is a large area with a camera that focuses on the player's ship. When the ship moves, the ground moves around the ship instead. When attacking a capital ship, you destroy the guns on the outside, and then fly onto the inside to destroy the core: Controls for Capital ship attacks. (similar to "r-type") Arrows up/down: move ship up or down arrows left or right: move ship left or right (up to 1/2 screen) Exploring planets, destroying ships, etc. earn upgrades for the ship, and possibly one of the 3 pieces needed to open the wormhole that opens the final boss battle which takes place within normal space. If your curious about the variety of controls, this project is designed to be a learning process for me, the various controls and play styles are designed to be practice, not necessarily good game design. I will be using java utility "AnimApp" and "AAlib" as my graphical tools, as such the graphics in the game will be VERY simple (basic shapes). I also will not be having sound in the game at this point in time. The player will be able to choose between a 10x10 or a 20x20 grid for the game. Tiles will be generated randomly, with the exception of certain key tiles, which will be placed randomly but pre-built. Planets will be randomly generated. The capital ship segments will be randomly generated. Feedback will be appreciated. I will attempt to post the finished product when complete. I may post unfinished versions for feedback.
  20. robert4818

    My First Project: Space game Concept Paper.

    Source continued... Room.java import java.util.ArrayList; import java.util.Random; public class Room { public ArrayList<Enemy> enemies; //things to kill public ArrayList<Meteor> meteors; //things to not hit private int l, k,t=0; //loop variables private StarGame game; //For back referencing //constructor public Room(StarGame gameIn) { enemies = new ArrayList<Enemy>(); meteors = new ArrayList<Meteor>(); game = gameIn; } //for use in the prepare method of StarGame; public void prepare(int meteorIn) { AALib.setBackColor( new RGB( 0, 0, 0 ) ); boolean good = false; while(t<meteorIn) //supposed to keep meteors seperate { Meteor temp = new Meteor(); if(game.player.meteorCollision(temp) == false) { if (meteors.size() == 0) { meteors.add(temp); t++; } else { l=0; while (l < meteors.size()) { if(temp.meteorCollision(meteors.get(l))) { good = false; l = meteors.size(); } else { l++; good = true; } } if(good) { meteors.add(new Meteor()); t++; } } } } } //populates the room with enemies, runs every time you enter a new screen public void populate(int enemyIn) { enemies.clear(); for(k=0; k<enemyIn; k++) { enemies.add( new Enemy() ); } } //processes during the doFrame method of StarGame. public void action() { for( t=0; t<meteors.size(); t++ ) //meteor draw and collision detection { meteors.get(t).draw(); if(game.player.meteorCollision(meteors.get(t))) { game.lives--; if(game.lives>0) { game.player = new Ship(false, 10, 250, 100, RGB.WHITE, 0, 45 ); game.health = game.maxHealth; game.map[game.row][game.col].populate(game.enemycount); } else { game.player = new Ship(false, 0,0,0,RGB.BLACK,0,0); game.map[game.row][game.col].populate(game.enemycount); } } } for( k=0; k<enemies.size(); k++ ) //collision detection between enemy/player and draw { enemies.get(k).draw(); enemies.get(k).fly(); Random generator = new Random(); l = generator.nextInt(100); if(l<50) enemies.get(k).dirn += 10; else enemies.get(k).dirn -= 10; if(enemies.get(k).isOffSideEdge()) enemies.get(k).dirn = 180-(enemies.get(k).dirn); if(enemies.get(k).isOffHorizEdge()) enemies.get(k).dirn = 360-(enemies.get(k).dirn); if(game.player.enemyCollision(enemies.get(k))) { game.health --; enemies.remove(enemies.get(k)); if(game.health == 0) { game.lives --; if(game.lives>0) { game.player = new Ship(false, 10, 250, 100, RGB.WHITE, 0, 45 ); game.health = game.maxHealth; game.map[game.row][game.col].populate(game.enemycount); } else { game.player = new Ship(false, 0,0,0,RGB.BLACK,0,0); game.map[game.row][game.col].populate(game.enemycount); } } } } //ROOM SWITCHING if (game.player.isOffLeftEdge()) { if(game.row > 0) { game.row--; game.map[game.row][game.col].populate(game.enemycount); game.player.cx = 500 - game.player.radius; } else game.player.cx = game.player.radius; } if(game.player.isOffRightEdge()) { if(game.row < game.mapSize-1) { game.row++; game.map[game.row][game.col].populate(game.enemycount); game.player.cx = game.player.radius; } else game.player.cx = 500-game.player.radius; } if(game.player.isOffTopEdge()) { if(game.col < game.mapSize -1) { game.col++; game.map[game.row][game.col].populate(game.enemycount); game.player.cy = game.player.radius; } else game.player.cy = 450 - game.player.radius; } if(game.player.isOffBottomEdge()) { if(game.col > 0) { game.col--; game.map[game.row][game.col].populate(game.enemycount); game.player.cy = 450 - game.player.radius; } else game.player.cy = game.player.radius; } //Shot Declarations if( game.shot.isOffTopEdge()|| game.shot.isOffBottomEdge()|| game.shot.isOffRightEdge()|| game.shot.isOffLeftEdge() ) { game.fire = false; game.shot.cx = game.player.cx; game.shot.cy = game.player.cy; game.shot.dirn = game.player.dirn; game.shot.speed = game.player.speed; } for( t=0; t<meteors.size(); t++ ) { if(game.shot.meteorCollision(meteors.get(t))) { game.fire = false; game.shot.cx = game.player.cx; game.shot.cy = game.player.cy; game.shot.dirn = game.player.dirn; game.shot.speed = game.player.speed; } } for( k=0; k<enemies.size(); k++ ) { if(game.shot.enemyCollision(enemies.get(k))) { game.points += enemies.get(k).points; enemies.remove(enemies.get(k)); } } //ON SCREEN INFORMATION AALib.setColor( new RGB( 250, 250, 250 ) ); AALib.drawText("Score: "+game.points +" Lives: " + game.lives+" Health: " + game.health , 10, 450, .1, 0); AALib.drawText("Room: "+ game.row+"."+game.col, 300, 450, .1, 0); if(game.lives == 0) { AALib.setColor( new RGB( 250, 250, 250 ) ); AALib.drawText("GAME OVER", 50, 250, .5, 3); } } //KEYBOARD CONTROLS public void keys(int keysIn) { double dirnAmount = 5; double speedAmount = 1; if( keysIn == 1 )//left { if(game.fire == false) { game.player.turn( dirnAmount ); game.shot.dirn = game.player.dirn; } else game.player.turn( dirnAmount ); } else if( keysIn == 2 )//right { if(game.fire == false) { game.player.turn( -dirnAmount ); game.shot.dirn = game.player.dirn; } else game.player.turn( -dirnAmount ); } else if( keysIn == 3 ) //up { if(game.fire == false) { game.player.accelerate( speedAmount ); game.shot.speed = game.player.speed; } else game.player.turn( speedAmount ); } else if( keysIn == 4 ) //down { if(game.fire == false) { game.player.accelerate( -speedAmount ); game.shot.speed = game.player.speed; } else game.player.turn( -speedAmount ); } else if( keysIn == 5 ) { game.fire = true; game.shot.speed = game.shotSpeed; } } } Enemy.java import java.util.Random; public class Enemy { public double radius; // radius of the Enemy's collision circle public double cx, cy; // coords of the center point of the collision circle private RGB color; // color of the Enemy private double speed; // speed of the Enemy (duh!) public double dirn; // angle of travel in degrees (standard trig) public int points; public Enemy( double radiusIn, RGB colorIn, double speedIn) { Random generator = new Random(); radius = radiusIn; cx = generator.nextInt( 490 )+5; cy = generator.nextInt( 44 )+5; color = colorIn; speed = speedIn; dirn = generator.nextInt( 360 ); points = 10; } public Enemy () { Random generator = new Random(); int x = generator.nextInt(100); radius = 5; cx = generator.nextInt( 490 )+5; cy = generator.nextInt(440)+5; dirn = generator.nextInt( 360 ); if(x > 65) { color = RGB.YELLOW; speed = 5; points = 20; } else { color = RGB.BLUE; speed = 2.5; points = 10; } } public void draw() { AALib.setColor( color ); // draw the collision circle: AALib.drawCircle( cx, cy, radius ); AALib.begin( "polygon" ); AALib.point( cx+radius,cy ); AALib.point( cx, cy+radius ); AALib.point(cx-radius, cy ); AALib.point( cx, cy-radius ); AALib.end(); } public void fly() { cx += speed*Math.cos( Math.toRadians(dirn) ); cy += speed*Math.sin( Math.toRadians(dirn) ); } public void turn( double amount ) { dirn += amount; } public void accelerate( double amount ) { speed += amount; } public boolean isOffSideEdge() { return cx-radius < 0 || cx + radius > 500; } public Boolean isOffHorizEdge() { return cy+ radius > 450 || cy-radius < 0; } } meteor.java import java.util.Random; public class Meteor { public double radius; // radius of the Meteor's collision circle public double cx, cy; // coords of the center point of the collision circle private RGB color; // color of the Meteor private double speed; // speed of the Meteor (duh!) public double dirn; // angle of travel in degrees (standard trig) public int points; public Meteor( double radiusIn, RGB colorIn, double speedIn) { Random generator = new Random(); radius = radiusIn; cx = generator.nextInt( 500 ); cy = generator.nextInt( 500 ); color = colorIn; } public Meteor () { Random generator = new Random(); int x = generator.nextInt(100); radius = generator.nextInt( 10 )+10; cx = generator.nextInt( 460 )+20; cy = generator.nextInt(410)+20; color = RGB.ORANGE; } public void draw() { AALib.setColor( color ); double k; for( k=radius; k>0; k-- ) { AALib.drawCircle(cx, cy, k ); } } public boolean isOffSideEdge() { return cx-radius < 0 || cx + radius > 500; } public boolean isOffHorizEdge() { return cy+ radius > 500 || cy-radius < 0; } public boolean meteorCollision(Meteor other) { double xSqr, ySqr, radSqr; xSqr = (cx-other.cx)*(cx-other.cx); ySqr = (cy-other.cy)*(cy-other.cy); radSqr = (radius+other.radius) * (radius+other.radius); return xSqr + ySqr < radSqr; } } That should be all the files someone needs to compile and run. I think everyone has access to AAlib and AnimApp. Feedback and suggestions on how to clean up the code would be greatly apprciated. Known Issues: Some enemy ships get trapped along the edges of the screen. Sometimes the meteors spawn directly over the player, causing an instant game-over. I have code that SHOULD stop that, but it is apparently not working as intended. P.S. if these posts have moved beyond game design and into game programming, feel free to have them moved.
  21. robert4818

    My First Project: Space game Concept Paper.

    Ok. I have my first early test bed ready to go. This is a simple, game based on the space exploration portion of the game. In this version, you control the space ship, avoid the large meteors, and try to shoot the small flying spaceships. Controls: Up/Down: increase/decrease speed Left/Right: rotate the spaceship Spacebar: fires the gun The "map" is a 2 dimensional array, you start off in the lower left corner (0.0). You may move to other tiles by flying off of the edges, though the outside tiles have edges you cannot fly through. On the start screen you can choose between a "small" 3x3 tiles game or a "Large" 5x5 tiles game. This is a "complete" game with start screen, points, lives, and health. There are no advanced graphics (or even sprites). There are no sound effects. Source code is as follows: The main function is in the StarGame class. Stargame.java import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.Random; public class StarGame extends AnimApp { private Ship a; public Ship player, shot; private int k,t,l,r,c; public int points = 0, lives = 4, health = 5, maxHealth=5; public int enemycount = 5, meteorcount = 5; public Room[][] map; public String screen = "start"; public int mapSize = 5; public int row =0, col = 0; public boolean fire = false; public int shotSpeed = 20; private StartScreen start; public StarGame() { super( "StarGame", 500, 500, 33333333 ); } public void prepare() { if(screen.equals("map")) { player = new Ship(false , 10, 250, 100, RGB.WHITE, 0, 45 ); shot = new Ship (true ,7, 250, 100, RGB.BLUEGREEN,0,45); map = new Room [mapSize][mapSize]; for(r=0; r < mapSize; r++) { for(c=0; c < mapSize; c++) { map[r][c] = new Room(this); map[r][c].prepare(meteorcount); map[r][c].populate(enemycount); } } } else if(screen.equals("start")) { start = new StartScreen(this); start.prepare(); } } public void doFrame() { if(screen.equals("map")) { player.draw(); player.fly(); shot.fly(); if (fire == true) shot.draw(); map[row][col].action(); } else if(screen.equals("start")) start.action(); } public void keyPressed( KeyEvent e ) { int key=0; int code = e.getKeyCode(); double dirnAmount = 5; double speedAmount = 1; if( code == KeyEvent.VK_LEFT ) { key = 1; } else if( code == KeyEvent.VK_RIGHT ) { key = 2; } else if( code == KeyEvent.VK_UP ) { key = 3; } else if( code == KeyEvent.VK_DOWN ) { key = 4; } else if( code == KeyEvent.VK_SPACE ) { key = 5; } else if( code == KeyEvent.VK_ENTER ) { key = 6; } if(screen.equals("map")) map[row][col].keys(key); else if(screen.equals("start")) start.keys(key); } public static void main(String[] args) { new StarGame(); } } StartScreen.java import java.util.ArrayList; import java.util.Random; public class StartScreen { private StarGame game; private int choice; //constructor public StartScreen(StarGame gameIn) { game = gameIn; choice = 1; } //for use in the prepare method of StarGame; public void prepare() { AALib.setBackColor( new RGB( 0, 0, 0 ) ); } //processes during the doFrame method of StarGame. public void action() { //ON SCREEN INFORMATION AALib.setColor( new RGB( 250, 250, 250 ) ); AALib.drawText("Star Cruiser", 60, 300, .5, 0); AALib.drawText("Small Game", 190, 200, .2, 0); AALib.drawText("Large Game", 190, 150, .2, 0); AALib.drawText("Exit", 190, 100, .2, 0); AALib.setColor( new RGB( 0, 0, 128)); if(choice == 1) { AALib.setDepth( 100 ); AALib.begin( "polygon" ); AALib.point( 185, 190 ); AALib.point( 350, 190 ); AALib.point( 350, 230 ); AALib.point( 185, 230 ); AALib.end(); } else if(choice == 2) { AALib.setDepth( 100 ); AALib.begin( "polygon" ); AALib.point( 185, 140 ); AALib.point( 350, 140 ); AALib.point( 350, 180 ); AALib.point( 185, 180 ); AALib.end(); } else if(choice == 3) { AALib.setDepth( 100 ); AALib.begin( "polygon" ); AALib.point( 185, 90 ); AALib.point( 350, 90 ); AALib.point( 350, 130 ); AALib.point( 185, 130 ); AALib.end(); } } //KEYBOARD CONTROLS public void keys(int keysIn) { if( keysIn == 3 )//up { if(choice > 1) choice--; } else if( keysIn == 4 )//down { if(choice < 3) choice++; } else if( keysIn == 6 ) //enter { if (choice == 1) { game.screen = "map"; game.mapSize = 3; game.prepare(); } else if (choice == 2) { game.screen = "map"; game.mapSize = 5; game.prepare(); } else if (choice == 3) { System.exit(0); } } } } Ship.java import java.util.Random; public class Ship { public double radius; // radius of the Ship's collision circle public double cx, cy; // coords of the center point of the collision circle private RGB color; // color of the Ship public double speed; // speed of the Ship (duh!) public double dirn; // angle of travel in degrees (standard trig) public boolean filled; public Ship(boolean filledIn, double radiusIn, double cxIn, double cyIn, RGB colorIn, double speedIn, double dirnIn) { radius = radiusIn; cx = cxIn; cy = cyIn; color = colorIn; speed = speedIn; dirn = dirnIn; filled = filledIn; } public void draw() { AALib.setColor( color ); if(filled) { // draw the collision circle: AALib.drawDisk( cx, cy, radius ); } else { // draw the collision circle: AALib.drawCircle( cx, cy, radius ); // draw segment from center to edge: AALib.begin( "lines" ); AALib.point( cx, cy ); AALib.point( cx + radius*Math.cos( Math.toRadians(dirn)), cy + radius*Math.sin( Math.toRadians(dirn)) ); AALib.end(); } } public void fly() { cx += speed*Math.cos( Math.toRadians(dirn) ); cy += speed*Math.sin( Math.toRadians(dirn) ); } public void turn( double amount ) { dirn += amount; } public void accelerate( double amount ) { if(speed < 10) speed += amount; else speed = 10; } public boolean isOffLeftEdge() { return cx-radius < 0; } public boolean isOffRightEdge() { return cx + radius > 500; } public Boolean isOffTopEdge() { return cy+ radius > 450; } public boolean isOffBottomEdge() { return cy-radius < 0; } public boolean meteorCollision(Meteor other) { double xSqr, ySqr, radSqr; xSqr = (cx-other.cx)*(cx-other.cx); ySqr = (cy-other.cy)*(cy-other.cy); radSqr = (radius+other.radius) * (radius+other.radius); return xSqr + ySqr < radSqr; } public boolean enemyCollision(Enemy other) { double xSqr, ySqr, radSqr; xSqr = (cx-other.cx)*(cx-other.cx); ySqr = (cy-other.cy)*(cy-other.cy); radSqr = (radius+other.radius) * (radius+other.radius); return xSqr + ySqr < radSqr; } } RGB.java public class RGB { public int red, green, blue; public RGB( int r, int g, int b ) { red = r; green = g; blue = b; } public static RGB RED = new RGB( 255, 0, 0 ); public static RGB GREEN = new RGB( 0, 255, 0 ); public static RGB BLUE = new RGB( 0, 0, 255 ); public static RGB WHITE = new RGB( 255, 255, 255 ); public static RGB YELLOW = new RGB( 255, 255, 0 ); public static RGB BLACK = new RGB( 0, 0, 0 ); public static RGB ORANGE = new RGB( 255, 128, 84 ); public static RGB BLUEGREEN = new RGB( 0, 255, 255 ); }
  22. robert4818

    My First Project: Space game Concept Paper.

    Quote:Original post by Krohm So it's a multi-screen asteroids when it comes to navigation. Pretty much. Quote:Would you elaborate on planetary explaration? For first, what's the goal of this mode? How does the player benefits from this? As far as I've got it, planetary exploration is very similar, in rewarding, to standard space exploration. My thoughts for both the planets and the capital ships will be that those will be what contain most of the upgrades. I'm not positive how I will do it with the capital ships quite yet, but when it comes to the planets they will be found and picked up during planetary exploration. Quote: Quote:The capital ship segments will be randomly generated.Maybe like in shellcore (a flash game)? Sounds good, but I bet you really mean "procedurally generated". Yes, procedurally generated is probably the better name. Random just rolls off the tongue a bit better.
  23. robert4818

    Java Question

    Thanks! I think that will help me out alot.
  24. robert4818

    Java Question

    New to java (and programming in general), so I'm not sure my question is even possible. I'm working with a program and I'm not sure how to (or if I can) do the following. I'm working with multiple classes, one of which is my Primary class (it has the main). During operation, I'm trying to call a method in another class. During the operation of the method, I need to manipulate and reference variables from the primary class. However, the manipulation is done in such a way that its not a "return" style. (i.e. if an action occurs the player needs to lose a number from the lives variable in the primary class, but the method is more than just checking to see if the player lost a life.) Is there a way to basically reference the primary class such as main.lives?
  25. robert4818

    Java Question

    Quote:Original post by SimonForsman Quote:Original post by robert4818 Here's what I'm doing. I'm using a class that extends the animapp class. Part of that is the doFrame() method. This portion of my the code is where all the magic happens, and everytime the frame refreshes, the code within it executes. In the game that I'm working on, I want the doframe() instructions to be different based on what "screen" I'm on (start screen, flying, planet, etc.) One way to handle this is to do a large amount of If thens that has the code nested within it based on the screen the code is in. My thought on this was to instead create an action() method within the screen and under the doFrame() method have a much cleaner looking code. public void doFrame() { if(screen.equals("Start") { startScreen.action(); } Elseif(screen.equals("space") { spaceScreen.action(); } } Then it would be much easier (IMO) to go into the appropriate action() method to troubleshoot instead of looking through a long list of nested instructions. Unfortunately that requires back-referencing to the sending class, and I'm unsure how to do this. normally you wouldn't need back-referencing in this situation since the class containing the doFrame method shouldn't have anything worth referencing, However since doFrame isn't static you can just pass "this" so public void doFrame() { currentScreen.action(this); } public class SpaceScreen extends Screen { public void action(WhateverClassThedoFrameMethodIsIn owner) { owner.publicMethod(parameters); owner.publicVariable=value; } } Allthough there shouldn't be any sane reason for the "screen" to access the class that holds the doFrame method, if the screen needs access to other objects you should pass references to those objects to its constructor, From the looks of things spaceScreen is the only thing that actually uses the asteroids and player objects, so why not just let it own those ? Part of the problem is I'm not overly familiar with the AnimApp class. (I believe its a super class and as of yet we haven't touched super classes yet.) As it is. I'm modifying this code below and greatly adding to it to create my game. *This is the WORKING version of the code, not the bug riddled one. It simply creates a circle that chases other circles and tries to touch them without hitting a tree circle... It forms the basis of what I'm working on, but I'm adding in different parts of the game (for now I'm calling them "Screens". This one will switch between rooms of an array to form a small map, but currently all the doFrame() instructions are part of this parent class. import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.Random; public class BirdGame extends AnimApp { private Bird a; private Bird player; private int k,t,l, points = 0, lives = 4; private int bugcount = 5, treecount = 5; private Room[] map; private int room = 0; public BirdGame() { super( "BirdGame", 500, 500, 33333333 ); } public void prepare() { a = new Bird( 10, 250, 100, RGB.WHITE, 0, 45 ); player = a; map = new Room [2]; map[0] = new Room(); map[1] = new Room(); map[0].prepare(bugcount, treecount); map[1].prepare(bugcount, treecount); } public void doFrame() { a.draw(); a.fly(); for( t=0; t<map[room].trees.size(); t++ ) { map[room].trees.get(t).draw(); if(a.treeCollision(map[room].trees.get(t))) { lives--; room = 0; if(lives>0) { a = new Bird( 10, 250, 100, RGB.WHITE, 0, 45 ); player = a; } else a = new Bird(0, 0, 0, RGB.BLACK, 0, 0); } } for( k=0; k<map[room].bugs.size(); k++ ) { map[room].bugs.get(k).draw(); map[room].bugs.get(k).fly(); Random generator = new Random(); l = generator.nextInt(100); if(l<50) map[room].bugs.get(k).dirn += 10; else map[room].bugs.get(k).dirn -= 10; if(map[room].bugs.get(k).isOffSideEdge()) map[room].bugs.get(k).dirn = 180-(map[room].bugs.get(k).dirn); if(map[room].bugs.get(k).isOffHorizEdge()) map[room].bugs.get(k).dirn = 360-(map[room].bugs.get(k).dirn); if(a.bugCollision(map[room].bugs.get(k))) { points += map[room].bugs.get(k).points; map[room].bugs.remove(map[room].bugs.get(k)); map[room].bugs.add( new Bug() ); } } if (a.isOffLeftEdge()) { if(room == 1) { room--; a.cx = 500 - a.radius; } else a.cx = a.radius; } if(a.isOffRightEdge()) { if(room == 0) { room++; a.cx = a.radius; } else a.cx = 500-a.radius; } if(a.isOffTopEdge()) a.cy = 450 - a.radius; if(a.isOffBottomEdge()) a.cy = a.radius; AALib.setColor( new RGB( 250, 250, 250 ) ); AALib.drawText("Score: "+points +" Lives: " + lives , 10, 450, .1, 0); AALib.drawText("Room: "+ room, 300, 450, .1, 0); if(lives == 0) { AALib.setColor( new RGB( 250, 250, 250 ) ); AALib.drawText("GAME OVER", 50, 250, .5, 3); } } public void keyPressed( KeyEvent e ) { int code = e.getKeyCode(); double dirnAmount = 5; double speedAmount = 1; if( code == KeyEvent.VK_LEFT ) { player.turn( dirnAmount ); } else if( code == KeyEvent.VK_RIGHT ) { player.turn( -dirnAmount ); } else if( code == KeyEvent.VK_UP ) { player.accelerate( speedAmount ); } else if( code == KeyEvent.VK_DOWN ) { player.accelerate( -speedAmount ); } } public static void main(String[] args) { new BirdGame(); } } Part of the problem for me though is I'm clueless as to what to do to call this class. Unlike other constructors, the new Birdgame() doesn't seem to be made with a variable name attached to it. I've tried BirdGame.lives to see if it would even attempt to reference the lives variable and give me back a "Lives is set to private" error, but I don't get that. I was hoping there was a generic "sender" or "back" style of code that would just instantly refrence the sending class.
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!