Dilplomacy

Blitz3D Forums/Blitz3D Beginners Area/Dilplomacy

RogueM(Posted 2007) [#1]
i'm making a game that needs diplomacy, sort of like SM's Civilization, but i need it to pause the other action going on and bring up a diplomacy screen that shows your relations, what u can do ,e.g. trade, and what items you can trade. any help?


H&K(Posted 2007) [#2]
what items you can trade
Jelly Babys or Space ships or water or salt or .... everything in the game


RogueM(Posted 2007) [#3]
that's not quite what i ment. i mean something that can register if you have something and how many.


Jsoren(Posted 2007) [#4]
so pretty much you need an entire menu system, as well as an invintory system. thats easier said than done. I wouldent know where to start as far as help goes. you just described a massive part of the game. may I ask what kind of game it is that your trading jelly babies?
I suppose getting to know Types and Arrays REALLY REALLY well couldnt hurt either.

JS


RogueM(Posted 2007) [#5]
i didnt come up with jelly babies, you can thank h&k for that. Anyway, it's a sandbox game, or at least I think that's what it's called. It's a space game where you can go anywhere in the galaxy and do whatever you want, with a set of random events,(wars and such) you can talk to just about anyone, and trade with people like an interstellar empire leader or just some average smuggler. i've got the flight system working , but diplomacy is my bigest issue, seeing as I have no clue on how or where to start.


H&K(Posted 2007) [#6]
"Basets Jelly Babies" Inc are going to be a corperation in in Civ 5, you need access to sugar and Cows.

(Look its no more stupid than sushi which you can trade in Civ iv)


Jsoren(Posted 2007) [#7]
if the type of dipomacy your talking about is simply a 'gain diplomacy pts with this group for each quest you do for them' kind of thing, then you can just have 2 type fields for the player, for each other faction. one for diplomacy pts, and one for diplomacy lvl, when the diplomacy pts reach a certain number, you diplomacy toward that certain group goes up a lvl...is that even CLOSE to what you mean?

and as for "Basets Jelly Babies" ive never played any civ games so i wouldent know about the jelly babies, or sushi, or...


RogueM(Posted 2007) [#8]
it's not quests,rather, you can get certain items(E.G. ship parts or spices) and you could trade tham for something one of the characters has, if you drive a hard bargain then your relations go down, and if your generous, it goes up. the higher the rating the more willing the person is to help you or be more generous. I suppose that points and levels might be a good aproach.


Jsoren(Posted 2007) [#9]
ahh, ok. if theres alot of possible characters to trade with then it might be better if the pts and lvl were both fields of the different characters.


RogueM(Posted 2007) [#10]
Ok, but how could i bring up the diplomacy screen, and stop everything else but still have the diplomacy run?


Jsoren(Posted 2007) [#11]
bringing up the screen is just drawing a viewport when you click the "diplomacy" button, and stoping everything else would be a while..wend loop:

if imagesoverlap(mouseimg,mousex(),mousey(),dimlomacyButton,buttonx,buttony)
  if mousedown(1)
    diplomacymenu=true
  endif
endif

function diplomacy()
  while diplomacymenu=true
    viewport viewx,viewy,300,500
    color 0,0,0
    rect viewx,viewy,300,500

    ;do all the menu stuff here
    ;when exit button is hit simple set diplomacymenu to false
  wend
end function


i didnt check any of the code but thats the basic idea of how to do it, theres other ways too. i use viewx and viewy as variables because i usually have the option to move the window around.


RogueM(Posted 2007) [#12]
ok, that works. now how could I make an inventory. I was thinking of using a type with the fields "item" and "item_in".


RogueM(Posted 2007) [#13]
.


Jsoren(Posted 2007) [#14]
well, theres alot of different ways to make invintories, some people prefer to use types in types, usually i prefer to do something like this. first a make type Item
Type Item
  field id
  field stats
  field misc
end type


and in the beginning of the code somewhere i make all the items i need. and assign them all a unique id. them i make type Inv

Type Inv
  field Id
  field stats
  field misc
end type


you can make type inv into an array thats the max amount of items that you can have. whenever you refer to an Inv slot all you need is its ID, then use a for..next loop to match it to the item of matching id, and tell get its stats, misc from the items stats,misc...

if your using a set amount of rescources typ thing then theres probly and easier way, this way it more openended.


RogueM(Posted 2007) [#15]
ok, I'll try that. If this works i'll be about 60% done with making the game, thanks so much, jsoren, you're a huge help. :)