5 Replies - 2287 Views - Last Post: 22 September 2012 - 07:40 PM Rate Topic: -----

#1 Benzoate  Icon User is offline

  • D.I.C Head


Reputation: 51
  • View blog
  • Posts: 234
  • Joined: 29-February 12

Random Enemy Gen (Java)

Posted 28 August 2012 - 06:16 PM

Good day, D.I.C.

I've been searching around the webs the past couple of days for tutorials on how to randomly generate "enemies" in java (preferably using the Slick2D and LWJGL libraries) but to no success. So I've come to ask if someone could point me towards a tutorial or somewhere to start, as random enemy generation is kind of important in games

Thanks for any help :3
Is This A Good Question/Topic? 0
  • +

Replies To: Random Enemy Gen (Java)

#2 Mina-no-Hime  Icon User is offline

  • D.I.C Head

Reputation: 98
  • View blog
  • Posts: 176
  • Joined: 23-August 12

Re: Random Enemy Gen (Java)

Posted 28 August 2012 - 06:23 PM

This system will be entirely based upon how the rest of your engine code operates, and what you want to randomize. For example, randomly spawning enemies in a side-scrolling shooter game is going to be very different from a mob spawner in a first-person shooter, and much different from a generator that creates mobs with random attributes/abilities.

What is it, specifically, that you're trying to generate random enemies for?
Was This Post Helpful? 0
  • +
  • -

#3 Benzoate  Icon User is offline

  • D.I.C Head


Reputation: 51
  • View blog
  • Posts: 234
  • Joined: 29-February 12

Re: Random Enemy Gen (Java)

Posted 28 August 2012 - 07:53 PM

I'm trying to randomly generate enemies for a 2D game

http://axgl.org/f/evo/

Kind of like that game in the style, but I would like for the enemies to be placed randomly on the map. So, essentially randomly generating mobs for a 2D game
Was This Post Helpful? 0
  • +
  • -

#4 stayscrisp  Icon User is online

  • フカユ
  • member icon

Reputation: 1000
  • View blog
  • Posts: 4,181
  • Joined: 14-February 08

Re: Random Enemy Gen (Java)

Posted 29 August 2012 - 01:11 AM

What makes you think the enemies in that you posted game are randomly generated? Seems to me like they are placed beforehand.
Was This Post Helpful? 0
  • +
  • -

#5 Benzoate  Icon User is offline

  • D.I.C Head


Reputation: 51
  • View blog
  • Posts: 234
  • Joined: 29-February 12

Re: Random Enemy Gen (Java)

Posted 29 August 2012 - 11:22 AM

hmm.. didn't think about that. Well, let me rephrase my question now that I have thought about it more. How can I create a method to draw a new enemy on command instead of having to hard code each enemy?
Was This Post Helpful? 0
  • +
  • -

#6 nunc  Icon User is offline

  • D.I.C Head

Reputation: 36
  • View blog
  • Posts: 131
  • Joined: 20-November 11

Re: Random Enemy Gen (Java)

Posted 22 September 2012 - 07:40 PM

You would have to define "on demand".

If you want temporary randomized enemies that live only in the instance your program is running, then you need to create a factory.
Basically what this factory would do is handle the creation of a new random enemy, and it would return that new enemy instance to be used in your game.


However if you want randomized enemies that will appear in every instance of your program, then you will have to get more involved with file I/O.
You will need to set up a file template of how you will read/write, write your information to that file ( enemy type, position, attributes, ect ) and you will have to code a file processor to read that information in and create your enemy based off of that type/position/attributes ect.
The random part can come from the random attributes/ect written to the file. It can also be randomized by adding the capacity to store all of the enemies read in by your file processor into a vector, to then have randomized access to no particular enemy.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1