2d space game

Community Forums/Showcase/2d space game

Cruis.In(Posted 2008) [#1]
Hey currently I'm using star trek graphics/sounds

What I'd like is to open source this with some other interested parties, particularly someone who can do AI/game world stuff...

:)

http://www.filefactory.com/file/e4ab65/

mail me 1500@...


Vilu(Posted 2008) [#2]
Welcome to the open-source 2d space game developers' club ;)

I briefly tried your demo and it doesn't look bad at all. Your project looks quite similar to mine, but I think our games are going to two very different directions, mine being very much focused on realism, open-ended exploration and trading. Yours looks like it'll be a lot more action oriented.

What sort of gameplay you are planning to do? A quick shoot-em-up, tactical space battle or adventure with a plot?


Cruis.In(Posted 2008) [#3]
eheh, did you read the readme :)

thanks for trying it.

I would love to make it open ended and trading etc, but with the ability to have that good action of course.

I'd like to have a plot in it, but a plot which doesnt have to be played if you dont want to.

Id basically like something like starflight, little ship, big universe :)


Vilu(Posted 2008) [#4]
Sounds like a lot of fun indeed. I'm currently looking into procedural universe generation - actually already implemented most of it - so the "big universe" part will be handled with a little bit of an overkill: 500 million unique solar systems ought to do the trick ;)

I'll be interested to see how your project develops in the future.


Jesse(Posted 2008) [#5]
Cruis.in why don't you get an account on filefront is free and you can post your files there for everyone to download. Right now I am having problems downloading your demo.
http://www.filefront.com/


Cruis.In(Posted 2008) [#6]
ok ill do that, sorry that you had trouble, at least you will not have any trouble now.

2 places to do the download. this should be what you need now.

As for following me Vilu: dont! lol, i tend to get discouraged when I think of the future, and AI and universe etc, which has what has lead me to always just drop this project :(

Even though I know I started out as a newbie and I learned everything I needed to learn and eventually wrapped my head around whatever I tried. But I think Ai is getting a little advanced even for someone who is as determined as me.

explain the concept of procedural, since I learned OOp from the start ( started with python as a beginner then switched to blitzmax) whats different other than not using objects? Does procedural mean sequential or not neccessarily.

http://hosted.filefront.com/cruisin1500/


Vilu(Posted 2008) [#7]
In procedural content generation I don't refer to OO/procedural programming, but ways to generate some game content on-the-fly using few pseudo-random algorithms. In my game, the game world with 500+ million solar systems is not pre-defined in any of the configuration files, but the stars are generated as needed. New freshly generated stars pop out when the starmap is scrolled around the galaxy and "forgotten" after the starmap camera leaves the area. The pseudo-random algorithms and seeds ensure that the generated content is always the same in every game, for every player and on every hardware. The concept and methods I'm using is actually exactly the same as in Elite II Frontier.

I will soon release another intermediate demo displaying mainly the universe generator.


Rimmsy(Posted 2008) [#8]
This is how I wrote my game too. I started with a single seed and generated a few systems for you to play with. I also use the seed for generating NPC players and stations so there would be some possibility of coming across a ship you'd seen before. It also meant I could generate things on the fly.

I'm liking where you're going with your game. I love DS9!


Cruis.In(Posted 2008) [#9]
wow ok, is there any material I could read to wrap my head around this "seeding" and procedural universe/npc generation.

I take it your AI was controlled by specific behavor though and not just randomly flying around the world?:)


Cp(Posted 2008) [#10]
Did you use opengl?
cause it does not work. :(


Rimmsy(Posted 2008) [#11]
In my game it all comes down to what the player will see or care about. I could have created persistent NPCs that fly from system to system but I didn't go that route. I created "realistic" amounts of NPC traffic when you entered a system and it got updated every so often with new traffic, some leaving, some entering, some killing each other.

They all had various tasks to get on with. When they entered the system (be it by spawning or when the system was loaded), they'd have a blank task list which got filled with various things. One example might be a pirate who, depending on his surroundings might patrol asteroid belts then - on the fly - attack a nearby trade ship. Others would be spawned on the outer parts of the system and travel to a random station, wait for a few minutes, undock and fly to another system. But when they got far enough away instead of being persistent, they would vanish.

You could create the same ship with the same variables by calling rndSeed(num) before you created the ship. Or just make the seed come from a unique identifier (eg: its name). There are plenty of games that use procedural techniques and it's a good way to manage your game. But there are times when it's not required. There's plenty about it around. Here's some info at Wiki: http://en.wikipedia.org/wiki/Procedural_generation

Have a look at my game, http://www.birdinsky.com


Cruis.In(Posted 2008) [#12]
wow cool. npcs that fly around and might attack a trade ship, then you could swoop down and help it. is it possible to learn this type of programming by example? Or do I need alot of other reference material?

Is your AI thousands of lines of code?

judging from the screenies of your game, thats very advanced stuff!


Rimmsy(Posted 2008) [#13]
No, the AI I developed was quite simple. I chose a state based method allowing the NPC to sort out its first task and when finished move onto the next. Each one of these tasks can be programmed separately and allows for quite complex assortments.

1. Target a station
2. Go to within 120 units of target
3. Dock with station
4. wait for 200 seconds
5. undock
6. choose random system
7. go to system

--------
1. choose random trader ship
2. go to within 60 units of trader ship
3. attack until target = dead
4. choose more tasks


Method update()
	Local i:Task=Task(currentTasks.first())
	If i
		Select i.mode
			Case "choose random station"
				target = randomStation()
				taskComplete()
				
			Case "go to "
				If distanceToTarget > 50
					flyTo(target.x,target.y)
				Else
					taskComplete()
				EndIf
				
			Case "undock"
				undockShip()
				taskComplete()
				
			Case "wait"
				If MilliSecs()-waitStart > waitTime
					taskComplete()
				EndIf
		End Select	
	EndIf
End Method


As for the programming of randomly created objects, it's quite easy really. The SeedRnd function is your friend. Here's an example: Use keys 1-5 to create a "random" planet...




Cruis.In(Posted 2008) [#14]
pretty cool stuff.

so basically for my AI, I could create basic functions which can be called anytime I want an AI to do something based on its behaviour.

like above

flyto() will have instructions on flying a given place wherever that is based on that its currently doing.


Vilu(Posted 2008) [#15]
The SeedRnd function is your friend.


Unfortunately, the results of the SeedRnd function is hardware-dependent. You'll need a Mersenne Twister or some other pseudo-random generator to make the "random" results consistent across platforms.

I'm using bah.Random, Brucey's SFMT wrapper (SIMD-oriented Fast Mersenne Twister) that works as a drop-in replacement for the standard Random commands.
http://brucey.net/programming/blitz/#bahrandom


Rimmsy(Posted 2008) [#16]
Yeah, I was thinking about that just before. Good call.


*(Posted 2008) [#17]
thanks vilu thought that had been sorted


Rimmsy(Posted 2008) [#18]
Cruis, you have it absolutely right. The FlyTo() method would move/turn the ship to get to its targetX, targetY within a certain distance and return true when done. This means you could also make it an autopilot for the player's ship. Here's some pseudocode: